This commit is contained in:
邹宗楠
2023-07-21 15:01:09 +08:00
parent 874ffbc80d
commit 229ec09486
2 changed files with 106 additions and 128 deletions

View File

@@ -280,128 +280,107 @@ func Init() {
// }, []string{"13:00:00"}) // }, []string{"13:00:00"})
//} //}
// 淘鲜达更新门店商品 ,接口收费暂不使用 // 淘鲜达更新门店商品 ,接口收费暂不使用
ScheduleTimerFunc("RefreshSyncSkuList_tao", func() { if beego.BConfig.RunMode != "jxgy" {
var beijin = []int{ ScheduleTimerFunc("RefreshSyncSkuList_tao", func() {
669158, var beijin = []int{
668691, 669158,
668673, 668691,
668282, 668673,
667447, 668282,
667354, 667447,
667321, 667354,
667319, 667321,
667316, 667319,
667269, 667316,
667268, 667269,
667267, 667268,
667260, 667267,
667132, 667260,
667094, 667132,
667030, 667094,
666965, 667030,
666714, 666965,
666708, 666714,
666705, 666708,
103437, 666705,
103349, 103437,
103123, 103349,
103121, 103123,
103106, 103121,
} 103106,
syncStoreSkuTao(beijin) 103038,
}, []string{ 103028,
"00:30:00", 103019,
"01:30:00", 102831,
"02:30:00", 102751,
"03:30:00", 102683,
"04:30:00", 102542,
"05:30:00", 102514,
"07:30:00", 102382,
"09:30:00", 102182,
"12:30:00", 102178,
"13:30:00", 102173,
"15:30:00", 102098,
"17:30:00", 102094,
"18:30:00", 102080,
"20:30:00", 102072,
"21:30:00", 102069,
"22:30:00", 101870,
"23:30:00", 101869,
}) 101868,
ScheduleTimerFunc("RefreshSyncSkuList_tao2", func() { 101867,
var beijin = []int{ 101866,
103038, 101865,
103028, 100956,
103019, 100930,
102831, 100871,
102751, 100786,
102683, 100746,
102542, 100744,
102514, 100726,
102382, 100705,
102182, 100400,
102178, 100111,
102173, 100108,
102098, 100106,
102094, 100104,
102080, 100103,
102072, 100102,
102069, 100100,
101870, 100097,
101869, 100096,
101868, 100095,
101867, 100093,
101866, 100092,
101865, 100089,
100956, 100087,
100930, 100086,
100871, 100085,
100786, 100082,
100746, 100079,
100744, 100078,
100726, }
100705, syncStoreSkuTao(beijin)
100400, }, []string{
100111, "00:30:00",
100108, "01:30:00",
100106, "02:30:00",
100104, "03:30:00",
100103, "04:30:00",
100102, "05:30:00",
100100, "07:30:00",
100097, "09:30:00",
100096, "12:30:00",
100095, "13:30:00",
100093, "15:30:00",
100092, "17:30:00",
100089, "18:30:00",
100087, "20:30:00",
100086, "21:30:00",
100085, "22:30:00",
100082, "23:30:00",
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",
})
// 刷新抖音门店token // 刷新抖音门店token
if beego.BConfig.RunMode != "jxgy" { if beego.BConfig.RunMode != "jxgy" {
@@ -757,6 +736,7 @@ func syncStoreSkuTiktok() {
tasksch.HandleTask(task, nil, true).Run() tasksch.HandleTask(task, nil, true).Run()
} }
var SyncLen = 0 // 同步步长
// syncStoreSkuTao 同步商品到淘鲜达 // syncStoreSkuTao 同步商品到淘鲜达
func syncStoreSkuTao(beijin []int) { func syncStoreSkuTao(beijin []int) {
syncFlag := 0 syncFlag := 0
@@ -768,9 +748,8 @@ func syncStoreSkuTao(beijin []int) {
switch step { switch step {
case 0: case 0:
if beego.BConfig.RunMode != "jxgy" { 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[SyncLen:SyncLen+5], false, nil, nil, syncFlag, true, true)
globals.SugarLogger.Debugf("=============淘鲜达自动同步商品数据 := %s", utils.Format4Output(beijin, false)) SyncLen += 5
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDTaoVegetable}, beijin, false, nil, nil, syncFlag, true, true)
errList.AddErr(err) errList.AddErr(err)
} }
case 1: case 1:

View File

@@ -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) { 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) failedList, err = p.createOrUpdateStoreSkus(ctx, storeID, vendorStoreID, storeSkuList, true)
return failedList, err 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) { 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{} createPram := &request585.AlibabaWdkSkuAddRequest{}
param := make([]domain585.AlibabaWdkSkuAddSkuDo, 0, 0) param := make([]domain585.AlibabaWdkSkuAddSkuDo, 0, 0)
//totalCount := len(storeSkuList)
vendorSkuIdMap := make(map[string]string, 0) vendorSkuIdMap := make(map[string]string, 0)
globals.SugarLogger.Debugf("storeSkuList := %d", len(storeSkuList))
for _, storeSku := range storeSkuList { for _, storeSku := range storeSkuList {
price := utils.String2Pointer(utils.Float64ToStr(utils.Int64ToFloat64(storeSku.VendorPrice) / utils.Int64ToFloat64(100))) price := utils.String2Pointer(utils.Float64ToStr(utils.Int64ToFloat64(storeSku.VendorPrice) / utils.Int64ToFloat64(100)))
sku := domain585.AlibabaWdkSkuAddSkuDo{ sku := domain585.AlibabaWdkSkuAddSkuDo{
@@ -377,6 +374,8 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
if err != nil { if err != nil {
globals.SugarLogger.Debugf("创建淘鲜达商品异常:%s", err.Error()) 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) failedList2, vendorSkuIdMap2 := SelectStoreSkuListByFoodList(storeSkuList, *result, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], syncType)
failedList = append(failedList, failedList2...) failedList = append(failedList, failedList2...)