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,6 +280,7 @@ func Init() {
// }, []string{"13:00:00"})
//}
// 淘鲜达更新门店商品 ,接口收费暂不使用
if beego.BConfig.RunMode != "jxgy" {
ScheduleTimerFunc("RefreshSyncSkuList_tao", func() {
var beijin = []int{
669158,
@@ -307,29 +308,6 @@ func Init() {
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,
@@ -384,24 +362,25 @@ func Init() {
}
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",
"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...)