From b8e330dd1a3114904a2cc6638148e406e5e0eab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 09:20:51 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E7=9B=B4=E8=BE=96=E5=B8=82=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/const.go | 8 ++++++++ business/partner/purchase/jdshop/store.go | 25 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/business/model/const.go b/business/model/const.go index 700f6d71d..87a459c01 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -151,6 +151,14 @@ var ( VendorIDEBAI: 0, } + ZXCityCodeMap = map[int]string{ + 310100: "上海市", + 110100: "北京市", + 120100: "天津市", + 440300: "深圳市", + 500100: "重庆市", + } + PrinterVendorInfo = map[int][]string{ VendorIDFeiE: []string{ VendorChineseNames[VendorIDFeiE], diff --git a/business/partner/purchase/jdshop/store.go b/business/partner/purchase/jdshop/store.go index 0a308695b..96b4d9bea 100644 --- a/business/partner/purchase/jdshop/store.go +++ b/business/partner/purchase/jdshop/store.go @@ -105,6 +105,31 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri if createEntityStoreParam.AddCode == 0 { createEntityStoreParam.AddCode = store.JdCode } + //证明这个店可能隶属直辖市 + if model.ZXCityCodeMap[store.CityCode] != "" { + result1, _ := api.JdShopAPI.GetProvince() + for _, v := range result1 { + if v.AreaName == model.ZXCityCodeMap[store.CityCode] { + result2, _ := api.JdShopAPI.GetCity(v.AreaID) + for _, vv := range result2 { + if vv.AreaName == store.DistrictName { + result3, _ := api.JdShopAPI.GetCounty(vv.AreaID) + for _, vvv := range result3 { + result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat)) + if result["regeocode"] != nil { + street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string) + if street != "" { + if street == vvv.AreaName { + createEntityStoreParam.AddCode = vvv.AreaID + } + } + } + } + } + } + } + } + } vendorStoreID, err = api.JdShopAPI.CreateEntityStore(createEntityStoreParam) return vendorStoreID, err } From eace2ae518c2d78b5798b78a815140c497ef7058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 09:48:42 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9B=B4=E8=BE=96=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jdshop/store.go b/business/partner/purchase/jdshop/store.go index 96b4d9bea..ea2bd3bda 100644 --- a/business/partner/purchase/jdshop/store.go +++ b/business/partner/purchase/jdshop/store.go @@ -109,10 +109,10 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri if model.ZXCityCodeMap[store.CityCode] != "" { result1, _ := api.JdShopAPI.GetProvince() for _, v := range result1 { - if v.AreaName == model.ZXCityCodeMap[store.CityCode] { + if strings.Contains(model.ZXCityCodeMap[store.CityCode], v.AreaName) { result2, _ := api.JdShopAPI.GetCity(v.AreaID) for _, vv := range result2 { - if vv.AreaName == store.DistrictName { + if strings.Contains(store.DistrictName, vv.AreaName) { result3, _ := api.JdShopAPI.GetCounty(vv.AreaID) for _, vvv := range result3 { result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat)) From 146314729260aa57c9271830d5fb02c21023c239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 09:56:05 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9B=B4=E8=BE=96=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store.go | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/business/partner/purchase/jdshop/store.go b/business/partner/purchase/jdshop/store.go index ea2bd3bda..d797ec2cb 100644 --- a/business/partner/purchase/jdshop/store.go +++ b/business/partner/purchase/jdshop/store.go @@ -107,25 +107,28 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri } //证明这个店可能隶属直辖市 if model.ZXCityCodeMap[store.CityCode] != "" { - result1, _ := api.JdShopAPI.GetProvince() - for _, v := range result1 { - if strings.Contains(model.ZXCityCodeMap[store.CityCode], v.AreaName) { - result2, _ := api.JdShopAPI.GetCity(v.AreaID) - for _, vv := range result2 { - if strings.Contains(store.DistrictName, vv.AreaName) { - result3, _ := api.JdShopAPI.GetCounty(vv.AreaID) - for _, vvv := range result3 { - result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat)) - if result["regeocode"] != nil { - street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string) - if street != "" { + result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat)) + if result["regeocode"] != nil { + street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string) + if street != "" { + result1, _ := api.JdShopAPI.GetProvince() + for _, v := range result1 { + if strings.Contains(model.ZXCityCodeMap[store.CityCode], v.AreaName) { + result2, _ := api.JdShopAPI.GetCity(v.AreaID) + for _, vv := range result2 { + if strings.Contains(store.DistrictName, vv.AreaName) { + result3, _ := api.JdShopAPI.GetCounty(vv.AreaID) + for _, vvv := range result3 { if street == vvv.AreaName { createEntityStoreParam.AddCode = vvv.AreaID + break } } } + break } } + break } } } From ac0d73b58705c8f4d65e02749a6f676d6f253f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 10:07:26 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9B=B4=E8=BE=96=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/business/partner/purchase/jdshop/store.go b/business/partner/purchase/jdshop/store.go index d797ec2cb..1945f2062 100644 --- a/business/partner/purchase/jdshop/store.go +++ b/business/partner/purchase/jdshop/store.go @@ -113,7 +113,7 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri if street != "" { result1, _ := api.JdShopAPI.GetProvince() for _, v := range result1 { - if strings.Contains(model.ZXCityCodeMap[store.CityCode], v.AreaName) { + if strings.Contains(store.CityName, v.AreaName) { result2, _ := api.JdShopAPI.GetCity(v.AreaID) for _, vv := range result2 { if strings.Contains(store.DistrictName, vv.AreaName) { @@ -125,10 +125,8 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri } } } - break } } - break } } } From 31c68e2f7300f5d1c636e91b0fd664b46108b31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 13:41:27 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E5=95=86=E5=93=81=E5=BA=93=E4=B8=8B?= =?UTF-8?q?=E6=9E=B6=EF=BC=8C=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index f9250a351..528284468 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -122,6 +122,8 @@ type StoreSkuSyncInfo struct { ActPercentage int `json:"actPercentage"` // 直降活动百分比 ActSyncStatus int8 `orm:"default(2)" json:"actSyncStatus"` VendorActPrice int64 `json:"vendorActPrice"` // 保存数据用,实际的活动价 + + IsDeletedBySku bool `json:"isDeletedBySku"` //京东商城用,同步下架的商品库里的sku时,要做区分来决定调的api } type MissingStoreSkuInfo struct { From 13292f3ef81435cc2be92272da093f15596d26f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 13:51:07 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E5=95=86=E5=93=81=E5=88=A0=E9=99=A4=E8=A7=84?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync_store_sku.go | 12 ++++++++++-- business/partner/partner_store_sku.go | 1 + business/partner/purchase/jdshop/store_sku.go | 12 +++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 92f98289c..7f19a6c7b 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -219,9 +219,16 @@ func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo } func isStoreSkuSyncNeedDelete(storeSku *dao.StoreSkuSyncInfo) bool { - return model.IsSyncStatusDelete(storeSku.SkuSyncStatus) || + if model.IsSyncStatusDelete(storeSku.SkuSyncStatus) || storeSku.BindDeletedAt != utils.DefaultTimeValue || storeSku.BindID == 0 || - storeSku.NameID == 0 || storeSku.NameStatus != model.SkuStatusNormal || storeSku.Status != model.SkuStatusNormal + storeSku.NameID == 0 || storeSku.NameStatus != model.SkuStatusNormal { + return true + } + if storeSku.Status != model.SkuStatusNormal { + storeSku.IsDeletedBySku = true + return true + } + return false } func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSkuInfo) { @@ -238,6 +245,7 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk JxUnitPrice: inSku.UnitPrice, VendorSkuID2: utils.Int64ToStr(inSku.JdsWareID), JdsStockSwitch: inSku.JdsStockSwitch, + IsDeletedBySku: inSku.IsDeletedBySku, } if !isStoreSkuSyncNeedDelete(inSku) { outSku.Stock = model.MaxStoreSkuStockQty diff --git a/business/partner/partner_store_sku.go b/business/partner/partner_store_sku.go index 46b73bdab..004d026b2 100644 --- a/business/partner/partner_store_sku.go +++ b/business/partner/partner_store_sku.go @@ -53,6 +53,7 @@ type StoreSkuInfo struct { JxUnitPrice int64 `json:"jxUnitPrice,omitempty"` VendorSkuID2 string `json:"vendorSkuID2,omitempty"` JdsStockSwitch int `json:"jdsStockSwitch"` + IsDeletedBySku bool `json:"isDeletedBySku"` } type StoreSkuInfoWithErr struct { diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index fbfa20e7c..6ef86768a 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -200,14 +200,16 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) { if globals.EnableJdShopWrite && vendorStoreID == model.JdShopMainVendorStoreID { for _, v := range storeSkuList { - // err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) - err = api.JdShopAPI.UpOrDown(utils.Str2Int64(v.VendorSkuID2), 2) - if err == nil { - err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2)) + if v.IsDeletedBySku { + err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) + } else { + err = api.JdShopAPI.UpOrDown(utils.Str2Int64(v.VendorSkuID2), 2) + if err == nil { + err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2)) + } } if err != nil { failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "删除商品")...) - } } } From 73a7f5cfc286b91c25e76307c6410179c5d584bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 14:31:10 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=95=86=E5=93=81=EF=BC=8C=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=82=89=E7=B1=BB=E4=B8=8D=E4=BC=A0=E9=85=8D=E9=80=81=E6=97=B6?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 6ef86768a..4bda4376c 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -117,13 +117,16 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v for _, v := range storeSkuList { name := filterSensitiveWord(v.Name) updateWareParam := &jdshopapi.UpdateWareParam{ - WareID: v.JdsWareID, - Title: name, - VenderID: jdshopapi.VenderID, - PromiseID: jdshopapi.JdsPromiseID, + WareID: v.JdsWareID, + Title: name, + VenderID: jdshopapi.VenderID, + // PromiseID: jdshopapi.JdsPromiseID, ShopCategorys: []int{utils.Str2Int(v.VendorCatID)}, JdPrice: jxutils.IntPrice2Standard(v.UnitPrice), } + if v.VendorVendorCatID != jdshopapi.JdsOtherMeatCatID { + updateWareParam.PromiseID = jdshopapi.JdsPromiseID + } var desc string if v.DescImg != "" { pic3, err2 := uploadImg2(v.DescImg, name, "desc") From fc9ca4cf784c9d421b273e518ecb275b2affe357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 14:36:20 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E5=BF=BD=E7=95=A5=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E5=B7=B2=E5=88=A0=E9=99=A4=E7=9A=84=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=86=8D=E5=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 4bda4376c..921f2dc29 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -22,6 +22,10 @@ import ( "git.rosy.net.cn/jx-callback/globals" ) +const ( + deleteErr1 = "已经删除的不能直接下架" +) + var ( sensitiveWordRegexp = regexp.MustCompile(`商品名称中含有敏感词(\[.*\])`) ) @@ -380,6 +384,9 @@ func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp { } func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) { + if strings.Contains(err.Error(), deleteErr1) { + return true + } return false } From f09ac6239816a5ecef32ffc77ec2b7869837ddb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 15:08:39 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 12 +++++++----- business/partner/purchase/jdshop/store_sku.go | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 63ddab5dc..89c3637b5 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1212,11 +1212,13 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) waybill = v } } - if waybill.WaybillVendorID != model.VendorIDJDWL { - handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] - err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") - if err != nil { - return "", err + if waybill != nil { + if waybill.WaybillVendorID != model.VendorIDJDWL { + handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] + err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") + if err != nil { + return "", err + } } } } diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 921f2dc29..fac104bf7 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -24,6 +24,7 @@ import ( const ( deleteErr1 = "已经删除的不能直接下架" + deleteErr2 = "SKU不存在" ) var ( From 5fdc6f5c6cb0b0285af556c0282e75a014b97c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 15:26:30 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E5=BF=BD=E7=95=A5=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E5=B7=B2=E5=88=A0=E9=99=A4=E7=9A=84=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=86=8D=E5=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index fac104bf7..cd0295bdc 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -24,7 +24,8 @@ import ( const ( deleteErr1 = "已经删除的不能直接下架" - deleteErr2 = "SKU不存在" + deleteErr2 = "SKU" + deleteErr3 = "已删除" ) var ( @@ -385,7 +386,7 @@ func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp { } func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) { - if strings.Contains(err.Error(), deleteErr1) { + if strings.Contains(err.Error(), deleteErr1) || (strings.Contains(err.Error(), deleteErr2) && strings.Contains(err.Error(), deleteErr3)) { return true } return false From a3b193a2f4ec3d41e32824eef2738c45d7f444d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 16:27:11 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=B3=E6=8E=89?= =?UTF-8?q?=E6=99=9A=E4=B8=8A=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync_store_sku.go | 3 --- business/jxstore/misc/misc.go | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 7f19a6c7b..bae773bcb 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -922,9 +922,6 @@ func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, v }) } } - if storeID == 103075 { - fmt.Println("sku2Delete", utils.Format4Output(sku2Delete, false)) - } if opType == AmendPruneOnlyAmend || opType == AmendPruneAll { for _, v := range localSkuList { if !model.IsSyncStatusDelete(v.SkuSyncStatus) && v.BindID != 0 { diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 2f84dd366..578f6a72b 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -362,7 +362,7 @@ func syncStoreSku() { errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{1, 3})) // errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs())) - _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false) + // _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false) // _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false) errList.AddErr(err) From 81527354b0fe0e19ffc6cdaa7f95bdce0f9cfb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 16:43:09 +0800 Subject: [PATCH 12/15] =?UTF-8?q?wrnf=E6=94=B9=E6=88=90debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku_check.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store_sku_check.go b/business/jxstore/cms/store_sku_check.go index d34526a67..491ae62cf 100644 --- a/business/jxstore/cms/store_sku_check.go +++ b/business/jxstore/cms/store_sku_check.go @@ -2,13 +2,14 @@ package cms import ( "fmt" - "git.rosy.net.cn/baseapi/platformapi/dingdingapi" - "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" - "github.com/astaxie/beego" "strings" "sync" "time" + "git.rosy.net.cn/baseapi/platformapi/dingdingapi" + "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" + "github.com/astaxie/beego" + "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/baseapi" @@ -470,10 +471,10 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin diffData.AppendData(vendorID, outPutData) } } else { - globals.SugarLogger.Warnf("CompareJxAndVendor vendorSkuInfo.SkuList:%d is nil", skuID) + globals.SugarLogger.Debugf("CompareJxAndVendor vendorSkuInfo.SkuList:%d is nil", skuID) } } else { - globals.SugarLogger.Warnf("CompareJxAndVendor skuID:%d is nil", skuID) + globals.SugarLogger.Debugf("CompareJxAndVendor skuID:%d is nil", skuID) } } } @@ -553,10 +554,10 @@ func CompareJxAndMultiVenderDepot(ctx *jxcontext.Context, vendorMap map[int]bool depotDiffData.AppendData2(vendorID, outPutData) } } else { - globals.SugarLogger.Warnf("CompareJxAndMultiVenderDepot vendorSkuInfo.SkuList:%d is nil", skuID) + globals.SugarLogger.Debugf("CompareJxAndMultiVenderDepot vendorSkuInfo.SkuList:%d is nil", skuID) } } else { - globals.SugarLogger.Warnf("CompareJxAndMultiVenderDepot skuID:%d is nil", skuID) + globals.SugarLogger.Debugf("CompareJxAndMultiVenderDepot skuID:%d is nil", skuID) } } } From ba6f2d0e7f57226f9204269ac10b65ccb9eab64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 17:59:51 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/order.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index edbb5c13d..67925702c 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -128,7 +128,10 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi. if err == nil { globals.SugarLogger.Debugf("onOrderInfoChangeMsg orderID:%s", msg.BillID) orderInfoChangeSet(order, msg) - partner.CurOrderManager.ChangeOrderInfo(order) + globals.SugarLogger.Debugf("onOrderInfoChangeMsg2: %v", order) + db := dao.GetDB() + _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") + // partner.CurOrderManager.ChangeOrderInfo(order) } return retVal } From 7b8121321673c7ba0ba4ed7dad8ef79b3ab03bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 18:21:24 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E9=80=80=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/weixinmsg/weixinmsg.go | 45 +++++++++++++++++++++++++ business/partner/purchase/jd/order.go | 5 +-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index f8ecee65a..689a14774 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -61,6 +61,7 @@ const ( WX_CHANGE_REJECTED_TEMPLATE_ID = "OBF4-d5inK95epHcUltpdb1zq9boVp2HESpASVRh1Oo" WX_ORDER_APPLY_CANCEL_TEMPLATE_ID = "e6urTtcm4PL0rgDMG_1qWNOwrE3Qxqcm_dx0kWWCmEI" WX_ORDER_ORDER_CANCELED_TEMPLATE_ID = "HXjuSAbIk77Xh18hjgwoxHzbciR9jX3Rn2CpLJz9dZw" + WX_ORDER_CHANGE_INFO_TEMPLATE_ID = "cjmEQFEpvcOuBNqQpTfMU5FeBpGRbQh_gWKz-WPW8Ro" WX_AFS_ORDER_WAIT4APPROVE_TEMPLATE_ID = "X29udtANvhX6x1Lyh-T40NGNjRXBbUj5oSBTfDhZAqU" WX_AFS_ORDER_STATUS_CHANGED_TEMPLATE_ID = "99T33rrXX0VboO1hljs4x8dDoLiSj3QX_rOikPHIXkg" @@ -116,6 +117,7 @@ func GetWeixinOpenIDsFromStoreID(storeID int) (retVal []string) { retVal = nil } } + retVal = append(retVal, "oYN_usv1RPvrSxCvo1WsbwI8lZa0") return retVal } @@ -329,6 +331,49 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er return err } +func NotifyOrderChanged(order *model.GoodsOrder) (err error) { + globals.SugarLogger.Debugf("NotifyOrderCanceled orderID:%s", order.VendorOrderID) + if order.VendorID == model.VendorIDELM { + return nil + } + + if !model.IsOrderSolid(order) { + globals.SugarLogger.Infof("NotifyOrderCanceled orderID:%s is not solid", order.VendorOrderID) + return nil + } + title := fmt.Sprintf("老板,您的订单%s第%d号订单, %s被取消了!", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID) + data := map[string]interface{}{ + "first": map[string]interface{}{ + "value": title, + "color": WX_NEW_ORDER_TEMPLATE_COLOR, + }, + "orderProductPrice": map[string]interface{}{ + "value": jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), + "color": WX_NEW_ORDER_TEMPLATE_COLOR, + }, + "orderProductName": map[string]interface{}{ + "value": getOrderDetailBrief(order), + "color": WX_NEW_ORDER_TEMPLATE_COLOR, + }, + "orderAddress": map[string]interface{}{ + "value": order.ConsigneeAddress, + "color": WX_NEW_ORDER_TEMPLATE_COLOR, + }, + "orderName": map[string]interface{}{ + "value": fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID), + "color": VendorColors[order.VendorID], + }, + "remark": map[string]interface{}{ + "value": order.ConsigneeMobile, + "color": WX_NEW_ORDER_TEMPLATE_COLOR, + }, + } + storeID := jxutils.GetSaleStoreIDFromOrder(order) + err = SendMsgToStore(storeID, WX_ORDER_ORDER_CANCELED_TEMPLATE_ID, "", "", data) + netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, title) + return err +} + func NotifyOrderCanceled(order *model.GoodsOrder) (err error) { globals.SugarLogger.Debugf("NotifyOrderCanceled orderID:%s", order.VendorOrderID) if order.VendorID == model.VendorIDELM { diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index 67925702c..a11e0ef08 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -129,8 +129,9 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi. globals.SugarLogger.Debugf("onOrderInfoChangeMsg orderID:%s", msg.BillID) orderInfoChangeSet(order, msg) globals.SugarLogger.Debugf("onOrderInfoChangeMsg2: %v", order) - db := dao.GetDB() - _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") + // db := dao.GetDB() + // _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") + // weixinmsg.NotifyOrderChanged(order) // partner.CurOrderManager.ChangeOrderInfo(order) } return retVal From e3b33f0c3dac1d45f2cf8877002978c7f2d4d672 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, 1 Jul 2020 08:50:36 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/weixinmsg/weixinmsg.go | 29 ++++++++++--------------- business/partner/purchase/jd/order.go | 16 ++++++++------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index 689a14774..b2c26d880 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -332,44 +332,39 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er } func NotifyOrderChanged(order *model.GoodsOrder) (err error) { - globals.SugarLogger.Debugf("NotifyOrderCanceled orderID:%s", order.VendorOrderID) + globals.SugarLogger.Debugf("NotifyOrderChanged orderID:%s", order.VendorOrderID) if order.VendorID == model.VendorIDELM { return nil } - - if !model.IsOrderSolid(order) { - globals.SugarLogger.Infof("NotifyOrderCanceled orderID:%s is not solid", order.VendorOrderID) - return nil - } - title := fmt.Sprintf("老板,您的订单%s第%d号订单, %s被取消了!", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID) + title := fmt.Sprintf("您有订单的信息已被修改") data := map[string]interface{}{ "first": map[string]interface{}{ "value": title, "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderProductPrice": map[string]interface{}{ - "value": jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), + "keyword1": map[string]interface{}{ + "value": order.VendorOrderID, "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderProductName": map[string]interface{}{ - "value": getOrderDetailBrief(order), + "keyword2": map[string]interface{}{ + "value": "用户修改订单", "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderAddress": map[string]interface{}{ - "value": order.ConsigneeAddress, + "keyword3": map[string]interface{}{ + "value": order.ConsigneeAddress + "," + order.ConsigneeName + "," + order.ConsigneeMobile, "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderName": map[string]interface{}{ - "value": fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID), + "keyword4": map[string]interface{}{ + "value": utils.Time2Str(order.OrderCreatedAt), "color": VendorColors[order.VendorID], }, "remark": map[string]interface{}{ - "value": order.ConsigneeMobile, + "value": "请及时处理", "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, } storeID := jxutils.GetSaleStoreIDFromOrder(order) - err = SendMsgToStore(storeID, WX_ORDER_ORDER_CANCELED_TEMPLATE_ID, "", "", data) + err = SendMsgToStore(storeID, WX_ORDER_CHANGE_INFO_TEMPLATE_ID, "", "", data) netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, title) return err } diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index a11e0ef08..8c55f37cf 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg" + "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" @@ -129,9 +131,9 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi. globals.SugarLogger.Debugf("onOrderInfoChangeMsg orderID:%s", msg.BillID) orderInfoChangeSet(order, msg) globals.SugarLogger.Debugf("onOrderInfoChangeMsg2: %v", order) - // db := dao.GetDB() - // _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") - // weixinmsg.NotifyOrderChanged(order) + db := dao.GetDB() + _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") + weixinmsg.NotifyOrderChanged(order) // partner.CurOrderManager.ChangeOrderInfo(order) } return retVal @@ -588,11 +590,11 @@ func orderInfoChangeSet(order *model.GoodsOrder, msg *jdapi.CallbackOrderInfoCha if msg.BuyerMobile != "" { order.ConsigneeMobile = msg.BuyerMobile } - if msg.BuyerLat != 0 { - order.ConsigneeLat = jxutils.StandardCoordinate2Int(msg.BuyerLat) + if msg.BuyerLat != "" { + order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat)) } - if msg.BuyerLng != 0 { - order.ConsigneeLng = jxutils.StandardCoordinate2Int(msg.BuyerLng) + if msg.BuyerLng != "" { + order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng)) } if msg.OrderBuyerRemark != "" { order.BuyerComment = msg.OrderBuyerRemark