From 1a4c2886d279e7ae9ea5de4e69ebcd17eaeb5176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 09:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=85=B3=E6=B3=A8=E6=94=B9?= =?UTF-8?q?=E4=BB=B7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 16 ++++++------ business/jxstore/tempop/tempop.go | 41 +++++++++++++++---------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 735e15d35..618bc256a 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1020,7 +1020,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs if user := ctx.GetFullUser(); user != nil { isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0 } - + fmt.Println("test1") userName := ctx.GetUserName() needSyncIDMap := make(map[int]int) dao.Begin(db) @@ -1037,6 +1037,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs dao.Rollback(db) return nil, err } + fmt.Println("test2") scaleFactor := float64(1) if isScale { scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage)) @@ -1083,6 +1084,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue) // globals.SugarLogger.Debug(sql) if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil { + fmt.Println("test3") if len(allBinds) > 0 { // globals.SugarLogger.Debug(utils.Format4Output(allBinds, false)) inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds)) @@ -4585,12 +4587,12 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto if len(storeAudits) > 0 { storeAudits[0].DeletedAt = time.Now() dao.UpdateEntity(db, storeAudits[0], "DeletedAt") - if globals.IsProductEnv() { - skuAndNames, err := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, nil) - if len(skuAndNames) > 0 && err == nil { - weixinmsg.NotifyStoreOpRequestStatus(true, storeID, skuBindInfo.NameID, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, skuBindInfo.UnitPrice, "") - } - } + // if globals.IsProductEnv() { + // skuAndNames, err := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, nil) + // if len(skuAndNames) > 0 && err == nil { + // weixinmsg.NotifyStoreOpRequestStatus(true, storeID, skuBindInfo.NameID, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, skuBindInfo.UnitPrice, "") + // } + // } } globals.SugarLogger.Debugf("doStoreSkuAudit return3 storeID : %v nameID: %v", storeID, skuBindInfo.NameID) return false, err diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 777aa641c..113ccb824 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1668,32 +1668,31 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { vendorMap[v.SkuList[0].SkuID] = v } for _, v := range storeSkuList { - if vendorMap[v.SkuID] == nil && v.Status == model.StoreSkuBindStatusNormal { - addList = append(addList, v.SkuID) + if vendorMap[v.SkuID] == nil { + if v.Status == model.StoreSkuBindStatusNormal { + addList = append(addList, v.SkuID) + } } else { - fmt.Println("vendorMap", utils.Format4Output(vendorMap[v.SkuID], false)) - if vendorMap[v.SkuID].SkuList[0] != nil { - if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice { + if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice { + updateList = append(updateList, &tTmp{ + SkuID: v.SkuID, + Reason: "价格不同", + }) + } + if v.Status != vendorStock2JxStatus(vendorMap[v.SkuID].SkuList[0].Stock) { + updateList = append(updateList, &tTmp{ + SkuID: v.SkuID, + Reason: "库存可售不同", + }) + } + skus, _ := dao.GetSkus(dao.GetDB(), []int{v.SkuID}, nil, nil, nil, nil) + if skus[0].Comment != "" { + if skus[0].Comment != vendorMap[v.SkuID].SkuList[0].Comment { updateList = append(updateList, &tTmp{ SkuID: v.SkuID, - Reason: "价格不同", + Reason: "备注与销售属性不同", }) } - if v.Status != vendorStock2JxStatus(vendorMap[v.SkuID].SkuList[0].Stock) { - updateList = append(updateList, &tTmp{ - SkuID: v.SkuID, - Reason: "库存可售不同", - }) - } - skus, _ := dao.GetSkus(dao.GetDB(), []int{v.SkuID}, nil, nil, nil, nil) - if skus[0].Comment != "" { - if skus[0].Comment != vendorMap[v.SkuID].SkuList[0].Comment { - updateList = append(updateList, &tTmp{ - SkuID: v.SkuID, - Reason: "备注与销售属性不同", - }) - } - } } } localMap[v.SkuID] = v