This commit is contained in:
邹宗楠
2023-07-19 18:11:31 +08:00
parent 039f1b5bab
commit 76d1ce7aea
3 changed files with 177 additions and 22 deletions

View File

@@ -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)
}

View File

@@ -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})

View File

@@ -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 = &param
// 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 = &param
result, err := api.AddStoreSku(createPram)