Explorar o código

修改产品更新时间

fuwencai %!s(int64=4) %!d(string=hai) anos
pai
achega
c424f22d2d
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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))