This commit is contained in:
邹宗楠
2023-07-14 16:01:20 +08:00
parent f27844567a
commit 0e1cd858d5
10 changed files with 245 additions and 64 deletions

View File

@@ -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,
}
dao.CreateEntity(db, actVendor)
//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)
//}
}
}
}
@@ -2161,10 +2161,30 @@ func RrefreshEbaiVendorAct(ctx *jxcontext.Context) (err error) {
return err
}
// GetActMtwmVendor 查询美团平台活动
func GetActMtwmVendor(ctx *jxcontext.Context, storeIDs, skuIDs []int, keyword, beginAt, endAt string, actType, offset, pageSize int) (page *model.PagedInfo, err error) {
return dao.GetActMtwmVendorPage(dao.GetDB(), storeIDs, skuIDs, keyword, utils.Str2Time(beginAt), utils.Str2Time(endAt), actType, offset, pageSize)
}
// GetStoreNotHaveSku 根据输入的商品id判断,那些门店没有参数该活动
func GetStoreNotHaveSku(skuId int, offSet, pageSize int) (interface{}, error) {
var (
db = dao.GetDB()
)
haveActSku, err := dao.GetActMtwmVendorPage(db, nil, []int{skuId}, "", time.Time{}, time.Time{}, 0, 0, 2000)
if err != nil {
return nil, err
}
// 拥有此商品的门店
storeIds := make([]int, 0, 0)
for _, v := range haveActSku.Data.([]*model.ActMtwmVendor) {
storeIds = append(storeIds, v.StoreID)
}
return dao.GetDontHaveSku(db, storeIds, offSet, pageSize)
}
func GetActMtwmVendorSku(ctx *jxcontext.Context, storeID int, keyword string, actType, offset, pageSize int) (page *model.PagedInfo, err error) {
return dao.GetActMtwmVendorSkuPage(dao.GetDB(), storeID, keyword, actType, offset, pageSize)
}

View File

@@ -676,7 +676,6 @@ func (v *VendorSync) AmendAndPruneStoreStuff(ctx *jxcontext.Context, vendorIDs [
func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.ITask, db *dao.DaoDB, taskName string, isAsync, isManageIt bool, vendorIDs []int, storeIDs []int, mustDirty bool, handler tasksch.WorkFunc, isContinueWhenError bool) (task tasksch.ITask, hint string, err error) {
var storeMapList []*model.StoreMap
//stores, _ := dao.GetStoresMapList(db, []int{model.VendorIDMTWM, model.VendorIDJD, model.VendorIDEBAI}, nil, []int{model.StoreStatusOpened, model.StoreStatusHaveRest}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
if storeMapList, err = dao.GetStoresMapList2(db, vendorIDs, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncYes, "", "", "", mustDirty); err != nil {
return nil, "", err
}

View File

@@ -202,6 +202,12 @@ func Init() {
"03:35:00",
"09:35:00",
})
/// 更新淘鲜达结算信息
ScheduleTimerFunc("UpdateTiktokShopTotalMoney", func() {
orderman.UpdateTaoSettleInfo()
}, []string{
"23:20:00",
})
// 每分钟轮询一次,推送骑手信息
ScheduleTimerFuncByInterval(func() {
@@ -273,8 +279,14 @@ func Init() {
// syncStoreSkuTiktok()
// }, []string{"13:00:00"})
//}
// 抖音更新门店商品 ,接口收费暂不使用
if beego.BConfig.RunMode != "jxgy" {
ScheduleTimerFunc("RefreshSyncSkuList_tao", func() {
syncStoreSkuTao()
}, []string{"13:00:00"})
}
//刷新抖音门店token
// 刷新抖音门店token
if beego.BConfig.RunMode != "jxgy" {
ScheduleTimerFuncByInterval(func() {
cms.RefreshTiktokShopToken(jxcontext.AdminCtx)
@@ -614,8 +626,6 @@ func syncStoreSkuTiktok() {
switch step {
case 0:
if beego.BConfig.RunMode != "jxgy" {
errList.AddErr(cms.DeleteSkuNameExPrefixOverdue(db))
errList.AddErr(cms.SetMultiStoreSkuSyncModifyStatus(db, partner.GetMultiStoreVendorIDs()))
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDDD}, nil, false, nil, nil, syncFlag, true, true)
errList.AddErr(err)
}
@@ -630,6 +640,31 @@ func syncStoreSkuTiktok() {
tasksch.HandleTask(task, nil, true).Run()
}
// syncStoreSkuTao 同步商品到淘鲜达
func syncStoreSkuTao() {
syncFlag := 0
task := tasksch.NewParallelTask("同步京西商品到淘鲜达平台,方案二使用", nil, jxcontext.AdminCtx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
step := batchItemList[0].(int)
errList := errlist.New()
db := dao.GetDB()
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)
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})
tasksch.HandleTask(task, nil, true).Run()
}
func doDailyWork2() {
if beego.BConfig.RunMode == "jxgy" {
syncStoreSku()