修复 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
|
||||
|
||||
@@ -276,7 +276,7 @@ function formatSyncStatus(job: SyncJob): string {
|
||||
}
|
||||
const statusText = job.status === 'success' ? '成功' : '失败'
|
||||
if (job.status === 'failed' && job.error_message) {
|
||||
return `${statusText} · ${timeStr} · ${job.error_message}`
|
||||
return `${statusText} · ${timeStr} · ${job.error_message} · ${job.id.slice(0, 8)}`
|
||||
}
|
||||
return `${statusText} · ${timeStr}`
|
||||
return `${statusText} · ${timeStr} · ${job.id.slice(0, 8)}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user