Merge pull request 'fix' (#1) from devad/pcm-coordinator:master into master

Former-commit-id: 734c3784f984a64ae3cbc9c02eafd55b19c5a688
This commit is contained in:
tzwang 2024-05-19 17:00:32 +08:00
commit 5f3476decf
3 changed files with 4 additions and 6 deletions

View File

@ -409,7 +409,7 @@ type (
NsID string `json:"nsId,omitempty" db:"ns_id"`
TenantId string `json:"tenantId,omitempty" db:"tenant_id"`
CreatedTime string `json:"createdTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time" gorm:"autoUpdateTime"`
UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time"`
AdapterTypeDict int `json:"adapterTypeDict" db:"create_time" gorm:"adapter_type_dict"` //任务类型(对应字典表的值
}
)

View File

@ -109,9 +109,7 @@ func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<-
task.Status = aiTask[0].Status
task.StartTime = aiTask[0].StartTime
task.EndTime = aiTask[0].EndTime
tx = l.svcCtx.DbEngin.Model(&types.TaskModel{}).Table("task")
tx = tx.Where("deleted_at is null")
tx = tx.Updates(task)
tx = l.svcCtx.DbEngin.Model(task).Table("task").Where("deleted_at is null").Updates(task)
if tx.Error != nil {
logx.Errorf(tx.Error.Error())
return
@ -174,7 +172,7 @@ func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<-
}
task.UpdatedTime = time.Now().Format(constants.Layout)
tx = l.svcCtx.DbEngin.Table("task").Updates(task)
tx = l.svcCtx.DbEngin.Table("task").Model(task).Updates(task)
if tx.Error != nil {
logx.Errorf(tx.Error.Error())
return

View File

@ -345,7 +345,7 @@ type TaskModel struct {
NsID string `json:"nsId,omitempty" db:"ns_id"`
TenantId string `json:"tenantId,omitempty" db:"tenant_id"`
CreatedTime string `json:"createdTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time" gorm:"autoUpdateTime"`
UpdatedTime string `json:"updatedTime,omitempty" db:"updated_time"`
AdapterTypeDict int `json:"adapterTypeDict" db:"create_time" gorm:"adapter_type_dict"` //任务类型(对应字典表的值
}