修复 LatestJob 排序并显示任务 ID
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user