From 132e30d89f3d30f6c44c2aa0a93f0218a92cf199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jul 2020 13:56:04 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E9=85=8D=E9=80=81?= =?UTF-8?q?=E9=85=8D=E9=80=81=E7=B1=BB=E5=9E=8B=E9=80=89=E7=89=B9=E6=83=A0?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 2 +- business/partner/delivery/jdeclp/waybill.go | 29 +++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index c7f20be56..aedde0842 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -354,7 +354,7 @@ func syncStoreSku() { }) errList.AddErr(err) - _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, partner.GetMultiStoreVendorIDs(), nil, false, nil, []int{27379}, syncFlag, true, true) + _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{0}, nil, false, nil, []int{27379}, syncFlag, true, true) // _, err = cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, db, partner.GetMultiStoreVendorIDs(), nil, false, []int{27379}, true, true) errList.AddErr(err) case 1: diff --git a/business/partner/delivery/jdeclp/waybill.go b/business/partner/delivery/jdeclp/waybill.go index 7015c38b6..c88bf0b47 100644 --- a/business/partner/delivery/jdeclp/waybill.go +++ b/business/partner/delivery/jdeclp/waybill.go @@ -56,20 +56,21 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee return bill, fmt.Errorf("未查询到该门店! 门店id :[%v]", storeID) } vendorWaybillID, err := api.JdEclpAPI.WaybillReceive(&jdeclpapi.WaybillReceiveParam{ - SalePlat: jdeclpapi.SalePlatSourceDelivery, - CustomerCode: jdeclpapi.CustomerCode, - OrderID: order.VendorOrderID, - SenderName: order.StoreName, - SenderAddress: stores[0].Address, - SenderTel: stores[0].Tel1, - ReceiveName: order.ConsigneeName, - ReceiveAddress: order.ConsigneeAddress, - ReceiveTel: order.ConsigneeMobile, - Weight: order.Weight, - Vloumn: order.Weight, - PackageCount: 1, - Description: "生鲜", - Aging: 5, + SalePlat: jdeclpapi.SalePlatSourceDelivery, + CustomerCode: jdeclpapi.CustomerCode, + OrderID: order.VendorOrderID, + SenderName: order.StoreName, + SenderAddress: stores[0].Address, + SenderTel: stores[0].Tel1, + ReceiveName: order.ConsigneeName, + ReceiveAddress: order.ConsigneeAddress, + ReceiveTel: order.ConsigneeMobile, + Weight: order.Weight, + Vloumn: order.Weight, + PackageCount: 1, + Description: "生鲜", + Aging: 5, + PromiseTimeType: 1, //特惠送 }) waybill := &model.Waybill{ VendorOrderID: order.VendorOrderID, From b7fa5bdd38c2a46914a495f63bd1c8d7e0527b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jul 2020 17:21:45 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=B8=8D=E5=90=8C=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 2 +- business/jxstore/tempop/tempop.go | 100 +++++++++++++----- business/partner/purchase/jdshop/store_sku.go | 41 ++++--- 3 files changed, 104 insertions(+), 39 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index c4fc83f79..934de2287 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1249,7 +1249,7 @@ func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) { var ( db = dao.GetDB() ) - skuExinfos, err := dao.GetSkuExinfos(db, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDJD}, "", utils.ZeroTimeValue, utils.ZeroTimeValue) + skuExinfos, err := dao.GetSkuExinfos(db, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDJD, model.VendorIDJDShop}, "", utils.ZeroTimeValue, utils.ZeroTimeValue) task := tasksch.NewParallelTask("SyncSkuExperfixAndWatermark", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { skuExinfo := batchItemList[0].(*model.SkuExinfoMap) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index bb1f341db..604f8b1d5 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1610,30 +1610,30 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - db := dao.GetDB() - type tStore struct { - NameID int `orm:"column(name_id)"` - StoreID int `orm:"column(store_id)"` - } - var resultList []*tStore - stores, _ := dao.GetStoreList(db, nil, nil, nil, nil, "") - for _, v := range stores { - var resultList2 []*tStore - sql := ` - SELECT a.name_id,a.store_id FROM ( - SELECT DISTINCT a.unit_price,b.name_id,a.store_id from store_sku_bind a,sku b,store c - where a.sku_id = b.id - and c.id = a.store_id and c.deleted_at = '1970-01-01 00:00:00' - and a.store_id = ? - and a.deleted_at = '1970-01-01 00:00:00')a - GROUP BY 1,2 - HAVING count(a.unit_price) > 1 - ` - sqlParams := []interface{}{v.ID} - err = dao.GetRows(db, &resultList2, sql, sqlParams) - resultList = append(resultList, resultList2...) - } - fmt.Println("testresultList3", utils.Format4Output(resultList, false)) + // db := dao.GetDB() + // type tStore struct { + // NameID int `orm:"column(name_id)"` + // StoreID int `orm:"column(store_id)"` + // } + // var resultList []*tStore + // stores, _ := dao.GetStoreList(db, nil, nil, nil, nil, "") + // for _, v := range stores { + // var resultList2 []*tStore + // sql := ` + // SELECT a.name_id,a.store_id FROM ( + // SELECT DISTINCT a.unit_price,b.name_id,a.store_id from store_sku_bind a,sku b,store c + // where a.sku_id = b.id + // and c.id = a.store_id and c.deleted_at = '1970-01-01 00:00:00' + // and a.store_id = ? + // and a.deleted_at = '1970-01-01 00:00:00')a + // GROUP BY 1,2 + // HAVING count(a.unit_price) > 1 + // ` + // sqlParams := []interface{}{v.ID} + // err = dao.GetRows(db, &resultList2, sql, sqlParams) + // resultList = append(resultList, resultList2...) + // } + // fmt.Println("testresultList3", utils.Format4Output(resultList, false)) // var skuBindInfos []*cms.StoreSkuBindInfo // for _, v := range resultList { // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) @@ -1646,6 +1646,58 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // skuBindInfos = append(skuBindInfos, skuBindInfo) // } // _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) + type tTmp struct { + SkuID int `json:"skuID"` + Reason string `json:"reason"` + } + var vendorMap = make(map[int]*partner.SkuNameInfo) + var localMap = make(map[int]*model.StoreSkuBind) + var addList, deleteList []int + var updateList []*tTmp + vendorStock2JxStatus := func(stock int) (status int) { + if stock > 0 { + return model.StoreSkuBindStatusNormal + } else { + return model.StoreSkuBindStatusDontSale + } + } + handler := partner.GetPurchasePlatformFromVendorID(model.VendorIDJDShop).(partner.ISingleStoreStoreSkuHandler) + skuNameList, err := handler.GetStoreSkusFullInfo(ctx, nil, 0, "", nil) + storeSkuList, err := dao.GetStoresSkusInfo(dao.GetDB(), []int{model.JdShopMainStoreID}, nil) + for _, v := range skuNameList { + vendorMap[v.SkuList[0].SkuID] = v + } + for _, v := range storeSkuList { + if vendorMap[v.SkuID] == nil { + addList = append(addList, v.SkuID) + } else { + 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 != vendorMap[v.SkuID].SkuList[0].Comment { + updateList = append(updateList, &tTmp{ + SkuID: v.SkuID, + Reason: "备注与销售属性不同", + }) + } + } + localMap[v.SkuID] = v + } + for k, _ := range vendorMap { + if localMap[k] == nil { + deleteList = append(deleteList, k) + } + } return err } diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index cd0295bdc..7bbf19c26 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -143,8 +143,14 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v } updateWareParam.Introduction = desc updateWareParam.MobileDesc = desc - if v.Img != "" { - pic1, err2 := uploadImg2(v.Img, name, "1") + img := "" + if v.ImgMix != "" { + img = v.ImgMix + } else { + img = v.Img + } + if img != "" { + pic1, err2 := uploadImg2(img, name, "1") err = err2 err = api.JdShopAPI.ImageUpdate(v.JdsWareID, 1, pic1) if v.Img2 != "" { @@ -228,13 +234,13 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) { var ( pageNo = 1 - pageSize = 100 + pageSize = 20 ) - pageResult, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) - for ; pageNo <= pageResult.TotalItem/pageSize+1; pageNo++ { - result, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) + _, totalCount, err := api.JdShopAPI.SearchSkuList(pageNo, pageSize) + for ; pageNo <= totalCount/pageSize+1; pageNo++ { + result, _, err := api.JdShopAPI.SearchSkuList(pageNo, pageSize) if err == nil { - for _, v := range result.Data { + for _, v := range result { if skuName := vendorSku2Jx(v); skuName != nil { skuNameList = append(skuNameList, skuName) } @@ -403,18 +409,25 @@ func ybSkuStatus2Jx(ybStatus int) (jxSkuStatus int) { return jxSkuStatus } -func vendorSku2Jx(result *jdshopapi.SearchWare4ValidResultData) (skuName *partner.SkuNameInfo) { +func vendorSku2Jx(result *jdshopapi.SearchSkuListResult) (skuName *partner.SkuNameInfo) { if result == nil { globals.SugarLogger.Warnf("vendorSku2Jx, strange result:%s", utils.Format4Output(result, true)) return nil } - // prefix, name, comment, specUnit, unit, specQuality := jxutils.SplitSkuName(result.Title) skuName = &partner.SkuNameInfo{ - Name: result.Title, - VendorNameID: utils.Int64ToStr(result.WareID), - Status: result.WareStatus, - VendorCatIDList: []string{utils.Int2Str(result.CategoryID)}, - NameID: utils.Str2Int(result.OuterID), + VendorNameID: utils.Int64ToStr(result.WareID), + SkuList: []*partner.SkuInfo{ + &partner.SkuInfo{ + StoreSkuInfo: partner.StoreSkuInfo{ + SkuID: utils.Str2Int(result.OuterID), + VendorSkuID: utils.Int64ToStr(result.SkuID), + VendorNameID: utils.Int64ToStr(result.WareID), + Stock: result.StockNum, + VendorPrice: utils.Float64TwoInt64(result.JdPrice * 100), + }, + Comment: result.SaleAttrs[0].AttrValueAlias[0], + }, + }, } return skuName } From 868e338ad9e44fdf007fbe8ab92699597b6b322c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jul 2020 17:27:34 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=BF=98=E5=8A=A0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 604f8b1d5..7a90bb0df 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1698,6 +1698,9 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { deleteList = append(deleteList, k) } } + fmt.Println("addList", addList) + fmt.Println("updateList", updateList) + fmt.Println("deleteList", deleteList) return err } From 8498ef2d20126954d5b90c540adad2ff080a972d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jul 2020 17:55:20 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 7a90bb0df..015d85a79 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1668,7 +1668,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { vendorMap[v.SkuList[0].SkuID] = v } for _, v := range storeSkuList { - if vendorMap[v.SkuID] == nil { + if vendorMap[v.SkuID] == nil && v.Status == model.StoreSkuBindStatusNormal { addList = append(addList, v.SkuID) } else { if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice { @@ -1698,9 +1698,9 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { deleteList = append(deleteList, k) } } - fmt.Println("addList", addList) - fmt.Println("updateList", updateList) - fmt.Println("deleteList", deleteList) + fmt.Println("addList2", addList) + fmt.Println("updateList2", updateList) + fmt.Println("deleteList2", deleteList) return err } From deaf6f06d714faafa41802478536e1431565e4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jul 2020 18:04:30 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 015d85a79..9680942e7 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1699,7 +1699,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } } fmt.Println("addList2", addList) - fmt.Println("updateList2", updateList) + fmt.Println("updateList2", utils.Format4Output(updateList, false)) fmt.Println("deleteList2", deleteList) return err } From 802f328510cf428fa7515bcc86f2016163399290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jul 2020 18:29:16 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 41 +++++++++++++++++-------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 9680942e7..5689839b3 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1671,24 +1671,29 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { if vendorMap[v.SkuID] == nil && v.Status == model.StoreSkuBindStatusNormal { addList = append(addList, v.SkuID) } else { - 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 != vendorMap[v.SkuID].SkuList[0].Comment { - updateList = append(updateList, &tTmp{ - SkuID: v.SkuID, - Reason: "备注与销售属性不同", - }) + if vendorMap[v.SkuID].SkuList[0] != nil { + fmt.Println("vendorMap", utils.Format4Output(vendorMap[v.SkuID], false)) + 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: "备注与销售属性不同", + }) + } + } } } localMap[v.SkuID] = v From b4692c66b231794c64c26133e0d8b47fd81c2859 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:00:05 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8Echeck?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 5689839b3..777aa641c 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1671,8 +1671,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { if vendorMap[v.SkuID] == nil && 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 { - fmt.Println("vendorMap", utils.Format4Output(vendorMap[v.SkuID], false)) if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice { updateList = append(updateList, &tTmp{ SkuID: v.SkuID, 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 8/8] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E6=94=B9=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