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"})
//}
// 淘鲜达更新门店商品 ,接口收费暂不使用
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:

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) {
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...)