修复 LatestJob 排序并显示任务 ID

This commit is contained in:
2026-07-04 12:18:21 +08:00
parent 7f300b9067
commit d497eb7f96
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -198,7 +198,7 @@ func (s *StockSyncService) LatestJob(ctx context.Context) (*models.StockSyncJob,
var job models.StockSyncJob
if err := s.db.WithContext(ctx).
Where("started_at > ?", time.Time{}).
Order("started_at DESC").
Order("started_at DESC, id DESC").
First(&job).Error; err != nil {
if err == gorm.ErrRecordNotFound {
return nil, nil