Browse Source

增加上游构图失败判断

余生一个白恩 1 year ago
parent
commit
706449dede
1 changed files with 3 additions and 2 deletions
  1. 3 2
      controller/midjourney.go

+ 3 - 2
controller/midjourney.go

@@ -5,7 +5,6 @@ import (
 	"context"
 	"encoding/json"
 	"fmt"
-	"github.com/gin-gonic/gin"
 	"io"
 	"log"
 	"net/http"
@@ -16,6 +15,8 @@ import (
 	"strconv"
 	"strings"
 	"time"
+
+	"github.com/gin-gonic/gin"
 )
 
 func UpdateMidjourneyTaskBulk() {
@@ -147,7 +148,7 @@ func UpdateMidjourneyTaskBulk() {
 					task.Buttons = string(buttonStr)
 				}
 
-				if task.Progress != "100%" && responseItem.FailReason != "" {
+				if task.Progress != "100%" && responseItem.FailReason != "" || task.Progress == "100%" && task.Status == "FAILURE" {
 					common.LogInfo(ctx, task.MjId+" 构建失败,"+task.FailReason)
 					task.Progress = "100%"
 					err = model.CacheUpdateUserQuota(task.UserId)