Midjourney Proxy Plus无实例账号自动禁用该渠道

This commit is contained in:
阳光里海的声音 2024-06-07 00:16:54 +08:00
parent c1040afed9
commit a47111a031

View File

@ -538,7 +538,16 @@ func RelayMidjourneySubmit(c *gin.Context, relayMode int) *dto.MidjourneyRespons
ChannelId: c.GetInt("channel_id"), ChannelId: c.GetInt("channel_id"),
Quota: quota, Quota: quota,
} }
if midjResponse.Code == 3 {
//无实例账号自动禁用渠道No available account instance
channel, err := model.GetChannelById(midjourneyTask.ChannelId, true)
if err != nil {
common.SysError("get_channel_null: " + err.Error())
}
if channel.AutoBan != nil && *channel.AutoBan == 1 {
model.UpdateChannelStatusById(midjourneyTask.ChannelId, 2)
}
}
if midjResponse.Code != 1 && midjResponse.Code != 21 && midjResponse.Code != 22 { if midjResponse.Code != 1 && midjResponse.Code != 21 && midjResponse.Code != 22 {
//非1-提交成功,21-任务已存在和22-排队中,则记录错误原因 //非1-提交成功,21-任务已存在和22-排队中,则记录错误原因
midjourneyTask.FailReason = midjResponse.Description midjourneyTask.FailReason = midjResponse.Description