fix: 网元状态更新带时间变化
This commit is contained in:
@@ -221,8 +221,10 @@ func (r NeInfo) UpdateState(id int64, status int64) int64 {
|
|||||||
tx := db.DB("").Model(&model.NeInfo{})
|
tx := db.DB("").Model(&model.NeInfo{})
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
tx = tx.Where("id = ?", id)
|
tx = tx.Where("id = ?", id)
|
||||||
tx.UpdateColumn("status", status)
|
tx.Updates(map[string]any{
|
||||||
tx.UpdateColumn("update_time", time.Now().UnixMilli())
|
"status": status,
|
||||||
|
"update_time": time.Now().UnixMilli(),
|
||||||
|
})
|
||||||
// 执行更新
|
// 执行更新
|
||||||
if err := tx.Error; err != nil {
|
if err := tx.Error; err != nil {
|
||||||
logger.Errorf("update err => %v", err.Error())
|
logger.Errorf("update err => %v", err.Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user