From a6a6045065169ab56c7d44ea32dce743d940e840 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期五, 08 十二月 2023 11:15:19 +0800
Subject: [PATCH] collection改为固定12345
---
controllers/product_controller.go | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index 054b4ca..43a9db0 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -214,6 +214,22 @@
return
}
+ //鏇存柊鍦ㄥ簱鐨勪骇鍝佺被鍨�
+ if params.CategoryId > 0 {
+ find, _ := models.NewLocationProductAmountSearch().SetProductId(params.ID).Find()
+ if len(find) > 0 {
+ var ids []int
+ for _, f := range find {
+ if f.ProductCategoryID != params.CategoryId {
+ ids = append(ids, f.Id)
+ }
+ }
+ m := make(map[string]interface{})
+ m["productCategoryId"] = params.CategoryId
+ _ = models.NewLocationProductAmountSearch().SetIds(ids).UpdateByMap(m)
+ }
+ }
+
materialAttachmentList := []*models.MaterialAttachment{}
for _, v := range params.AttachmentIDs {
ma := &models.MaterialAttachment{MaterialID: params.ID, AttachmentID: v}
@@ -318,7 +334,7 @@
return
}
- first, err := models.NewProductCategorySearch().SetID(cast.ToUint(id)).First()
+ first, err := models.NewProductCategorySearch().SetID(cast.ToInt(id)).First()
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触")
return
@@ -343,7 +359,7 @@
util.ResponseFormat(c, code.RequestParamError, "浜у搧绫诲瀷鍚嶇О涓嶈兘涓虹┖")
return
}
- err := models.NewProductCategorySearch().SetID(params.ID).Save(¶ms)
+ err := models.NewProductCategorySearch().SetID(params.Id).Save(¶ms)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "浜у搧绫诲瀷淇℃伅鏇存柊澶辫触")
return
@@ -364,7 +380,7 @@
util.ResponseFormat(c, code.RequestParamError, "鏃犳晥id")
return
}
- err := models.NewProductCategorySearch().SetID(cast.ToUint(id)).Delete()
+ err := models.NewProductCategorySearch().SetID(cast.ToInt(id)).Delete()
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "鍒犻櫎澶辫触")
return
@@ -528,7 +544,7 @@
return
}
if err := models.WithTransaction(func(tx *gorm.DB) error {
- if err := models.NewOperationSearch().SetOrm(tx).SetID(id).Update(&models.Operation{Status: constvar.OperationStatus_Finish}); err != nil {
+ if err := models.NewOperationSearch().SetOrm(tx).SetID(id).Update(&models.Operation{Status: constvar.OperationStatus_Finish, AuditDate: time.Now().Format("2006-01-02 15:04:05")}); err != nil {
return err
}
var listProdtId []string
@@ -729,6 +745,7 @@
return
}
operation.Status = constvar.OperationStatus_Cancel
+ operation.AuditDate = time.Now().Format("2006-01-02 15:04:05")
if err := models.NewOperationSearch().SetID(operation.Id).Save(operation); err != nil {
util.ResponseFormat(c, code.SaveFail, err.Error())
return
--
Gitblit v1.8.0