diff --git a/api/handler/mj_handler.go b/api/handler/mj_handler.go index a9c8922b..94bb7ea4 100644 --- a/api/handler/mj_handler.go +++ b/api/handler/mj_handler.go @@ -157,7 +157,7 @@ func (h *MidJourneyHandler) Image(c *gin.Context) { Prompt: prompt, CreatedAt: time.Now(), } - if res := h.db.Create(&job); res.Error != nil { + if res := h.db.Create(&job); res.Error != nil || res.RowsAffected == 0 { resp.ERROR(c, "添加任务失败:"+res.Error.Error()) return } @@ -215,7 +215,7 @@ func (h *MidJourneyHandler) Upscale(c *gin.Context) { Prompt: data.Prompt, CreatedAt: time.Now(), } - if res := h.db.Create(&job); res.Error != nil { + if res := h.db.Create(&job); res.Error != nil || res.RowsAffected == 0 { resp.ERROR(c, "添加任务失败:"+res.Error.Error()) return } @@ -264,7 +264,7 @@ func (h *MidJourneyHandler) Variation(c *gin.Context) { Prompt: data.Prompt, CreatedAt: time.Now(), } - if res := h.db.Create(&job); res.Error != nil { + if res := h.db.Create(&job); res.Error != nil || res.RowsAffected == 0 { resp.ERROR(c, "添加任务失败:"+res.Error.Error()) return } diff --git a/api/handler/payment_handler.go b/api/handler/payment_handler.go index da68ec2a..0cedea27 100644 --- a/api/handler/payment_handler.go +++ b/api/handler/payment_handler.go @@ -232,7 +232,7 @@ func (h *PaymentHandler) PayQrcode(c *gin.Context) { Remark: utils.JsonEncode(remark), } res = h.db.Create(&order) - if res.Error != nil { + if res.Error != nil || res.RowsAffected == 0 { resp.ERROR(c, "error with create order: "+res.Error.Error()) return }