From 039f1b5bab799b4bba2a97ff87cfae9cc88fe913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 19 Jul 2023 15:08:05 +0800 Subject: [PATCH 01/34] 1 --- business/partner/purchase/tao_vegetable/order.go | 12 ------------ .../partner/purchase/tao_vegetable/store_sku2.go | 16 +++++++--------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index 760c35459..e6453aff7 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -189,17 +189,6 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve } // 抖音订单手机号和收货地址是否同城(虚拟号,无法获取到正确地址) order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + "归属信息不匹配:" + "虚拟电话号码" - //ascription, err := ascription_place.Find(order.ConsigneeMobile) - //if err != nil { - // order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + err.Error() - // err = nil - //} else { - // if strings.Contains(order.ConsigneeAddress, ascription.Province) && strings.Contains(order.ConsigneeAddress, ascription.City) { - // order.PhoneAscription = model.PhoneAscriptionAddressYes + "-" + ascription.Province + ascription.City - // } else { - // order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + "归属信息不匹配:" + ascription.Province + ascription.City - // } - //} // 本地获取订单记录 orderSeq, _ := dao.GetVendorOrderNumber(dao.GetDB(), model.VendorIDTaoVegetable, order.VendorStoreID) @@ -215,7 +204,6 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve order.StoreName = "未获取到" // 真实门店名称 } - globals.SugarLogger.Debugf("=====order : %s", utils.Format4Output(order, false)) return order, orderMap, err } diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index b7c03e0f4..9e4e2206b 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -41,19 +41,19 @@ var ( func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) { switch funcID { case partner.FuncUpdateStoreSkusStock, partner.FuncUpdateStoreSkusStatus, partner.FuncUpdateStoreSkusPrice: - batchSize = 5 + batchSize = 10 case partner.FuncDeleteStoreSkus: - batchSize = 5 + batchSize = 10 case partner.FuncCreateStoreSkus: - batchSize = 5 // 可考虑用批量操作 + batchSize = 10 // 可考虑用批量操作 case partner.FuncUpdateStoreSkus: - batchSize = 5 // mtwmapi.MaxStoreSkuBatchSize + batchSize = 10 // mtwmapi.MaxStoreSkuBatchSize case partner.FuncGetStoreSkusFullInfo: - batchSize = 5 + batchSize = 10 case partner.FuncCreateActs: - batchSize = 5 + batchSize = 10 case partner.FuncCancelActs: - batchSize = 5 + batchSize = 10 } return batchSize } @@ -411,8 +411,6 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku } failedListStock := updateStoreSkusStockByCreate(ctx, api, storeID, vendorStoreID, successSku) failedList = append(failedList, failedListStock...) - globals.SugarLogger.Debugf("failedList := %s", utils.Format4Output(failedList, false)) - globals.SugarLogger.Debugf("storeSkuList := %s", utils.Format4Output(storeSkuList, false)) return failedList, nil } From 76d1ce7aeae73d91dab98cae4e852d41d3ca7286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 19 Jul 2023 18:11:31 +0800 Subject: [PATCH 02/34] 1 --- business/jxstore/cms/sync.go | 2 + business/jxstore/misc/misc.go | 177 +++++++++++++++++- .../purchase/tao_vegetable/store_sku2.go | 20 +- 3 files changed, 177 insertions(+), 22 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 5ca595ff7..7dab53ad6 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -502,6 +502,8 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. if setSyncStatus != 0 { dao.SetStoreSkuSyncStatus(db, storeMap.VendorID, []int{storeMap.StoreID}, skuIDs, setSyncStatus) } + globals.SugarLogger.Debugf("定时任务同步:user[%s],storeId[%d]", ctx.GetUserName(), storeMap.StoreID) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘宝同步商品", utils.Format4Output(storeMap.StoreID, false)) if _, err = SyncStoreSkuNew(ctx, task, causeFlag, storeMap.VendorID, storeMap.StoreID, storeMap.VendorStoreID, storeMap.VendorOrgCode, nil, skuIDs, excludeSkuIDs, false, isContinueWhenError); err != nil { globals.SugarLogger.Debugf("SyncStoresSkus2 failed2 store:%d failed with error:%v", storeMap.StoreID, err) } diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index ab787c37c..a5849d897 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -279,11 +279,24 @@ func Init() { // syncStoreSkuTiktok() // }, []string{"13:00:00"}) //} - // 抖音更新门店商品 ,接口收费暂不使用 + // 淘鲜达更新门店商品 ,接口收费暂不使用 if beego.BConfig.RunMode != "jxgy" { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { syncStoreSkuTao() - }, []string{"13:00:00"}) + }, []string{ + //"13:00:00", + //"15:00:00", + //"17:00:00", + "18:35:00", + //"20:40:00", + //"21:40:00", + //"23:40:00", + //"01:40:00", + "03:40:00", + //"05:40:00", + //"07:40:00", + "08:40:00", + }) } // 刷新抖音门店token @@ -640,6 +653,163 @@ func syncStoreSkuTiktok() { tasksch.HandleTask(task, nil, true).Run() } +var beijin = []int{ + 669158, + 668691, + 668673, + 668282, + 667447, + 667354, + 667321, + 667319, + 667316, + 667269, + 667268, + 667267, + 667260, + 667132, + 667094, + 667030, + 666965, + 666714, + 666708, + 666705, + 103437, + 103349, + 103123, + 103121, + 103106, + 103038, + 103028, + 103019, + 102831, + 102751, + 102683, + 102542, + 102514, + 102382, + 102182, + 102178, + 102173, + 102098, + 102094, + 102080, + 102072, + 102069, + 101870, + 101869, + 101868, + 101867, + 101866, + 101865, + 100956, + 100930, + 100871, + 100786, + 100746, + 100744, + 100726, + 100705, + 100400, + 100111, + 100108, + 100106, + 100104, + 100103, + 100102, + 100100, + 100097, + 100096, + 100095, + 100093, + 100092, + 100089, + 100087, + 100086, + 100085, + 100082, + 100079, + 100078, + 669053, // 上海 + 668985, + 668960, + 668959, + 668953, + 668949, + 668932, + 668931, + 668917, + 668909, + 668908, + 668906, + 668905, + 668901, + 668894, + 668886, + 668884, + 668880, + 668878, + 668757, + 668751, + 668701, + 668622, + 668618, + 668592, + 668583, + 668569, + 668567, + 668506, + 668498, + 668476, + 668462, + 668276, + 668180, + 667320, + 667237, + 667231, + 667068, + 667036, + 666678, + 103191, + 103074, + 103065, + 103051, + 103050, + 103037, + 103029, + 103018, + 103002, + 102999, + 102969, + 102966, + 102951, + 102946, + 102939, + 102938, + 102934, + 102933, + 102930, + 102924, + 102920, + 102908, + 102903, + 102561, + 102293, + 100946, + 100945, + 100943, + 100935, + 100905, + 100720, + 100325, + 100324, + 100309, + 100299, + 100296, + 100292, + 100290, +} + // syncStoreSkuTao 同步商品到淘鲜达 func syncStoreSkuTao() { syncFlag := 0 @@ -651,14 +821,13 @@ func syncStoreSkuTao() { switch step { case 0: if beego.BConfig.RunMode != "jxgy" { - _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, nil, false, nil, nil, syncFlag, true, true) + _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin, false, nil, nil, syncFlag, true, true) errList.AddErr(err) } case 1: errList.AddErr(err) SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID) } - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘宝同步商品", utils.Format4Output(errList, false)) err = errList.GetErrListAsOne() return retVal, err }, []int{0, 1}) diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index 9e4e2206b..aa1544ee9 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -308,10 +308,10 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku SaleUnit: utils.String2Pointer("份"), LifeStatus: utils.String2Pointer(tao_vegetable.CreateSkuLeafStatus), SaleSpec: utils.String2Pointer(fmt.Sprintf("%d %s*1%s", storeSku.Weight, "g", storeSku.Unit)), - StepQuantity: utils.Int64ToPointer(model.YES), // 每次购买至少增加一个购买单位 + StepQuantity: utils.Int64ToPointer(model.YES), // 每次购买至少增加一个购买单位 + OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOnlineSaleFlag), // 门店控制是否可见 SubTitle: utils.String2Pointer("同城包邮"), SubTitle1: utils.String2Pointer("一小时速达"), - OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOnlineSaleFlag), // 门店控制是否可见 //DeliveryUnit: utils.String2Pointer(storeSku.Unit), DeliveryUnit: utils.String2Pointer("份"), DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)), @@ -370,22 +370,6 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku }, } param = append(param, sku) - //if (index+model.YES)%tao_vegetable.MAXHandleCount == model.NO || index+model.YES == totalCount { - // createPram.ParamList = ¶m - // result, err := api.AddStoreSku(createPram) - // if err != nil { - // globals.SugarLogger.Debugf("创建淘鲜达商品异常:%s", err.Error()) - // } - // // 记录失败的同步数据 - // failedList2, vendorSkuIdMap2 := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], syncType) - // failedList = append(failedList, failedList2...) - // for k, v := range vendorSkuIdMap2 { - // vendorSkuIdMap[k] = v - // } - // - // createPram.ParamList = nil - // param = make([]domain585.AlibabaWdkSkuAddSkuDo, 0, 0) - //} } createPram.ParamList = ¶m result, err := api.AddStoreSku(createPram) From 591f80875f2b2716fbd5590e46552a72eb72174e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 09:02:19 +0800 Subject: [PATCH 03/34] 1 --- business/jxstore/cms/store_sku.go | 3 - business/jxstore/misc/misc.go | 312 +++++++++++++++-------------- business/partner/delivery/rider.go | 2 +- 3 files changed, 158 insertions(+), 159 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index f42d24354..3e89a0991 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1173,8 +1173,6 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []str sql += " , t4.unit_price DESC LIMIT 99" } var tmpList []*tGetStoresSkusInfo - globals.SugarLogger.Debugf("GetStoresSkusNew sql=%s,sqlParams=%s", sql, sqlParams) - if err = dao.GetRowsTx(txDB, &tmpList, sql, sqlParams...); err != nil { dao.Rollback(db, txDB) return nil, err @@ -1184,7 +1182,6 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []str } dao.Commit(db, txDB) storeNameMap := make(map[int64]*dao.StoreSkuNameExt) - globals.SugarLogger.Debugf("GetStoresSkusNew tmpList=%s", utils.Format4Output(tmpList, false)) for _, v := range tmpList { var storeName *dao.StoreSkuNameExt index := jxutils.Combine2Int(v.StoreID, v.ID) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index a5849d897..4d605532a 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -284,18 +284,20 @@ func Init() { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { syncStoreSkuTao() }, []string{ - //"13:00:00", - //"15:00:00", - //"17:00:00", + "13:00:00", + "15:00:00", + "17:00:00", "18:35:00", - //"20:40:00", - //"21:40:00", - //"23:40:00", - //"01:40:00", + "20:40:00", + "22:40:00", + "23:40:00", + "01:40:00", "03:40:00", - //"05:40:00", - //"07:40:00", + "05:40:00", + "07:40:00", "08:40:00", + "10:40:00", + "12:40:00", }) } @@ -662,152 +664,152 @@ var beijin = []int{ 667354, 667321, 667319, - 667316, - 667269, - 667268, - 667267, - 667260, - 667132, - 667094, - 667030, - 666965, - 666714, - 666708, - 666705, - 103437, - 103349, - 103123, - 103121, - 103106, - 103038, - 103028, - 103019, - 102831, - 102751, - 102683, - 102542, - 102514, - 102382, - 102182, - 102178, - 102173, - 102098, - 102094, - 102080, - 102072, - 102069, - 101870, - 101869, - 101868, - 101867, - 101866, - 101865, - 100956, - 100930, - 100871, - 100786, - 100746, - 100744, - 100726, - 100705, - 100400, - 100111, - 100108, - 100106, - 100104, - 100103, - 100102, - 100100, - 100097, - 100096, - 100095, - 100093, - 100092, - 100089, - 100087, - 100086, - 100085, - 100082, - 100079, - 100078, - 669053, // 上海 - 668985, - 668960, - 668959, - 668953, - 668949, - 668932, - 668931, - 668917, - 668909, - 668908, - 668906, - 668905, - 668901, - 668894, - 668886, - 668884, - 668880, - 668878, - 668757, - 668751, - 668701, - 668622, - 668618, - 668592, - 668583, - 668569, - 668567, - 668506, - 668498, - 668476, - 668462, - 668276, - 668180, - 667320, - 667237, - 667231, - 667068, - 667036, - 666678, - 103191, - 103074, - 103065, - 103051, - 103050, - 103037, - 103029, - 103018, - 103002, - 102999, - 102969, - 102966, - 102951, - 102946, - 102939, - 102938, - 102934, - 102933, - 102930, - 102924, - 102920, - 102908, - 102903, - 102561, - 102293, - 100946, - 100945, - 100943, - 100935, - 100905, - 100720, - 100325, - 100324, - 100309, - 100299, - 100296, - 100292, - 100290, + //667316, + //667269, + //667268, + //667267, + //667260, + //667132, + //667094, + //667030, + //666965, + //666714, + //666708, + //666705, + //103437, + //103349, + //103123, + //103121, + //103106, + //103038, + //103028, + //103019, + //102831, + //102751, + //102683, + //102542, + //102514, + //102382, + //102182, + //102178, + //102173, + //102098, + //102094, + //102080, + //102072, + //102069, + //101870, + //101869, + //101868, + //101867, + //101866, + //101865, + //100956, + //100930, + //100871, + //100786, + //100746, + //100744, + //100726, + //100705, + //100400, + //100111, + //100108, + //100106, + //100104, + //100103, + //100102, + //100100, + //100097, + //100096, + //100095, + //100093, + //100092, + //100089, + //100087, + //100086, + //100085, + //100082, + //100079, + //100078, + //669053, // 上海 + //668985, + //668960, + //668959, + //668953, + //668949, + //668932, + //668931, + //668917, + //668909, + //668908, + //668906, + //668905, + //668901, + //668894, + //668886, + //668884, + //668880, + //668878, + //668757, + //668751, + //668701, + //668622, + //668618, + //668592, + //668583, + //668569, + //668567, + //668506, + //668498, + //668476, + //668462, + //668276, + //668180, + //667320, + //667237, + //667231, + //667068, + //667036, + //666678, + //103191, + //103074, + //103065, + //103051, + //103050, + //103037, + //103029, + //103018, + //103002, + //102999, + //102969, + //102966, + //102951, + //102946, + //102939, + //102938, + //102934, + //102933, + //102930, + //102924, + //102920, + //102908, + //102903, + //102561, + //102293, + //100946, + //100945, + //100943, + //100935, + //100905, + //100720, + //100325, + //100324, + //100309, + //100299, + //100296, + //100292, + //100290, } // syncStoreSkuTao 同步商品到淘鲜达 diff --git a/business/partner/delivery/rider.go b/business/partner/delivery/rider.go index fa963d83e..45fe08caa 100644 --- a/business/partner/delivery/rider.go +++ b/business/partner/delivery/rider.go @@ -103,7 +103,7 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) { if orderId == "" { // 订单id为空是,是定时轮询操作,不做此状态 waybillList, _ := dao.GetWaybills(dao.GetDB(), v.VendorOrderID, nil) if len(waybillList) > 0 && waybillList[0].Status > model.WaybillStatusEndBegin { - globals.SugarLogger.Debugf("订单物流状态结束,不在推送订单状态:orderID[%s],wayBillId[%s]", v.VendorOrderID, waybillList[0].VendorWaybillID) + globals.SugarLogger.Debug("订单物流状态结束,不在推送订单状态:orderID[%s],wayBillId[%s]", v.VendorOrderID, waybillList[0].VendorWaybillID) continue } } From 0cd71da1b242538daf9498fc6ad3a8e8bd341c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 09:03:08 +0800 Subject: [PATCH 04/34] 1 --- business/jxstore/misc/misc.go | 79 +---------------------------------- 1 file changed, 1 insertion(+), 78 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 4d605532a..4c6a3529e 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -732,84 +732,7 @@ var beijin = []int{ //100082, //100079, //100078, - //669053, // 上海 - //668985, - //668960, - //668959, - //668953, - //668949, - //668932, - //668931, - //668917, - //668909, - //668908, - //668906, - //668905, - //668901, - //668894, - //668886, - //668884, - //668880, - //668878, - //668757, - //668751, - //668701, - //668622, - //668618, - //668592, - //668583, - //668569, - //668567, - //668506, - //668498, - //668476, - //668462, - //668276, - //668180, - //667320, - //667237, - //667231, - //667068, - //667036, - //666678, - //103191, - //103074, - //103065, - //103051, - //103050, - //103037, - //103029, - //103018, - //103002, - //102999, - //102969, - //102966, - //102951, - //102946, - //102939, - //102938, - //102934, - //102933, - //102930, - //102924, - //102920, - //102908, - //102903, - //102561, - //102293, - //100946, - //100945, - //100943, - //100935, - //100905, - //100720, - //100325, - //100324, - //100309, - //100299, - //100296, - //100292, - //100290, + } // syncStoreSkuTao 同步商品到淘鲜达 From b54ce243655497fa03706c34616b3812ca5f94eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 09:26:04 +0800 Subject: [PATCH 05/34] 1 --- business/jxstore/misc/misc.go | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 4c6a3529e..ff6d83d4f 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -280,26 +280,26 @@ func Init() { // }, []string{"13:00:00"}) //} // 淘鲜达更新门店商品 ,接口收费暂不使用 - if beego.BConfig.RunMode != "jxgy" { - ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { - syncStoreSkuTao() - }, []string{ - "13:00:00", - "15:00:00", - "17:00:00", - "18:35:00", - "20:40:00", - "22:40:00", - "23:40:00", - "01:40:00", - "03:40:00", - "05:40:00", - "07:40:00", - "08:40:00", - "10:40:00", - "12:40:00", - }) - } + //if beego.BConfig.RunMode != "jxgy" { + // ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { + // syncStoreSkuTao() + // }, []string{ + // "13:00:00", + // "15:00:00", + // "17:00:00", + // "18:35:00", + // "20:40:00", + // "22:40:00", + // "23:40:00", + // "01:40:00", + // "03:40:00", + // "05:40:00", + // "07:40:00", + // "08:40:00", + // "10:40:00", + // "12:40:00", + // }) + //} // 刷新抖音门店token if beego.BConfig.RunMode != "jxgy" { From 4b09a3378324159bdde45b8754f47e7dc03a2b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 11:32:23 +0800 Subject: [PATCH 06/34] 1 --- business/jxcallback/orderman/order.go | 6 +++--- business/jxstore/cms/sync.go | 6 ++++-- business/partner/purchase/tao_vegetable/store_sku2.go | 10 +++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 8299d38c9..e9c290fbb 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -476,7 +476,7 @@ func FinisOrderWaybillFee(db *dao.DaoDB, order *model.GoodsOrder, bill *model.Wa return nil } // 查询所有运单 - bills, err := dao.GetWaybills(db, order.VendorOrderID, nil) + bills, err := dao.GetWaybills(db, order.VendorOrderID, []int64{model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS}) if err != nil { return err } @@ -531,8 +531,8 @@ func ResetCreateWaybillFee(db *dao.DaoDB, order *model.GoodsOrder, bill *model.W if err := countWaybillSettleInfo(db, order, bill, store); err != nil { return err } - // 所有运单停止调度之后才开始退还余额 - bills, err := dao.GetWaybills(db, order.VendorOrderID, nil) + // 所有运单停止调度之后才开始退还余额(三方运单) + bills, err := dao.GetWaybills(db, order.VendorOrderID, []int64{model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS}) if err != nil { return err } diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 7dab53ad6..8418b7b34 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -502,8 +502,10 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. if setSyncStatus != 0 { dao.SetStoreSkuSyncStatus(db, storeMap.VendorID, []int{storeMap.StoreID}, skuIDs, setSyncStatus) } - globals.SugarLogger.Debugf("定时任务同步:user[%s],storeId[%d]", ctx.GetUserName(), storeMap.StoreID) - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘宝同步商品", utils.Format4Output(storeMap.StoreID, false)) + if storeMap.VendorID == model.VendorIDTaoVegetable { + globals.SugarLogger.Debugf("定时任务同步:user[%s],storeId[%d]", ctx.GetUserName(), storeMap.StoreID) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘宝同步商品", utils.Format4Output(storeMap.StoreID, false)) + } if _, err = SyncStoreSkuNew(ctx, task, causeFlag, storeMap.VendorID, storeMap.StoreID, storeMap.VendorStoreID, storeMap.VendorOrgCode, nil, skuIDs, excludeSkuIDs, false, isContinueWhenError); err != nil { globals.SugarLogger.Debugf("SyncStoresSkus2 failed2 store:%d failed with error:%v", storeMap.StoreID, err) } diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index aa1544ee9..f1b43934b 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -248,6 +248,7 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice CategoryCode: utils.String2Pointer(utils.Int2Str(v.CategoryID)), MerchantCatCode: utils.String2Pointer(v.VendorCatID), // 优先使用 靠后 category_code + SubTitle: utils.String2Pointer("一小时速达"), } if v.MinOrderCount <= model.YES { updateSku.PurchaseQuantity = utils.Int64ToPointer(model.YES) // 起购单位 @@ -310,7 +311,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku SaleSpec: utils.String2Pointer(fmt.Sprintf("%d %s*1%s", storeSku.Weight, "g", storeSku.Unit)), StepQuantity: utils.Int64ToPointer(model.YES), // 每次购买至少增加一个购买单位 OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOnlineSaleFlag), // 门店控制是否可见 - SubTitle: utils.String2Pointer("同城包邮"), + SubTitle: utils.String2Pointer("一小时速达"), SubTitle1: utils.String2Pointer("一小时速达"), //DeliveryUnit: utils.String2Pointer(storeSku.Unit), DeliveryUnit: utils.String2Pointer("份"), @@ -551,6 +552,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr OuCode: utils.String2Pointer(vendorStoreID), SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), OnlineSaleFlag: utils.Int64ToPointer(onlineStatus), + SubTitle: utils.String2Pointer("一小时速达"), } updateSkuList = append(updateSkuList, updateSku) @@ -592,6 +594,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg CleanSkuMemberPrice: utils.Int64ToPointer(model.YES), SuggestedPrice: price, MemberPrice: price, + SubTitle: utils.String2Pointer("一小时速达"), } updateSkuList = append(updateSkuList, updateSku) @@ -898,8 +901,9 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO api := getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID) for _, v := range storeSkuList { updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{ - OuCode: utils.String2Pointer(vendorStoreID), - SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), + OuCode: utils.String2Pointer(vendorStoreID), + SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), + SubTitle: utils.String2Pointer("一小时速达"), } if v.IsSpecialty <= model.YES { updateSku.PurchaseQuantity = utils.Int64ToPointer(model.YES) From e8fab7cf48ae589d8b25fcc81d3246830dbbbb69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 11:52:02 +0800 Subject: [PATCH 07/34] 1 --- business/partner/purchase/tao_vegetable/store_sku2.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index f1b43934b..d181fc844 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -248,7 +248,7 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice CategoryCode: utils.String2Pointer(utils.Int2Str(v.CategoryID)), MerchantCatCode: utils.String2Pointer(v.VendorCatID), // 优先使用 靠后 category_code - SubTitle: utils.String2Pointer("一小时速达"), + SubTitle: utils.String2Pointer("小时达"), } if v.MinOrderCount <= model.YES { updateSku.PurchaseQuantity = utils.Int64ToPointer(model.YES) // 起购单位 @@ -311,7 +311,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku SaleSpec: utils.String2Pointer(fmt.Sprintf("%d %s*1%s", storeSku.Weight, "g", storeSku.Unit)), StepQuantity: utils.Int64ToPointer(model.YES), // 每次购买至少增加一个购买单位 OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOnlineSaleFlag), // 门店控制是否可见 - SubTitle: utils.String2Pointer("一小时速达"), + SubTitle: utils.String2Pointer("小时达"), SubTitle1: utils.String2Pointer("一小时速达"), //DeliveryUnit: utils.String2Pointer(storeSku.Unit), DeliveryUnit: utils.String2Pointer("份"), @@ -552,7 +552,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr OuCode: utils.String2Pointer(vendorStoreID), SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), OnlineSaleFlag: utils.Int64ToPointer(onlineStatus), - SubTitle: utils.String2Pointer("一小时速达"), + SubTitle: utils.String2Pointer("小时达"), } updateSkuList = append(updateSkuList, updateSku) @@ -594,7 +594,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg CleanSkuMemberPrice: utils.Int64ToPointer(model.YES), SuggestedPrice: price, MemberPrice: price, - SubTitle: utils.String2Pointer("一小时速达"), + SubTitle: utils.String2Pointer("小时达"), } updateSkuList = append(updateSkuList, updateSku) @@ -903,7 +903,7 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{ OuCode: utils.String2Pointer(vendorStoreID), SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), - SubTitle: utils.String2Pointer("一小时速达"), + SubTitle: utils.String2Pointer("小时达"), } if v.IsSpecialty <= model.YES { updateSku.PurchaseQuantity = utils.Int64ToPointer(model.YES) From 17558aa9131ce96390c97ac04fb3c8076e6f87ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 13:42:30 +0800 Subject: [PATCH 08/34] 1 --- business/jxstore/misc/misc.go | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index ff6d83d4f..4c6a3529e 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -280,26 +280,26 @@ func Init() { // }, []string{"13:00:00"}) //} // 淘鲜达更新门店商品 ,接口收费暂不使用 - //if beego.BConfig.RunMode != "jxgy" { - // ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { - // syncStoreSkuTao() - // }, []string{ - // "13:00:00", - // "15:00:00", - // "17:00:00", - // "18:35:00", - // "20:40:00", - // "22:40:00", - // "23:40:00", - // "01:40:00", - // "03:40:00", - // "05:40:00", - // "07:40:00", - // "08:40:00", - // "10:40:00", - // "12:40:00", - // }) - //} + if beego.BConfig.RunMode != "jxgy" { + ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { + syncStoreSkuTao() + }, []string{ + "13:00:00", + "15:00:00", + "17:00:00", + "18:35:00", + "20:40:00", + "22:40:00", + "23:40:00", + "01:40:00", + "03:40:00", + "05:40:00", + "07:40:00", + "08:40:00", + "10:40:00", + "12:40:00", + }) + } // 刷新抖音门店token if beego.BConfig.RunMode != "jxgy" { From 709cfb96be65dcd63c87bb1db9f399fde124df07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 17:12:57 +0800 Subject: [PATCH 09/34] 1 --- business/jxstore/cms/sync.go | 4 - business/jxstore/misc/misc.go | 168 +++++++++++++++++----------------- 2 files changed, 84 insertions(+), 88 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 8418b7b34..5ca595ff7 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -502,10 +502,6 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. if setSyncStatus != 0 { dao.SetStoreSkuSyncStatus(db, storeMap.VendorID, []int{storeMap.StoreID}, skuIDs, setSyncStatus) } - if storeMap.VendorID == model.VendorIDTaoVegetable { - globals.SugarLogger.Debugf("定时任务同步:user[%s],storeId[%d]", ctx.GetUserName(), storeMap.StoreID) - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘宝同步商品", utils.Format4Output(storeMap.StoreID, false)) - } if _, err = SyncStoreSkuNew(ctx, task, causeFlag, storeMap.VendorID, storeMap.StoreID, storeMap.VendorStoreID, storeMap.VendorOrgCode, nil, skuIDs, excludeSkuIDs, false, isContinueWhenError); err != nil { globals.SugarLogger.Debugf("SyncStoresSkus2 failed2 store:%d failed with error:%v", storeMap.StoreID, err) } diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 4c6a3529e..f099e2bde 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -282,18 +282,97 @@ func Init() { // 淘鲜达更新门店商品 ,接口收费暂不使用 if beego.BConfig.RunMode != "jxgy" { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { - syncStoreSkuTao() + var beijin = []int{ + 669158, + 668691, + 668673, + 668282, + 667447, + 667354, + 667321, + 667319, + //667316, + //667269, + //667268, + //667267, + //667260, + //667132, + //667094, + //667030, + //666965, + //666714, + //666708, + //666705, + //103437, + //103349, + //103123, + //103121, + //103106, + //103038, + //103028, + //103019, + //102831, + //102751, + //102683, + //102542, + //102514, + //102382, + //102182, + //102178, + //102173, + //102098, + //102094, + //102080, + //102072, + //102069, + //101870, + //101869, + //101868, + //101867, + //101866, + //101865, + //100956, + //100930, + //100871, + //100786, + //100746, + //100744, + //100726, + //100705, + //100400, + //100111, + //100108, + //100106, + //100104, + //100103, + //100102, + //100100, + //100097, + //100096, + //100095, + //100093, + //100092, + //100089, + //100087, + //100086, + //100085, + //100082, + //100079, + //100078, + + } + syncStoreSkuTao(beijin) }, []string{ "13:00:00", "15:00:00", - "17:00:00", + "17:20:00", "18:35:00", "20:40:00", "22:40:00", "23:40:00", "01:40:00", "03:40:00", - "05:40:00", + "05:20:00", "07:40:00", "08:40:00", "10:40:00", @@ -655,88 +734,8 @@ func syncStoreSkuTiktok() { tasksch.HandleTask(task, nil, true).Run() } -var beijin = []int{ - 669158, - 668691, - 668673, - 668282, - 667447, - 667354, - 667321, - 667319, - //667316, - //667269, - //667268, - //667267, - //667260, - //667132, - //667094, - //667030, - //666965, - //666714, - //666708, - //666705, - //103437, - //103349, - //103123, - //103121, - //103106, - //103038, - //103028, - //103019, - //102831, - //102751, - //102683, - //102542, - //102514, - //102382, - //102182, - //102178, - //102173, - //102098, - //102094, - //102080, - //102072, - //102069, - //101870, - //101869, - //101868, - //101867, - //101866, - //101865, - //100956, - //100930, - //100871, - //100786, - //100746, - //100744, - //100726, - //100705, - //100400, - //100111, - //100108, - //100106, - //100104, - //100103, - //100102, - //100100, - //100097, - //100096, - //100095, - //100093, - //100092, - //100089, - //100087, - //100086, - //100085, - //100082, - //100079, - //100078, - -} - // syncStoreSkuTao 同步商品到淘鲜达 -func syncStoreSkuTao() { +func syncStoreSkuTao(beijin []int) { syncFlag := 0 task := tasksch.NewParallelTask("同步京西商品到淘鲜达平台,方案二使用", nil, jxcontext.AdminCtx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { @@ -746,6 +745,7 @@ func syncStoreSkuTao() { switch step { case 0: if beego.BConfig.RunMode != "jxgy" { + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达自动同步商品数据", utils.Format4Output(beijin, false)) _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin, false, nil, nil, syncFlag, true, true) errList.AddErr(err) } From 9efb25a36de8f0afe1f7d898b6c86d15a20d36e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 18:03:33 +0800 Subject: [PATCH 10/34] 1 --- business/jxstore/misc/misc.go | 195 +++++++++++++++++----------------- 1 file changed, 97 insertions(+), 98 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index f099e2bde..64b04d9ad 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -280,105 +280,103 @@ func Init() { // }, []string{"13:00:00"}) //} // 淘鲜达更新门店商品 ,接口收费暂不使用 - if beego.BConfig.RunMode != "jxgy" { - ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { - var beijin = []int{ - 669158, - 668691, - 668673, - 668282, - 667447, - 667354, - 667321, - 667319, - //667316, - //667269, - //667268, - //667267, - //667260, - //667132, - //667094, - //667030, - //666965, - //666714, - //666708, - //666705, - //103437, - //103349, - //103123, - //103121, - //103106, - //103038, - //103028, - //103019, - //102831, - //102751, - //102683, - //102542, - //102514, - //102382, - //102182, - //102178, - //102173, - //102098, - //102094, - //102080, - //102072, - //102069, - //101870, - //101869, - //101868, - //101867, - //101866, - //101865, - //100956, - //100930, - //100871, - //100786, - //100746, - //100744, - //100726, - //100705, - //100400, - //100111, - //100108, - //100106, - //100104, - //100103, - //100102, - //100100, - //100097, - //100096, - //100095, - //100093, - //100092, - //100089, - //100087, - //100086, - //100085, - //100082, - //100079, - //100078, + ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { + var beijin = []int{ + 669158, + 668691, + 668673, + 668282, + 667447, + 667354, + 667321, + 667319, + //667316, + //667269, + //667268, + //667267, + //667260, + //667132, + //667094, + //667030, + //666965, + //666714, + //666708, + //666705, + //103437, + //103349, + //103123, + //103121, + //103106, + //103038, + //103028, + //103019, + //102831, + //102751, + //102683, + //102542, + //102514, + //102382, + //102182, + //102178, + //102173, + //102098, + //102094, + //102080, + //102072, + //102069, + //101870, + //101869, + //101868, + //101867, + //101866, + //101865, + //100956, + //100930, + //100871, + //100786, + //100746, + //100744, + //100726, + //100705, + //100400, + //100111, + //100108, + //100106, + //100104, + //100103, + //100102, + //100100, + //100097, + //100096, + //100095, + //100093, + //100092, + //100089, + //100087, + //100086, + //100085, + //100082, + //100079, + //100078, - } - syncStoreSkuTao(beijin) - }, []string{ - "13:00:00", - "15:00:00", - "17:20:00", - "18:35:00", - "20:40:00", - "22:40:00", - "23:40:00", - "01:40:00", - "03:40:00", - "05:20:00", - "07:40:00", - "08:40:00", - "10:40:00", - "12:40:00", - }) - } + } + syncStoreSkuTao(beijin) + }, []string{ + "01:40:00", + "03:40:00", + "05:20:00", + "07:40:00", + "08:40:00", + "10:40:00", + "12:40:00", + "13:00:00", + "15:00:00", + "17:20:00", + "18:35:00", + "20:40:00", + "22:40:00", + "23:40:00", + }) // 刷新抖音门店token if beego.BConfig.RunMode != "jxgy" { @@ -746,6 +744,7 @@ func syncStoreSkuTao(beijin []int) { case 0: if beego.BConfig.RunMode != "jxgy" { ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达自动同步商品数据", utils.Format4Output(beijin, false)) + globals.SugarLogger.Debugf("=============淘鲜达自动同步商品数据 := %s", utils.Format4Output(beijin, false)) _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin, false, nil, nil, syncFlag, true, true) errList.AddErr(err) } From e435ba6796bbb819cd1d55b05e02d44fd078adb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 18:34:09 +0800 Subject: [PATCH 11/34] 1 --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 64b04d9ad..c3c5ee649 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -372,7 +372,7 @@ func Init() { "13:00:00", "15:00:00", "17:20:00", - "18:35:00", + "18:40:00", "20:40:00", "22:40:00", "23:40:00", From 2cb63a2ca34056c25ae557a9a0875ae42c87b3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 20 Jul 2023 20:27:37 +0800 Subject: [PATCH 12/34] 1 --- business/jxstore/misc/misc.go | 137 +++++++++++++++++----------------- 1 file changed, 68 insertions(+), 69 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index c3c5ee649..b8c449121 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -290,75 +290,74 @@ func Init() { 667354, 667321, 667319, - //667316, - //667269, - //667268, - //667267, - //667260, - //667132, - //667094, - //667030, - //666965, - //666714, - //666708, - //666705, - //103437, - //103349, - //103123, - //103121, - //103106, - //103038, - //103028, - //103019, - //102831, - //102751, - //102683, - //102542, - //102514, - //102382, - //102182, - //102178, - //102173, - //102098, - //102094, - //102080, - //102072, - //102069, - //101870, - //101869, - //101868, - //101867, - //101866, - //101865, - //100956, - //100930, - //100871, - //100786, - //100746, - //100744, - //100726, - //100705, - //100400, - //100111, - //100108, - //100106, - //100104, - //100103, - //100102, - //100100, - //100097, - //100096, - //100095, - //100093, - //100092, - //100089, - //100087, - //100086, - //100085, - //100082, - //100079, - //100078, - + 667316, + 667269, + 667268, + 667267, + 667260, + 667132, + 667094, + 667030, + 666965, + 666714, + 666708, + 666705, + 103437, + 103349, + 103123, + 103121, + 103106, + 103038, + 103028, + 103019, + 102831, + 102751, + 102683, + 102542, + 102514, + 102382, + 102182, + 102178, + 102173, + 102098, + 102094, + 102080, + 102072, + 102069, + 101870, + 101869, + 101868, + 101867, + 101866, + 101865, + 100956, + 100930, + 100871, + 100786, + 100746, + 100744, + 100726, + 100705, + 100400, + 100111, + 100108, + 100106, + 100104, + 100103, + 100102, + 100100, + 100097, + 100096, + 100095, + 100093, + 100092, + 100089, + 100087, + 100086, + 100085, + 100082, + 100079, + 100078, } syncStoreSkuTao(beijin) }, []string{ From c75d35df8a983b3dfe71238ff105ee60d450618c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 08:59:55 +0800 Subject: [PATCH 13/34] 1 --- business/jxstore/misc/misc.go | 151 +++++++++++++++++----------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index b8c449121..0aa43ba7f 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -283,81 +283,82 @@ func Init() { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { var beijin = []int{ 669158, - 668691, - 668673, - 668282, - 667447, - 667354, - 667321, - 667319, - 667316, - 667269, - 667268, - 667267, - 667260, - 667132, - 667094, - 667030, - 666965, - 666714, - 666708, - 666705, - 103437, - 103349, - 103123, - 103121, - 103106, - 103038, - 103028, - 103019, - 102831, - 102751, - 102683, - 102542, - 102514, - 102382, - 102182, - 102178, - 102173, - 102098, - 102094, - 102080, - 102072, - 102069, - 101870, - 101869, - 101868, - 101867, - 101866, - 101865, - 100956, - 100930, - 100871, - 100786, - 100746, - 100744, - 100726, - 100705, - 100400, - 100111, - 100108, - 100106, - 100104, - 100103, - 100102, - 100100, - 100097, - 100096, - 100095, - 100093, - 100092, - 100089, - 100087, - 100086, - 100085, - 100082, - 100079, - 100078, + //668691, + //668673, + //668282, + //667447, + //667354, + //667321, + //667319, + //667316, + //667269, + //667268, + //667267, + //667260, + //667132, + //667094, + //667030, + //666965, + //666714, + //666708, + //666705, + //103437, + //103349, + //103123, + //103121, + //103106, + //103038, + //103028, + //103019, + //102831, + //102751, + //102683, + //102542, + //102514, + //102382, + //102182, + //102178, + //102173, + //102098, + //102094, + //102080, + //102072, + //102069, + //101870, + //101869, + //101868, + //101867, + //101866, + //101865, + //100956, + //100930, + //100871, + //100786, + //100746, + //100744, + //100726, + //100705, + //100400, + //100111, + //100108, + //100106, + //100104, + //100103, + //100102, + //100100, + //100097, + //100096, + //100095, + //100093, + //100092, + //100089, + //100087, + //100086, + //100085, + //100082, + //100079, + //100078, + } syncStoreSkuTao(beijin) }, []string{ From 2643b179fb78b27db55ca30d9f1e59a34a1cc787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 09:26:25 +0800 Subject: [PATCH 14/34] 1 --- business/jxstore/misc/misc.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 0aa43ba7f..9b654151b 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -367,6 +367,7 @@ func Init() { "05:20:00", "07:40:00", "08:40:00", + "09:30:00", "10:40:00", "12:40:00", "13:00:00", From 50a53f7cfa0520b2d7dba8b66fbb404d33ccd1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 10:59:14 +0800 Subject: [PATCH 15/34] 1 --- business/jxstore/misc/misc.go | 6 +++--- .../partner/purchase/tao_vegetable/store_sku2.go | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 9b654151b..b81476e17 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -283,8 +283,8 @@ func Init() { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { var beijin = []int{ 669158, - //668691, - //668673, + 668691, + 668673, //668282, //667447, //667354, @@ -368,7 +368,7 @@ func Init() { "07:40:00", "08:40:00", "09:30:00", - "10:40:00", + "11:00:00", "12:40:00", "13:00:00", "15:00:00", diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index d181fc844..3d1ad2462 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -41,19 +41,19 @@ var ( func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) { switch funcID { case partner.FuncUpdateStoreSkusStock, partner.FuncUpdateStoreSkusStatus, partner.FuncUpdateStoreSkusPrice: - batchSize = 10 + batchSize = 5 case partner.FuncDeleteStoreSkus: - batchSize = 10 + batchSize = 5 case partner.FuncCreateStoreSkus: - batchSize = 10 // 可考虑用批量操作 + batchSize = 5 // 可考虑用批量操作 case partner.FuncUpdateStoreSkus: - batchSize = 10 // mtwmapi.MaxStoreSkuBatchSize + batchSize = 5 // mtwmapi.MaxStoreSkuBatchSize case partner.FuncGetStoreSkusFullInfo: - batchSize = 10 + batchSize = 5 case partner.FuncCreateActs: - batchSize = 10 + batchSize = 5 case partner.FuncCancelActs: - batchSize = 10 + batchSize = 5 } return batchSize } From bf0cea40fd7fd821a84e187653ad333100cfb60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 11:01:06 +0800 Subject: [PATCH 16/34] 1 --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index b81476e17..d118bc802 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -368,7 +368,7 @@ func Init() { "07:40:00", "08:40:00", "09:30:00", - "11:00:00", + "11:05:00", "12:40:00", "13:00:00", "15:00:00", From 874ffbc80d7bc960a5e03c21fff977a3da5a4275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 11:55:45 +0800 Subject: [PATCH 17/34] 1 --- business/jxstore/misc/misc.go | 196 ++++++++++++++++------------- business/partner/delivery/rider.go | 6 +- 2 files changed, 113 insertions(+), 89 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index d118bc802..43493e930 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -285,98 +285,122 @@ func Init() { 669158, 668691, 668673, - //668282, - //667447, - //667354, - //667321, - //667319, - //667316, - //667269, - //667268, - //667267, - //667260, - //667132, - //667094, - //667030, - //666965, - //666714, - //666708, - //666705, - //103437, - //103349, - //103123, - //103121, - //103106, - //103038, - //103028, - //103019, - //102831, - //102751, - //102683, - //102542, - //102514, - //102382, - //102182, - //102178, - //102173, - //102098, - //102094, - //102080, - //102072, - //102069, - //101870, - //101869, - //101868, - //101867, - //101866, - //101865, - //100956, - //100930, - //100871, - //100786, - //100746, - //100744, - //100726, - //100705, - //100400, - //100111, - //100108, - //100106, - //100104, - //100103, - //100102, - //100100, - //100097, - //100096, - //100095, - //100093, - //100092, - //100089, - //100087, - //100086, - //100085, - //100082, - //100079, - //100078, - + 668282, + 667447, + 667354, + 667321, + 667319, + 667316, + 667269, + 667268, + 667267, + 667260, + 667132, + 667094, + 667030, + 666965, + 666714, + 666708, + 666705, + 103437, + 103349, + 103123, + 103121, + 103106, } syncStoreSkuTao(beijin) }, []string{ - "01:40:00", - "03:40:00", - "05:20:00", - "07:40:00", - "08:40:00", + "00:30:00", + "01:30:00", + "02:30:00", + "03:30:00", + "04:30:00", + "05:30:00", + "07:30:00", "09:30:00", - "11:05:00", - "12:40:00", + "12:30:00", + "13:30:00", + "15:30:00", + "17:30:00", + "18:30:00", + "20:30:00", + "21:30:00", + "22:30:00", + "23:30:00", + }) + ScheduleTimerFunc("RefreshSyncSkuList_tao2", func() { + var beijin = []int{ + 103038, + 103028, + 103019, + 102831, + 102751, + 102683, + 102542, + 102514, + 102382, + 102182, + 102178, + 102173, + 102098, + 102094, + 102080, + 102072, + 102069, + 101870, + 101869, + 101868, + 101867, + 101866, + 101865, + 100956, + 100930, + 100871, + 100786, + 100746, + 100744, + 100726, + 100705, + 100400, + 100111, + 100108, + 100106, + 100104, + 100103, + 100102, + 100100, + 100097, + 100096, + 100095, + 100093, + 100092, + 100089, + 100087, + 100086, + 100085, + 100082, + 100079, + 100078, + } + syncStoreSkuTao(beijin) + }, []string{ + "01:00:00", + "02:00:00", + "03:00:00", + "04:00:00", + "05:00:00", + "06:00:00", + "08:00:00", + "09:00:00", + "12:00:00", "13:00:00", "15:00:00", - "17:20:00", - "18:40:00", - "20:40:00", - "22:40:00", - "23:40:00", + "17:00:00", + "18:00:00", + "20:00:00", + "21:00:00", + "22:00:00", + "23:00:00", }) // 刷新抖音门店token diff --git a/business/partner/delivery/rider.go b/business/partner/delivery/rider.go index 45fe08caa..46411c454 100644 --- a/business/partner/delivery/rider.go +++ b/business/partner/delivery/rider.go @@ -96,9 +96,9 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) { continue } - if (v.WaybillVendorID == model.YES || v.WaybillVendorID == -1) && v.VendorID == model.VendorIDMTWM { - continue - } + //if (v.WaybillVendorID == model.YES || v.WaybillVendorID == -1) && v.VendorID == model.VendorIDMTWM { + // continue + //} if orderId == "" { // 订单id为空是,是定时轮询操作,不做此状态 waybillList, _ := dao.GetWaybills(dao.GetDB(), v.VendorOrderID, nil) From 229ec09486c063737da7c063e87a0831e4dd4f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 15:01:09 +0800 Subject: [PATCH 18/34] 1 --- business/jxstore/misc/misc.go | 229 ++++++++---------- .../purchase/tao_vegetable/store_sku2.go | 5 +- 2 files changed, 106 insertions(+), 128 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 43493e930..34997ae77 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -280,128 +280,107 @@ func Init() { // }, []string{"13:00:00"}) //} // 淘鲜达更新门店商品 ,接口收费暂不使用 - ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { - var beijin = []int{ - 669158, - 668691, - 668673, - 668282, - 667447, - 667354, - 667321, - 667319, - 667316, - 667269, - 667268, - 667267, - 667260, - 667132, - 667094, - 667030, - 666965, - 666714, - 666708, - 666705, - 103437, - 103349, - 103123, - 103121, - 103106, - } - syncStoreSkuTao(beijin) - }, []string{ - "00:30:00", - "01:30:00", - "02:30:00", - "03:30:00", - "04:30:00", - "05:30:00", - "07:30:00", - "09:30:00", - "12:30:00", - "13:30:00", - "15:30:00", - "17:30:00", - "18:30:00", - "20:30:00", - "21:30:00", - "22:30:00", - "23:30:00", - }) - ScheduleTimerFunc("RefreshSyncSkuList_tao2", func() { - var beijin = []int{ - 103038, - 103028, - 103019, - 102831, - 102751, - 102683, - 102542, - 102514, - 102382, - 102182, - 102178, - 102173, - 102098, - 102094, - 102080, - 102072, - 102069, - 101870, - 101869, - 101868, - 101867, - 101866, - 101865, - 100956, - 100930, - 100871, - 100786, - 100746, - 100744, - 100726, - 100705, - 100400, - 100111, - 100108, - 100106, - 100104, - 100103, - 100102, - 100100, - 100097, - 100096, - 100095, - 100093, - 100092, - 100089, - 100087, - 100086, - 100085, - 100082, - 100079, - 100078, - } - syncStoreSkuTao(beijin) - }, []string{ - "01:00:00", - "02:00:00", - "03:00:00", - "04:00:00", - "05:00:00", - "06:00:00", - "08:00:00", - "09:00:00", - "12:00:00", - "13:00:00", - "15:00:00", - "17:00:00", - "18:00:00", - "20:00:00", - "21:00:00", - "22:00:00", - "23:00:00", - }) + if beego.BConfig.RunMode != "jxgy" { + ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { + var beijin = []int{ + 669158, + 668691, + 668673, + 668282, + 667447, + 667354, + 667321, + 667319, + 667316, + 667269, + 667268, + 667267, + 667260, + 667132, + 667094, + 667030, + 666965, + 666714, + 666708, + 666705, + 103437, + 103349, + 103123, + 103121, + 103106, + 103038, + 103028, + 103019, + 102831, + 102751, + 102683, + 102542, + 102514, + 102382, + 102182, + 102178, + 102173, + 102098, + 102094, + 102080, + 102072, + 102069, + 101870, + 101869, + 101868, + 101867, + 101866, + 101865, + 100956, + 100930, + 100871, + 100786, + 100746, + 100744, + 100726, + 100705, + 100400, + 100111, + 100108, + 100106, + 100104, + 100103, + 100102, + 100100, + 100097, + 100096, + 100095, + 100093, + 100092, + 100089, + 100087, + 100086, + 100085, + 100082, + 100079, + 100078, + } + syncStoreSkuTao(beijin) + }, []string{ + "00:30:00", + "01:30:00", + "02:30:00", + "03:30:00", + "04:30:00", + "05:30:00", + "07:30:00", + "09:30:00", + "12:30:00", + "13:30:00", + "15:30:00", + "17:30:00", + "18:30:00", + "20:30:00", + "21:30:00", + "22:30:00", + "23:30:00", + }) + } // 刷新抖音门店token if beego.BConfig.RunMode != "jxgy" { @@ -757,6 +736,7 @@ func syncStoreSkuTiktok() { tasksch.HandleTask(task, nil, true).Run() } +var SyncLen = 0 // 同步步长 // syncStoreSkuTao 同步商品到淘鲜达 func syncStoreSkuTao(beijin []int) { syncFlag := 0 @@ -768,9 +748,8 @@ func syncStoreSkuTao(beijin []int) { switch step { case 0: if beego.BConfig.RunMode != "jxgy" { - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达自动同步商品数据", utils.Format4Output(beijin, false)) - globals.SugarLogger.Debugf("=============淘鲜达自动同步商品数据 := %s", utils.Format4Output(beijin, false)) - _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin, false, nil, nil, syncFlag, true, true) + _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin[SyncLen:SyncLen+5], false, nil, nil, syncFlag, true, true) + SyncLen += 5 errList.AddErr(err) } case 1: diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index 3d1ad2462..0e3daf4f6 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -209,7 +209,6 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v } func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) { - globals.SugarLogger.Debugf("len CreateStoreSkus := %d", len(storeSkuList)) failedList, err = p.createOrUpdateStoreSkus(ctx, storeID, vendorStoreID, storeSkuList, true) return failedList, err } @@ -287,10 +286,8 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSyncInfo, vendorStoreID string, storeID int, syncType string) (failedList []*partner.StoreSkuInfoWithErr, err error) { createPram := &request585.AlibabaWdkSkuAddRequest{} param := make([]domain585.AlibabaWdkSkuAddSkuDo, 0, 0) - //totalCount := len(storeSkuList) vendorSkuIdMap := make(map[string]string, 0) - globals.SugarLogger.Debugf("storeSkuList := %d", len(storeSkuList)) for _, storeSku := range storeSkuList { price := utils.String2Pointer(utils.Float64ToStr(utils.Int64ToFloat64(storeSku.VendorPrice) / utils.Int64ToFloat64(100))) sku := domain585.AlibabaWdkSkuAddSkuDo{ @@ -377,6 +374,8 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku if err != nil { globals.SugarLogger.Debugf("创建淘鲜达商品异常:%s", err.Error()) } + //ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", fmt.Sprintf("定时创建商品[门店id:%d],出入商品个数[%d]", storeID, len(storeSkuList)), utils.Format4Output(result, false)) + // 记录失败的同步数据 failedList2, vendorSkuIdMap2 := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], syncType) failedList = append(failedList, failedList2...) From 979713f17e60a67a42c0fa6a3d98705f75d45f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 16:29:42 +0800 Subject: [PATCH 19/34] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=9C=82=E9=B8=9F?= =?UTF-8?q?=E9=AA=91=E6=89=8B=E6=8A=95=E8=AF=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/fn/waybill.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/delivery/fn/waybill.go b/business/partner/delivery/fn/waybill.go index ad246b058..bcfed0c4c 100644 --- a/business/partner/delivery/fn/waybill.go +++ b/business/partner/delivery/fn/waybill.go @@ -86,7 +86,7 @@ func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, } func (c *DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) { - err = api.FnAPI.ComplaintRider(bill.VendorOrderID, complaintReson2FnResonMap[resonID]) + err = api.FnAPI.ComplaintRider(bill.VendorOrderID, bill.VendorWaybillID, complaintReson2FnResonMap[resonID], resonContent) return err } From 2ed3abf1185d3f25f784eaa3629253432368d19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 21 Jul 2023 18:50:10 +0800 Subject: [PATCH 20/34] 1 --- business/jxstore/misc/misc.go | 2 +- business/partner/purchase/ebai/order.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 34997ae77..b0cca7a7a 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -749,7 +749,6 @@ func syncStoreSkuTao(beijin []int) { case 0: if beego.BConfig.RunMode != "jxgy" { _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin[SyncLen:SyncLen+5], false, nil, nil, syncFlag, true, true) - SyncLen += 5 errList.AddErr(err) } case 1: @@ -760,6 +759,7 @@ func syncStoreSkuTao(beijin []int) { return retVal, err }, []int{0, 1}) tasksch.HandleTask(task, nil, true).Run() + SyncLen += 5 } func doDailyWork2() { diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 80ae20fe0..a8856ba4e 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -399,7 +399,7 @@ func (p *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName s err = nil case ebaiapi.WaybillStatusDeliveryCancled: p.trySyncCancelStatus(order.VendorOrderID) - case ebaiapi.WaybillStatusNew, ebaiapi.WaybillStatusRequestDelivery, ebaiapi.WaybillStatusWait4Courier: + case ebaiapi.WaybillStatusNew, ebaiapi.WaybillStatusEvent, ebaiapi.WaybillStatusRequestDelivery, ebaiapi.WaybillStatusWait4Courier: err = api.EbaiAPI.OrderCancelDelivery(order.VendorOrderID) // 取消呼叫众包骑手 case ebaiapi.WaybillStatusCourierAccepted: err = errors.New("骑手已接单,无法转自送") From 7ccfd884667843d00483be74e073d5958949738c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Jul 2023 09:48:33 +0800 Subject: [PATCH 21/34] 1 --- business/jxstore/misc/misc.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index b0cca7a7a..20879c120 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -369,7 +369,7 @@ func Init() { "04:30:00", "05:30:00", "07:30:00", - "09:30:00", + "09:55:00", "12:30:00", "13:30:00", "15:30:00", @@ -736,7 +736,8 @@ func syncStoreSkuTiktok() { tasksch.HandleTask(task, nil, true).Run() } -var SyncLen = 0 // 同步步长 +var syncLen = 0 + // syncStoreSkuTao 同步商品到淘鲜达 func syncStoreSkuTao(beijin []int) { syncFlag := 0 @@ -748,7 +749,8 @@ func syncStoreSkuTao(beijin []int) { switch step { case 0: if beego.BConfig.RunMode != "jxgy" { - _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin[SyncLen:SyncLen+5], false, nil, nil, syncFlag, true, true) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达消息:", utils.Format4Output(beijin[syncLen:syncLen+5], false)) + _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin[syncLen:syncLen+5], false, nil, nil, syncFlag, true, true) errList.AddErr(err) } case 1: @@ -759,7 +761,7 @@ func syncStoreSkuTao(beijin []int) { return retVal, err }, []int{0, 1}) tasksch.HandleTask(task, nil, true).Run() - SyncLen += 5 + syncLen += 5 } func doDailyWork2() { From 15beac082e6041fd4d9c95aed3619dff2327832e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Jul 2023 11:04:39 +0800 Subject: [PATCH 22/34] 1 --- business/jxcallback/orderman/order.go | 4 ++++ controllers/jx_order.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index e9c290fbb..4b825e288 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -269,6 +269,10 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m partner.CurOrderManager.OnOrderMsg(order, fmt.Sprintf("订单[%s]被取消了,运单[%s]取消成功", order.VendorOrderID, v.VendorWaybillID), "") } } + // 刷新订单结束时间 + order.OrderFinishedAt = time.Now() + dao.UpdateEntity(db, order, "OrderFinishedAt") + //如果取消订单则要把库存加回去 if err2 == nil { // 判断是否需要打印取消订单 diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 652d05250..49a8b3806 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -119,7 +119,7 @@ func (c *OrderController) QueryOrderWaybillFeeInfo() { // @Param token header string true "认证token" // @Param vendorOrderID formData string true "订单ID" // @Param vendorID formData int true "订单所属的厂商ID" -// @Param courierVendorIDs formData string false "运单厂商ID(缺省全部)" +// @Param courierVendorIDsformData string false "运单厂商ID(缺省全部)" // @Param maxDeliveryFee formData int false "最高限价(为0时为缺省最大值)" // @Param forceCreate formData bool false "是否强制创建(忽略订单状态检查及其它参数)" // @Success 200 {object} controllers.CallResult From 6c04f1a71beae66757e9032163642525089bc1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Jul 2023 18:34:45 +0800 Subject: [PATCH 23/34] 1 --- business/jxstore/act/act.go | 1 + business/jxstore/misc/misc.go | 108 +++++++++++++----- business/partner/delivery/mtps/waybill.go | 32 +++--- .../purchase/tao_vegetable/store_sku2.go | 36 +----- 4 files changed, 100 insertions(+), 77 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index eaeea20a9..e214e0724 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -2194,6 +2194,7 @@ func GetActMtwmVendorSku(ctx *jxcontext.Context, storeID int, keyword string, ac } func DeleteActStoreSkuVendor(ctx *jxcontext.Context, db *dao.DaoDB, actStoreSkuParam []*ActStoreSkuParam) (err error) { + return fmt.Errorf("暂不支持直接取消平台活动,开发中……") } diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 20879c120..3481efe6e 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -283,36 +283,6 @@ func Init() { if beego.BConfig.RunMode != "jxgy" { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { var beijin = []int{ - 669158, - 668691, - 668673, - 668282, - 667447, - 667354, - 667321, - 667319, - 667316, - 667269, - 667268, - 667267, - 667260, - 667132, - 667094, - 667030, - 666965, - 666714, - 666708, - 666705, - 103437, - 103349, - 103123, - 103121, - 103106, - 103038, - 103028, - 103019, - 102831, - 102751, 102683, 102542, 102514, @@ -359,6 +329,84 @@ func Init() { 100082, 100079, 100078, + 669158, + 668691, + 668673, + 668282, + 667447, + 667354, + 667321, + 667319, + 667316, + 667269, + 667268, + 667267, + 667260, + 667132, + 667094, + 667030, + 666965, + 666714, + 666708, + 666705, + 103437, + 103349, + 103123, + 103121, + 103106, + 103038, + 103028, + 103019, + 102831, + 102751, + //上海 + 668462, + 668276, + 668180, + 667320, + 667237, + 667231, + 667068, + 667036, + 666678, + 103191, + 103074, + 103065, + 103051, + 103050, + 103037, + 103029, + 103018, + 103002, + 102999, + 102969, + 102966, + 102951, + 102946, + 102939, + 102938, + 102934, + 102933, + 102930, + 102924, + 102920, + 102908, + 102903, + 102561, + 102293, + 100946, + 100945, + 100943, + 100935, + 100905, + 100720, + 100325, + 100324, + 100309, + 100299, + 100296, + 100292, + 100290, } syncStoreSkuTao(beijin) }, []string{ diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index bbb53774c..bff8a6251 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -523,14 +523,14 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId return 0, err } - isMerchantCancel := false - // 获取发起取消的人员 - for _, v := range statusList { - if v.VendorStatus == utils.Int64ToStr(model.WaybillStatusCancel) { - isMerchantCancel = true // 商户取消 - break - } - } + //isMerchantCancel := false + //// 获取发起取消的人员 + //for _, v := range statusList { + // if v.VendorStatus == utils.Int64ToStr(model.WaybillStatusCancel) { + // isMerchantCancel = true // 商户取消 + // break + // } + //} bill, err := partner.CurOrderManager.LoadWaybill(deliverId, model.VendorIDMTPS) if err != nil { @@ -549,17 +549,17 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId } // 到店 if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusPickedUp) { - if isMerchantCancel { - return bill.DesiredFee, nil - } - return 0, nil + //if isMerchantCancel { + return bill.DesiredFee, nil + //} + //return 0, nil } // 接单 if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusAccepted) { - if isMerchantCancel { - return 200, nil - } - return 0, nil + //if isMerchantCancel { + return 200, nil + //} + //return 0, nil } // 待调度 if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusWaitingForSchedule) { diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index 0e3daf4f6..499bd19b9 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -242,7 +242,7 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync OuCode: utils.String2Pointer(vendorStoreID), SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), SkuName: utils.String2Pointer(checkNameLength(v.SkuName)), - MemberPrice: price, + MemberPrice: utils.String2Pointer("0"), SkuPrice: price, // 优先使用skuPrice 靠后SalePrice SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice CategoryCode: utils.String2Pointer(utils.Int2Str(v.CategoryID)), @@ -256,19 +256,6 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync } updateSku.SkuPicUrls = uploadImg(api, []string{v.Img, v.Img2, v.Img3, v.Img4, v.Img5, v.DescImg}) updateSkuList = append(updateSkuList, updateSku) - //if (index+model.YES)%tao_vegetable.MAXHandleCount == model.NO || index+model.YES == totalCount { - // param.ParamList = &updateSkuList - // result, err := api.UpdateStoreSku(param) - // if err != nil { - // globals.SugarLogger.Debugf("UpdateStoreSku Tao Vegetable err : %s", err.Error()) - // } - // // 记录失败的同步数据 - // createFailedList, _ := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], syncType) - // failedList = append(failedList, createFailedList...) - // // 记录同步成功的数据 - // param.ParamList = nil - // updateSkuList = make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0) - //} } param.ParamList = &updateSkuList @@ -311,9 +298,9 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku SubTitle: utils.String2Pointer("小时达"), SubTitle1: utils.String2Pointer("一小时速达"), //DeliveryUnit: utils.String2Pointer(storeSku.Unit), - DeliveryUnit: utils.String2Pointer("份"), - DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)), - MemberPrice: price, + DeliveryUnit: utils.String2Pointer("份"), + DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)), + //MemberPrice: price, Storage: utils.String2Pointer(tao_vegetable.CreateStorage), PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0 ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7 @@ -592,23 +579,10 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg SkuPrice: price, CleanSkuMemberPrice: utils.Int64ToPointer(model.YES), SuggestedPrice: price, - MemberPrice: price, + MemberPrice: utils.String2Pointer("0"), SubTitle: utils.String2Pointer("小时达"), } updateSkuList = append(updateSkuList, updateSku) - - //if (index+model.YES)%tao_vegetable.MAXHandleCount == model.NO || (index+1) == len(storeSkuList) { - // param.ParamList = &updateSkuList - // result, err := api.UpdateStoreSku(param) - // if err != nil { - // globals.SugarLogger.Debugf("UpdateStoreSku Tao Vegetable err : %s", err.Error()) - // } - // // 记录失败的同步数据 - // createFailedList, _ := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], "修改商品价格") - // failedList = append(failedList, createFailedList...) - // param.ParamList = nil - // updateSkuList = make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0) - //} } param.ParamList = &updateSkuList result, err := api.UpdateStoreSku(param) From ca1b86c31cb776a112f89d66f4428758d70274a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Jul 2023 18:35:04 +0800 Subject: [PATCH 24/34] 1 --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 3481efe6e..a61d098ff 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -422,7 +422,7 @@ func Init() { "13:30:00", "15:30:00", "17:30:00", - "18:30:00", + "18:40:00", "20:30:00", "21:30:00", "22:30:00", From 93ec7f2c599a7e0f48305d6043b096509bec845e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Jul 2023 18:44:02 +0800 Subject: [PATCH 25/34] 1 --- controllers/jx_order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 49a8b3806..2c59ab300 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -119,7 +119,7 @@ func (c *OrderController) QueryOrderWaybillFeeInfo() { // @Param token header string true "认证token" // @Param vendorOrderID formData string true "订单ID" // @Param vendorID formData int true "订单所属的厂商ID" -// @Param courierVendorIDsformData string false "运单厂商ID(缺省全部)" +// @Param courierVendorIDs formData string false "运单厂商ID(缺省全部)" // @Param maxDeliveryFee formData int false "最高限价(为0时为缺省最大值)" // @Param forceCreate formData bool false "是否强制创建(忽略订单状态检查及其它参数)" // @Success 200 {object} controllers.CallResult From 16f3f9d22ec986ea583910ca18eb817318b878b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Jul 2023 18:46:31 +0800 Subject: [PATCH 26/34] 1 --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index a61d098ff..04df5aa5c 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -422,7 +422,7 @@ func Init() { "13:30:00", "15:30:00", "17:30:00", - "18:40:00", + "18:55:00", "20:30:00", "21:30:00", "22:30:00", From 5618869ee24e679a4fabe3df5168d8ea9c22ab89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Jul 2023 09:31:37 +0800 Subject: [PATCH 27/34] 1 --- business/jxstore/act/act.go | 40 +++++----- business/jxstore/misc/misc.go | 137 ++++++++++++++++++---------------- 2 files changed, 91 insertions(+), 86 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index e214e0724..44a339927 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -2030,27 +2030,27 @@ func RrefreshMtwmVendorAct(ctx *jxcontext.Context) (err error) { if len(actList) > 0 { for _, act := range actList { if act.Status > 0 { - //if checkActStoreSkuExist(db, storeMap.StoreID, utils.Str2Int(act.AppFoodCode), model.VendorIDMTWM, utils.Timestamp2Time(act.StartTime), utils.Timestamp2Time(act.EndTime)) { - actVendor := &model.ActMtwmVendor{ - StoreID: storeMap.StoreID, - SkuID: utils.Str2Int(act.AppFoodCode), - VendorStoreID: storeMap.VendorStoreID, - ActType: v, - BeginAt: utils.Timestamp2Time(act.StartTime), - EndAt: utils.Timestamp2Time(act.EndTime), - SkuName: act.Name, - OriginPrice: act.OriginalPrice, - ActPrice: act.ActPrice, - DiscountCoefficient: act.DiscountCoefficient, - Status: act.Status, - ItemID: utils.Int64ToStr(act.ItemID), - OrderLimit: act.OrderLimit, - Period: act.Period, - WeeksTime: act.WeeksTime, - SettingType: act.SettingType, + if checkActStoreSkuExist(db, storeMap.StoreID, utils.Str2Int(act.AppFoodCode), model.VendorIDMTWM, utils.Timestamp2Time(act.StartTime), utils.Timestamp2Time(act.EndTime)) { + actVendor := &model.ActMtwmVendor{ + StoreID: storeMap.StoreID, + SkuID: utils.Str2Int(act.AppFoodCode), + VendorStoreID: storeMap.VendorStoreID, + ActType: v, + BeginAt: utils.Timestamp2Time(act.StartTime), + EndAt: utils.Timestamp2Time(act.EndTime), + SkuName: act.Name, + OriginPrice: act.OriginalPrice, + ActPrice: act.ActPrice, + DiscountCoefficient: act.DiscountCoefficient, + Status: act.Status, + ItemID: utils.Int64ToStr(act.ItemID), + OrderLimit: act.OrderLimit, + Period: act.Period, + WeeksTime: act.WeeksTime, + SettingType: act.SettingType, + } + dao.CreateEntity(db, actVendor) } - dao.CreateEntity(db, actVendor) - //} } } } diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 04df5aa5c..3221973bb 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -283,71 +283,71 @@ func Init() { if beego.BConfig.RunMode != "jxgy" { ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { var beijin = []int{ - 102683, - 102542, - 102514, - 102382, - 102182, - 102178, - 102173, - 102098, - 102094, - 102080, - 102072, - 102069, - 101870, - 101869, - 101868, - 101867, - 101866, - 101865, - 100956, - 100930, - 100871, - 100786, - 100746, - 100744, - 100726, - 100705, - 100400, - 100111, - 100108, - 100106, - 100104, - 100103, - 100102, - 100100, - 100097, - 100096, - 100095, - 100093, - 100092, - 100089, - 100087, - 100086, - 100085, - 100082, - 100079, - 100078, - 669158, - 668691, - 668673, - 668282, - 667447, - 667354, - 667321, - 667319, - 667316, - 667269, - 667268, - 667267, - 667260, - 667132, - 667094, - 667030, - 666965, - 666714, - 666708, + //102683, + //102542, + //102514, + //102382, + //102182, + //102178, + //102173, + //102098, + //102094, + //102080, + //102072, + //102069, + //101870, + //101869, + //101868, + //101867, + //101866, + //101865, + //100956, + //100930, + //100871, + //100786, + //100746, + //100744, + //100726, + //100705, + //100400, + //100111, + //100108, + //100106, + //100104, + //100103, + //100102, + //100100, + //100097, + //100096, + //100095, + //100093, + //100092, + //100089, + //100087, + //100086, + //100085, + //100082, + //100079, + //100078, + //669158, + //668691, + //668673, + //668282, + //667447, + //667354, + //667321, + //667319, + //667316, + //667269, + //667268, + //667267, + //667260, + //667132, + //667094, + //667030, + //666965, + //666714, + //666708, 666705, 103437, 103349, @@ -418,11 +418,16 @@ func Init() { "05:30:00", "07:30:00", "09:55:00", - "12:30:00", + "10:55:00", + "11:55:00", + "12:55:00", "13:30:00", + "14:30:00", "15:30:00", + "16:30:00", "17:30:00", "18:55:00", + "19:55:00", "20:30:00", "21:30:00", "22:30:00", From 33b5d630e21d2ff5128baa61c3b73f6280b4c5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Jul 2023 10:22:05 +0800 Subject: [PATCH 28/34] 1 --- business/jxstore/misc/misc.go | 22 +++++++++---------- .../purchase/tao_vegetable/store_sku2.go | 14 +++++++----- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 3221973bb..e53205f82 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -348,16 +348,16 @@ func Init() { //666965, //666714, //666708, - 666705, - 103437, - 103349, - 103123, - 103121, - 103106, - 103038, - 103028, - 103019, - 102831, + //666705, + //103437, + //103349, + //103123, + //103121, + //103106, + //103038, + //103028, + //103019, + //102831, 102751, //上海 668462, @@ -418,7 +418,7 @@ func Init() { "05:30:00", "07:30:00", "09:55:00", - "10:55:00", + "10:30:00", "11:55:00", "12:55:00", "13:30:00", diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index 499bd19b9..b76162536 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -241,7 +241,7 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{ OuCode: utils.String2Pointer(vendorStoreID), SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), - SkuName: utils.String2Pointer(checkNameLength(v.SkuName)), + SkuName: utils.String2Pointer(checkNameLength(v.SkuName, v.Weight, v.Unit)), MemberPrice: utils.String2Pointer("0"), SkuPrice: price, // 优先使用skuPrice 靠后SalePrice SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice @@ -254,7 +254,8 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync } else { updateSku.PurchaseQuantity = utils.Int64ToPointer(int64(v.MinOrderCount)) // 起购单位 } - updateSku.SkuPicUrls = uploadImg(api, []string{v.Img, v.Img2, v.Img3, v.Img4, v.Img5, v.DescImg}) + // 修改暂时不修改图片,保持效率 + //updateSku.SkuPicUrls = uploadImg(api, []string{v.Img, v.Img2, v.Img3, v.Img4, v.Img5, v.DescImg}) updateSkuList = append(updateSkuList, updateSku) } @@ -326,7 +327,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku if sku.SkuPicUrls == nil { continue } - sku.SkuName = utils.String2Pointer(checkNameLength(storeSku.Name)) + sku.SkuName = utils.String2Pointer(checkNameLength(storeSku.Name, storeSku.Weight, storeSku.Unit)) if storeSku.MinOrderCount <= model.YES { sku.PurchaseQuantity = utils.Int64ToPointer(model.YES) // 起购单位 @@ -385,8 +386,11 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku return failedList, nil } -func checkNameLength(name string) string { +func checkNameLength(name string, weight int, uint string) string { lastName := "" + if !strings.Contains(name, uint) { + name = fmt.Sprintf("%s %d/%s", name, weight, uint) + } if strings.Contains(name, "其它") { name = strings.ReplaceAll(name, "其它", "") } @@ -434,7 +438,7 @@ func checkNameLength(name string) string { return lastName } } - return name[0:60] + return lastName[0:60] } func uploadImg(api *tao_vegetable.API, imgs []string) *string { From 34eaa47ac2795942bd5dd52279b839e22efa91aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Jul 2023 10:33:31 +0800 Subject: [PATCH 29/34] 1 --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index e53205f82..fb86567fa 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -418,7 +418,7 @@ func Init() { "05:30:00", "07:30:00", "09:55:00", - "10:30:00", + "10:40:00", "11:55:00", "12:55:00", "13:30:00", From c7b88eb1ed035b023ae2cfa7b3f530a7f2746593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Jul 2023 11:10:12 +0800 Subject: [PATCH 30/34] 1 --- .../purchase/tao_vegetable/store_sku2.go | 94 +++---------------- 1 file changed, 13 insertions(+), 81 deletions(-) diff --git a/business/partner/purchase/tao_vegetable/store_sku2.go b/business/partner/purchase/tao_vegetable/store_sku2.go index b76162536..2d16b1c0c 100644 --- a/business/partner/purchase/tao_vegetable/store_sku2.go +++ b/business/partner/purchase/tao_vegetable/store_sku2.go @@ -235,19 +235,17 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSyncInfo, vendorStoreID string, storeID int, syncType string) (failedList []*partner.StoreSkuInfoWithErr, err error) { param := &request585.AlibabaWdkSkuUpdateRequest{} updateSkuList := make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0) - //totalCount := len(storeSkuList) for _, v := range storeSkuList { price := utils.String2Pointer(utils.Float64ToStr(float64(v.VendorPrice) / float64(100))) updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{ - OuCode: utils.String2Pointer(vendorStoreID), - SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), - SkuName: utils.String2Pointer(checkNameLength(v.SkuName, v.Weight, v.Unit)), - MemberPrice: utils.String2Pointer("0"), - SkuPrice: price, // 优先使用skuPrice 靠后SalePrice - SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice - CategoryCode: utils.String2Pointer(utils.Int2Str(v.CategoryID)), - MerchantCatCode: utils.String2Pointer(v.VendorCatID), // 优先使用 靠后 category_code - SubTitle: utils.String2Pointer("小时达"), + OuCode: utils.String2Pointer(vendorStoreID), + SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), + SkuName: utils.String2Pointer(checkNameLength(v.SkuName, v.Weight, v.Unit)), + SkuPrice: price, // 优先使用skuPrice 靠后SalePrice + CategoryCode: utils.String2Pointer(utils.Int2Str(v.CategoryID)), + MerchantCatCode: utils.String2Pointer(v.VendorCatID), // 优先使用 靠后 category_code + CleanSkuMemberPrice: utils.Int64ToPointer(model.YES), + SubTitle: utils.String2Pointer("小时达"), } if v.MinOrderCount <= model.YES { updateSku.PurchaseQuantity = utils.Int64ToPointer(model.YES) // 起购单位 @@ -299,9 +297,8 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku SubTitle: utils.String2Pointer("小时达"), SubTitle1: utils.String2Pointer("一小时速达"), //DeliveryUnit: utils.String2Pointer(storeSku.Unit), - DeliveryUnit: utils.String2Pointer("份"), - DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)), - //MemberPrice: price, + DeliveryUnit: utils.String2Pointer("份"), + DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)), Storage: utils.String2Pointer(tao_vegetable.CreateStorage), PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0 ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7 @@ -483,19 +480,6 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOfflineSaleFlag), } updateSkuList = append(updateSkuList, updateSku) - - //if (index+model.YES)%tao_vegetable.MAXHandleCount == model.NO || (index+1) == len(storeSkuList) { - // param.ParamList = &updateSkuList - // result, err := api.UpdateStoreSku(param) - // if err != nil { - // globals.SugarLogger.Debugf("UpdateStoreSku Tao Vegetable err : %s", err.Error()) - // } - // // 记录失败的同步数据 - // createFailedList, _ := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], "删除商品(暂无接口,下架处理)") - // failedList = append(failedList, createFailedList...) - // param.ParamList = nil - // updateSkuList = make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0) - //} } param.ParamList = &updateSkuList @@ -507,28 +491,6 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v createFailedList, _ := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], "删除商品(暂无接口,下架处理)") failedList = append(failedList, createFailedList...) return failedList, err - //param := &request.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - // StoreId: utils.String2Pointer(vendorStoreID), - // ChannelCode: utils.String2Pointer(tao_vegetable.TaoVegetableChannelCode), - // OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateIsOnline), - //}} - //var updateOffShelf = make([]tao_vegetable.VegetableResultList, 0, len(storeSkuList)) - //for _, v := range storeSkuList { - // param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(utils.Int2Str(v.SkuID)) - // // StoreSkuUpdateOffShelf 这个接口暂时有问题使用更新接口上下架 - // if err = getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID).StoreSkuUpdateOffShelf(param); err != nil { - // updateOffShelf = append(updateOffShelf, tao_vegetable.VegetableResultList{ - // ProductID: v.VendorSkuID, - // SkuID: utils.Int2Str(v.SkuID), - // ErrMsg: err.Error(), - // }) - // } - //} - //failedList, _ = SelectStoreSkuListByFoodList(storeSkuList, updateOffShelf, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], "批量删除商品(暂时下架,无删除接口)") - //if len(failedList) > 0 { - // err = nil - //} - //return failedList, err } // UpdateStoreSkusStatus 批量更新商品上下架状态 @@ -543,21 +505,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), OnlineSaleFlag: utils.Int64ToPointer(onlineStatus), SubTitle: utils.String2Pointer("小时达"), + //CleanSkuMemberPrice: utils.Int64ToPointer(model.YES), } updateSkuList = append(updateSkuList, updateSku) - - //if (index+model.YES)%tao_vegetable.MAXHandleCount == model.NO || (index+1) == len(storeSkuList) { - // param.ParamList = &updateSkuList - // result, err := api.UpdateStoreSku(param) - // if err != nil { - // globals.SugarLogger.Debugf("UpdateStoreSku Tao Vegetable err : %s", err.Error()) - // } - // // 记录失败的同步数据 - // createFailedList, _ := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], "批量更新商品上下架") - // failedList = append(failedList, createFailedList...) - // param.ParamList = nil - // updateSkuList = make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0) - //} } param.ParamList = &updateSkuList @@ -582,8 +532,6 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), SkuPrice: price, CleanSkuMemberPrice: utils.Int64ToPointer(model.YES), - SuggestedPrice: price, - MemberPrice: utils.String2Pointer("0"), SubTitle: utils.String2Pointer("小时达"), } updateSkuList = append(updateSkuList, updateSku) @@ -878,9 +826,8 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO api := getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID) for _, v := range storeSkuList { updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{ - OuCode: utils.String2Pointer(vendorStoreID), - SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), - SubTitle: utils.String2Pointer("小时达"), + OuCode: utils.String2Pointer(vendorStoreID), + SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)), } if v.IsSpecialty <= model.YES { updateSku.PurchaseQuantity = utils.Int64ToPointer(model.YES) @@ -889,21 +836,6 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO } updateSkuList = append(updateSkuList, updateSku) - //if (index+model.YES)%tao_vegetable.MAXHandleCount == model.NO || (index+1) == len(storeSkuList) { - // param.ParamList = &updateSkuList - // result, err := api.UpdateStoreSku(param) - // if err != nil { - // globals.SugarLogger.Debugf("UpdateStoreSku Tao Vegetable err : %s", err.Error()) - // } - // // 记录失败的同步数据 - // for _, v := range *result { - // if v.ErrMsg != "" { - // errList = append(errList, v.ErrMsg) - // } - // } - // param.ParamList = nil - // updateSkuList = make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0) - //} } param.ParamList = &updateSkuList result, err := api.UpdateStoreSku(param) From 7c7eef2469ba94f970ca0487c8f8f5cc4de6b9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Jul 2023 11:11:10 +0800 Subject: [PATCH 31/34] 1 --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index fb86567fa..70639c6db 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -419,7 +419,7 @@ func Init() { "07:30:00", "09:55:00", "10:40:00", - "11:55:00", + "11:20:00", "12:55:00", "13:30:00", "14:30:00", From af4060a6c4c44f10db4f7e419ebb1cbe0f03e1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Jul 2023 18:03:59 +0800 Subject: [PATCH 32/34] =?UTF-8?q?=E6=B7=98=E9=B2=9C=E8=BE=BE=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E4=BA=86=E6=B4=BB=E5=8A=A8=E5=90=8D=E7=A7=B0,?= =?UTF-8?q?=E6=88=91=E4=B9=9F=E5=8F=96=E6=B6=88=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 13 +++---------- business/partner/purchase/tao_vegetable/order.go | 9 ++++++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 70639c6db..50b067e09 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -358,7 +358,7 @@ func Init() { //103028, //103019, //102831, - 102751, + //102751, //上海 668462, 668276, @@ -411,27 +411,20 @@ func Init() { syncStoreSkuTao(beijin) }, []string{ "00:30:00", - "01:30:00", "02:30:00", - "03:30:00", "04:30:00", - "05:30:00", "07:30:00", - "09:55:00", + "09:00:00", "10:40:00", - "11:20:00", "12:55:00", "13:30:00", "14:30:00", "15:30:00", "16:30:00", "17:30:00", - "18:55:00", - "19:55:00", + "18:40:00", "20:30:00", - "21:30:00", "22:30:00", - "23:30:00", }) } diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index e6453aff7..afbdabf6f 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -132,17 +132,20 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve // 渠道活动 if v.ChannelActivityId != nil { activityId = append(activityId, utils.Str2Int64WithDefault(*v.ChannelActivityId, 999)) - activityName = append(activityName, *v.ChannelActivityId+":"+*v.ActivityName) + //activityName = append(activityName, *v.ChannelActivityId+":"+*v.ActivityName) + activityName = append(activityName, *v.ChannelActivityId) } // 业务活动 if v.BizActivityId != nil { activityId = append(activityId, utils.Str2Int64WithDefault(*v.BizActivityId, 999)) - activityName = append(activityName, *v.BizActivityId+":"+*v.ActivityName) + //activityName = append(activityName, *v.BizActivityId+":"+*v.ActivityName) + activityName = append(activityName, *v.BizActivityId) } // 商家erp活动 if v.MerchantActivityId != nil { activityId = append(activityId, utils.Str2Int64WithDefault(*v.MerchantActivityId, 999)) - activityName = append(activityName, *v.MerchantActivityId+":"+*v.ActivityName) + //activityName = append(activityName, *v.MerchantActivityId+":"+*v.ActivityName) + activityName = append(activityName, *v.MerchantActivityId) } } } From 3cc3fc5fc278ecf92349c0124167a8e32e5b8d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 26 Jul 2023 11:58:57 +0800 Subject: [PATCH 33/34] 1 --- business/partner/delivery/rider.go | 11 +++++++++-- business/partner/purchase/tao_vegetable/order_afs.go | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/business/partner/delivery/rider.go b/business/partner/delivery/rider.go index 46411c454..060125fb4 100644 --- a/business/partner/delivery/rider.go +++ b/business/partner/delivery/rider.go @@ -409,7 +409,14 @@ func UpdateFakeWayBillToTiktok() { // 设置骑手和下一状态时间 makeRiderInfo(fakeWayBill[i], riderInfo) - + if riderInfo.CourierName == "" && fakeWayBill[i].CourierName != "" { + riderInfo.CourierName = fakeWayBill[i].CourierName + riderInfo.CourierPhone = fakeWayBill[i].CourierMobile + } + if riderInfo.CourierName == "" && fakeWayBill[i].CourierName == "" { + riderInfo.CourierName = "石锋" + riderInfo.CourierPhone = "18048531223" + } if riderInfo.LogisticsContext != model.RiderGetOrderDeliverFailed && riderInfo.LogisticsContext != model.RiderGetOrderDeliverOther && riderInfo.LogisticsContext != model.RiderWaitRider { riderInfo.LogisticsContext = fmt.Sprintf(riderInfo.LogisticsContext, riderInfo.CourierName, riderInfo.CourierPhone) } @@ -452,7 +459,7 @@ func UpdateFakeWayBillToTiktok() { globals.SugarLogger.Debugf("UPDATA goods_order Err :%s", err.Error()) } // 饿百订单推送订单送达 - if fakeWayBill[i].OrderVendorID == model.VendorIDEBAI || fakeWayBill[i].OrderVendorID == model.VendorIDMTWM { + if fakeWayBill[i].OrderVendorID == model.VendorIDEBAI || fakeWayBill[i].OrderVendorID == model.VendorIDTaoVegetable || fakeWayBill[i].OrderVendorID == model.VendorIDMTWM { if err := handler.Swtich2SelfDelivered(order, "JingXiAdmin"); err != nil { globals.SugarLogger.Errorf("Swtich2SelfDelivered err := %v", err) } diff --git a/business/partner/purchase/tao_vegetable/order_afs.go b/business/partner/purchase/tao_vegetable/order_afs.go index c92529ce4..bf76c07aa 100644 --- a/business/partner/purchase/tao_vegetable/order_afs.go +++ b/business/partner/purchase/tao_vegetable/order_afs.go @@ -71,10 +71,10 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal var err error var db = dao.GetDB() orderStatus, scarceGoods := c.callbackAfsMsg2Status(status, msg) - // 用户取消售后 switch status { case tao_vegetable.OrderStatusApplyAfs: refundData := msg.(*tao_vegetable.UserApplyRefundCallBack) + globals.SugarLogger.Debugf("================OrderStatusApplyAfs : %s", utils.Format4Output(msg, false)) var afsOrder *model.AfsOrder var api = getAPI("", 0, refundData.StoreId) @@ -289,12 +289,14 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal if scarceGoods != nil { var afsOrder *model.AfsOrder refundSuccess := msg.(*tao_vegetable.RefundOrderFinish) + globals.SugarLogger.Debugf("================OrderStatusRefundSuccess : %s", utils.Format4Output(msg, false)) var api = getAPI("", 0, refundSuccess.StoreId) afsOrder = &model.AfsOrder{ VendorID: model.VendorIDTaoVegetable, AfsOrderID: refundSuccess.OutMainRefundId, VendorOrderID: orderStatus.RefVendorOrderID, + VendorOrderID2: refundSuccess.BizSubRefundId, VendorStoreID: refundSuccess.StoreId, StoreID: 0, AfsCreatedAt: orderStatus.StatusTime, From acde966cd9a77ef4b6d796b94971ec561d9cbb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 26 Jul 2023 15:15:02 +0800 Subject: [PATCH 34/34] 1 --- .../purchase/tao_vegetable/order_afs.go | 134 +++++++++++------- 1 file changed, 84 insertions(+), 50 deletions(-) diff --git a/business/partner/purchase/tao_vegetable/order_afs.go b/business/partner/purchase/tao_vegetable/order_afs.go index bf76c07aa..fae22479e 100644 --- a/business/partner/purchase/tao_vegetable/order_afs.go +++ b/business/partner/purchase/tao_vegetable/order_afs.go @@ -287,62 +287,96 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal case tao_vegetable.OrderStatusRefundSuccess: // 用户退款成功回调,缺货拣货时,送达回触发.此时并没有售后单 if scarceGoods != nil { - var afsOrder *model.AfsOrder refundSuccess := msg.(*tao_vegetable.RefundOrderFinish) - globals.SugarLogger.Debugf("================OrderStatusRefundSuccess : %s", utils.Format4Output(msg, false)) + var afsOrder *model.AfsOrder var api = getAPI("", 0, refundSuccess.StoreId) - - afsOrder = &model.AfsOrder{ - VendorID: model.VendorIDTaoVegetable, - AfsOrderID: refundSuccess.OutMainRefundId, - VendorOrderID: orderStatus.RefVendorOrderID, - VendorOrderID2: refundSuccess.BizSubRefundId, - VendorStoreID: refundSuccess.StoreId, - StoreID: 0, - AfsCreatedAt: orderStatus.StatusTime, - VendorAppealType: status, // 原始售后方式 - AppealType: model.AfsAppealTypeUserCancel, // 淘宝这个接口下发的只有用户取消 - VendorReasonType: tao_vegetable.OrderStatusOnSaleCancel, - ReasonType: 0, - ReasonDesc: "缺货调整,退款成功通知", - VendorOrgCode: api.GetVendorOrgCode(), + var isCreate = true + var outMainRefundIds = make(map[string]int64, 0) + detail, err := api.QueryAfsOrderDetail(&request591.AlibabaWdkOrderRefundGetRequest{ + OrderFrom: utils.Int64ToPointer(tao_vegetable.ChannelCome), + ShopId: nil, + StoreId: utils.String2Pointer(refundSuccess.StoreId), + RefundIds: &[]int64{utils.Str2Int64(refundSuccess.BizSubRefundId)}, + }) + if err != nil { + return tao_vegetable.CallBackResultInfo(err) + } + finalList, _ := dao.GetOrderRefundSkuList(db, []string{refundSuccess.OutMainRefundId}) + if len(finalList) != model.NO { + for _, f := range finalList { + for _, a := range *detail.Orders { + if f.SkuID == utils.Str2Int(*a.ItemCode) { + isCreate = false // 本地已经存在了记录 + outMainRefundIds[*a.OutMainRefundId] = *a.RefundAmount + } + } + } } - afsOrder.FreightUserMoney = 0 // 订单运费 - afsOrder.AfsFreightMoney = 0 // 暂时未发现退货取件费用 - afsOrder.BoxMoney = 0 // 餐盒费 - afsOrder.TongchengFreightMoney = 0 // 同城配送费 - afsOrder.SkuBoxMoney = 0 // 商品包装费 - afsOrder.VendorStatus = orderStatus.VendorStatus // 退货状态 - for _, v := range *scarceGoods { - var refundFee int64 = 0 - skuDetail := tao_vegetable.GoodsScarceRefund{} - if err := json.Unmarshal([]byte(*v.Attributes), &skuDetail); err != nil { - return tao_vegetable.CallBackResultInfo(err) + // 本地已经存在了售后记录,直接修改售后状态,否则创建售后记录 + if !isCreate { + for afsOrderId, afsMoney := range outMainRefundIds { + afs, _ := partner.CurOrderManager.LoadAfsOrder(afsOrderId, model.VendorIDTaoVegetable) + afs.VendorOrderID2 = refundSuccess.BizSubRefundId + afs.AfsFinishedAt = time.Now() + afs.Status = model.AfsOrderStatusFinished + afs.AfsTotalShopMoney = afsMoney + dao.UpdateEntity(db, afs, "VendorOrderID2", "AfsFinishedAt", "Status", "AfsTotalShopMoney") + } + } else { + afsOrder = &model.AfsOrder{ + VendorID: model.VendorIDTaoVegetable, + AfsOrderID: refundSuccess.OutMainRefundId, + VendorOrderID: orderStatus.RefVendorOrderID, + VendorOrderID2: refundSuccess.BizSubRefundId, + VendorStoreID: refundSuccess.StoreId, + StoreID: 0, + AfsCreatedAt: orderStatus.StatusTime, + VendorAppealType: status, // 原始售后方式 + AppealType: model.AfsAppealTypeUserCancel, // 淘宝这个接口下发的只有用户取消 + VendorReasonType: tao_vegetable.OrderStatusOnSaleCancel, + ReasonType: 0, + ReasonDesc: "缺货调整,退款成功通知", + VendorOrgCode: api.GetVendorOrgCode(), + } + afsOrder.FreightUserMoney = 0 // 订单运费 + afsOrder.AfsFreightMoney = 0 // 暂时未发现退货取件费用 + afsOrder.BoxMoney = 0 // 餐盒费 + afsOrder.TongchengFreightMoney = 0 // 同城配送费 + afsOrder.SkuBoxMoney = 0 // 商品包装费 + afsOrder.VendorStatus = orderStatus.VendorStatus // 退货状态 + + for _, v := range *scarceGoods { + var refundFee int64 = 0 + skuDetail := tao_vegetable.GoodsScarceRefund{} + if err := json.Unmarshal([]byte(*v.Attributes), &skuDetail); err != nil { + return tao_vegetable.CallBackResultInfo(err) + } + + orderSku := &model.OrderSkuFinancial{ + Count: utils.Float64TwoInt(utils.Str2Float64(*v.RefundQuantity)), + VendorSkuID: *v.SkuCode, + SkuID: utils.Str2Int(*v.SkuCode), + Name: skuDetail.SkuName, + UserMoney: *v.RefundAmount, + PmSkuSubsidyMoney: 0, // 平台补贴商品 + VendorOrderID: orderStatus.VendorOrderID, + VendorSubOrderID: *v.OutOrderId, + } + afsOrder.PmSkuSubsidyMoney += orderSku.PmSkuSubsidyMoney + afsOrder.Skus = append(afsOrder.Skus, orderSku) + refundFee += *v.RefundAmount + + afsOrder.SkuUserMoney += refundFee + afsOrder.RefundType = model.AfsTypePartRefund + if afsOrder != nil { + //直接就来一个新的售后单,并且还是售后完成的 + afsOrder.AfsFinishedAt = afsOrder.AfsCreatedAt + afsOrder.Flag = model.AfsOrderFlagAgreeUserRefund + err = partner.CurOrderManager.OnAfsOrderNew(afsOrder, orderStatus) + } } - orderSku := &model.OrderSkuFinancial{ - Count: utils.Float64TwoInt(utils.Str2Float64(*v.RefundQuantity)), - VendorSkuID: *v.SkuCode, - SkuID: utils.Str2Int(*v.SkuCode), - Name: skuDetail.SkuName, - UserMoney: *v.RefundAmount, - PmSkuSubsidyMoney: 0, // 平台补贴商品 - VendorOrderID: orderStatus.VendorOrderID, - VendorSubOrderID: *v.OutOrderId, - } - afsOrder.PmSkuSubsidyMoney += orderSku.PmSkuSubsidyMoney - afsOrder.Skus = append(afsOrder.Skus, orderSku) - refundFee += *v.RefundAmount - - afsOrder.SkuUserMoney += refundFee - afsOrder.RefundType = model.AfsTypePartRefund - if afsOrder != nil { - //直接就来一个新的售后单,并且还是售后完成的 - afsOrder.AfsFinishedAt = afsOrder.AfsCreatedAt - afsOrder.Flag = model.AfsOrderFlagAgreeUserRefund - err = partner.CurOrderManager.OnAfsOrderNew(afsOrder, orderStatus) - } } }