fix: add unique key for MidJourney task_id

This commit is contained in:
RockYang
2024-01-03 18:06:10 +08:00
parent 023dc89c3e
commit 3d75093b2c
7 changed files with 103 additions and 70 deletions

View File

@@ -121,9 +121,11 @@ func (s *Service) Notify(data CBReq) {
return
}
tx := s.db.Where("task_id = ? AND progress < 100", split[0]).Session(&gorm.Session{}).Order("id ASC")
tx := s.db.Session(&gorm.Session{}).Order("id ASC")
if data.ReferenceId != "" {
tx = tx.Where("reference_id = ?", data.ReferenceId)
} else {
tx = tx.Where("task_id = ?", split[0])
}
res = tx.First(&job)
if res.Error != nil {