소스 검색

修改产品更新时间

fuwencai 4 년 전
부모
커밋
c424f22d2d
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      service/product.go

+ 3 - 0
service/product.go

@@ -9,6 +9,7 @@ import (
 	"sfis/model"
 	"strconv"
 	"strings"
+	"time"
 )
 
 // 创建产品
@@ -53,6 +54,8 @@ func UpdateProduct(updateMap map[string]interface{}, id int) error {
 			updateMap[k] = strV
 		}
 	}
+	t := time.Now()
+	updateMap["update_at"] = t
 	result := db.GetSFISDB().Table("product").Where("id = ?", id).Updates(updateMap)
 	if result.Error != nil {
 		global.Logger.Error("productUpdate Error", zap.Any("updateMap", updateMap), zap.Any("error", result.Error))