mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-19 17:56:39 +08:00
fix: restore user img_calls quota when image task run failed
This commit is contained in:
parent
816e4a096e
commit
70c46d098b
@ -333,6 +333,8 @@ func (h *MidJourneyHandler) JobList(c *gin.Context) {
|
|||||||
// 10 分钟还没完成的任务直接删除
|
// 10 分钟还没完成的任务直接删除
|
||||||
if time.Now().Sub(item.CreatedAt) > time.Minute*10 {
|
if time.Now().Sub(item.CreatedAt) > time.Minute*10 {
|
||||||
h.db.Delete(&item)
|
h.db.Delete(&item)
|
||||||
|
// 退回绘图次数
|
||||||
|
h.db.Model(&model.User{}).Where("id = ?", item.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls + ?", 1))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,8 @@ func (h *SdJobHandler) JobList(c *gin.Context) {
|
|||||||
// 5 分钟还没完成的任务直接删除
|
// 5 分钟还没完成的任务直接删除
|
||||||
if time.Now().Sub(item.CreatedAt) > time.Minute*5 {
|
if time.Now().Sub(item.CreatedAt) > time.Minute*5 {
|
||||||
h.db.Delete(&item)
|
h.db.Delete(&item)
|
||||||
|
// 退回绘图次数
|
||||||
|
h.db.Model(&model.User{}).Where("id = ?", item.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls + ?", 1))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// 正在运行中任务使用代理访问图片
|
// 正在运行中任务使用代理访问图片
|
||||||
|
@ -617,6 +617,7 @@ const fetchRunningJobs = (userId) => {
|
|||||||
message: "任务ID:" + jobs[i]['task_id'],
|
message: "任务ID:" + jobs[i]['task_id'],
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
imgCalls.value += 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_jobs.push(jobs[i])
|
_jobs.push(jobs[i])
|
||||||
|
@ -596,6 +596,7 @@ onMounted(() => {
|
|||||||
message: "任务ID:" + jobs[i]['task_id'],
|
message: "任务ID:" + jobs[i]['task_id'],
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
imgCalls.value += 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_jobs.push(jobs[i])
|
_jobs.push(jobs[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user