This commit is contained in:
邹宗楠
2023-08-03 22:40:52 +08:00
parent 7d1bf776dc
commit f7d8836d6d

View File

@@ -164,125 +164,7 @@ func IsImportantTaskRunning(taskName string) bool {
return tasksch.IsTaskRunning(taskID) return tasksch.IsTaskRunning(taskID)
} }
func Init() { var hangzhou = []int{
if globals.IsProductEnv() {
//ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2)
//京东的订单信息解密密钥获取
ScheduleTimerFuncByInterval(func() {
jdshop.InitKey()
}, 5*time.Second, 8*time.Hour)
ScheduleTimerFuncByInterval(func() {
RefreshRealMobile(jxcontext.AdminCtx, model.VendorIDEBAI, time.Now().Add(-24*time.Hour), utils.DefaultTimeValue, false, true)
report.RefreshStoreManageState(jxcontext.AdminCtx, nil, []int{model.VendorIDJD})
}, 5*time.Second, 1*time.Hour)
// 每五分钟轮询一次推送骑手信息坐标给美团
ScheduleTimerFuncByInterval(func() {
delivery.GetOrderRiderInfoToPlatform("", 0)
}, 10*time.Second, 4*time.Minute)
//每天晚上23:00更新抖店 审核状态
ScheduleTimerFunc("UpdateStorePoiStatus", func() {
cms.UpdateStorePoiStatus(jxcontext.AdminCtx)
}, []string{
"22:00:00",
})
//每天晚上23:00获取门店 电子围栏、仓库、限售模板、运费模板ID同步进数据库
ScheduleTimerFunc("UpdateStoreRelInformation", func() {
cms.UpdateStoreRelInformation(jxcontext.AdminCtx)
}, []string{
"22:00:00",
})
// 更新抖店订单的结算信息
ScheduleTimerFunc("UpdateTiktokShopTotalMoney", func() {
orderman.UpdateTiktokShopTotalMoney()
}, []string{
"03:35:00",
"09:35:00",
})
/// 更新淘鲜达结算信息
ScheduleTimerFunc("UpdateTaoTotalMoney", func() {
orderman.UpdateTaoSettleInfo()
}, []string{
"18:10:00",
})
// 每分钟轮询一次,推送骑手信息
ScheduleTimerFuncByInterval(func() {
delivery.UpdateFakeWayBillToTiktok()
}, 10*time.Second, 5*time.Second)
// (自动发单拣货,设置骑手)
ScheduleTimerFuncByInterval(func() {
auto_delivery.Init() // 初始化骑手列表
auto_delivery.AutoSettingFakeDelivery()
}, 10*time.Second, 3*time.Minute)
// 定时任务更新负责人信息
ScheduleTimerFunc("RefreshStoreOperator", func() {
cms.UpdateStoreOperatorConfig()
}, []string{
"04:00:00",
})
// 每天更新美团-门店结算方式[结算给企业/结算给个人]
ScheduleTimerFunc("LoadingStoreOrderSettleAmount", func() {
delivery.LoadingStoreOrderSettleAmount(0, 0, nil)
}, []string{
"19:50:00",
})
ScheduleTimerFunc("UpdateStoreName ", func() {
cms.UpdateStoreName()
}, []string{
"13:35:00",
})
// 定时任务更新昨天的都要商品和本地商品id的映射关系
//ScheduleTimerFunc("RefreshStoreOperator", func() {
// t := time.Now()
// cms.SyncTiktokMainIdToLocal(jxcontext.AdminCtx, &tiktok_store.MainSku{
// AppOrgCode: "",
// CheckStatus: 3,
// StartTime: time.Date(t.Year(), t.Month(), t.Day()-1, 0, 0, 1, 0, time.Local).Unix(),
// EndTime: time.Date(t.Year(), t.Month(), t.Day()-1, 23, 59, 59, 0, time.Local).Unix(),
// Page: 1,
// PageSize: 100,
// })
//}, []string{
// "04:30:00",
//})
ScheduleTimerFuncByInterval(func() {
defsch.FixedScheduler.ConfirmSelfTakeOrders(jxcontext.AdminCtx, []int{model.VendorIDJD}, time.Now().Add(-48*time.Hour), time.Now().Add(-30*time.Minute), true, true)
}, 5*time.Second, 10*time.Minute)
ScheduleTimerFuncByInterval(func() {
report.RefreshStoreManageState(jxcontext.AdminCtx, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI})
}, 5*time.Second, 40*time.Minute)
ScheduleTimerFuncByInterval(func() {
orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-30*time.Minute), time.Now())
orderman.UpdateJdsOrdersStatus(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -1), time.Now())
}, 5*time.Second, 5*time.Minute)
ScheduleTimerFuncByInterval(func() {
curDate := utils.Time2Date(time.Now())
orderman.FixedOrderManager.AmendMissingOrders(jxcontext.AdminCtx, []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDDD}, 0, curDate, curDate, true, true)
}, 5*time.Second, 10*time.Minute)
// 抖音更新门店商品 ,接口收费暂不使用
//if beego.BConfig.RunMode != "jxgy" {
// ScheduleTimerFunc("RefreshSyncSkuList", func() {
// syncStoreSkuTiktok()
// }, []string{"13:00:00"})
//}
// 淘鲜达更新门店商品 ,接口收费暂不使用
ScheduleTimerFunc("RefreshSyncSkuListTao", func() {
var hangzhou = []int{
669113, 669113,
669111, 669111,
669110, 669110,
@@ -514,12 +396,131 @@ func Init() {
100126, 100126,
100123, 100123,
100115, 100115,
} }
func Init() {
if globals.IsProductEnv() {
//ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2)
//京东的订单信息解密密钥获取
ScheduleTimerFuncByInterval(func() {
jdshop.InitKey()
}, 5*time.Second, 8*time.Hour)
ScheduleTimerFuncByInterval(func() {
RefreshRealMobile(jxcontext.AdminCtx, model.VendorIDEBAI, time.Now().Add(-24*time.Hour), utils.DefaultTimeValue, false, true)
report.RefreshStoreManageState(jxcontext.AdminCtx, nil, []int{model.VendorIDJD})
}, 5*time.Second, 1*time.Hour)
// 每五分钟轮询一次推送骑手信息坐标给美团
ScheduleTimerFuncByInterval(func() {
delivery.GetOrderRiderInfoToPlatform("", 0)
}, 10*time.Second, 4*time.Minute)
//每天晚上23:00更新抖店 审核状态
ScheduleTimerFunc("UpdateStorePoiStatus", func() {
cms.UpdateStorePoiStatus(jxcontext.AdminCtx)
}, []string{
"22:00:00",
})
//每天晚上23:00获取门店 电子围栏、仓库、限售模板、运费模板ID同步进数据库
ScheduleTimerFunc("UpdateStoreRelInformation", func() {
cms.UpdateStoreRelInformation(jxcontext.AdminCtx)
}, []string{
"22:00:00",
})
// 更新抖店订单的结算信息
ScheduleTimerFunc("UpdateTiktokShopTotalMoney", func() {
orderman.UpdateTiktokShopTotalMoney()
}, []string{
"03:35:00",
"09:35:00",
})
/// 更新淘鲜达结算信息
ScheduleTimerFunc("UpdateTaoTotalMoney", func() {
orderman.UpdateTaoSettleInfo()
}, []string{
"18:10:00",
})
// 每分钟轮询一次,推送骑手信息
ScheduleTimerFuncByInterval(func() {
delivery.UpdateFakeWayBillToTiktok()
}, 10*time.Second, 5*time.Second)
// (自动发单拣货,设置骑手)
ScheduleTimerFuncByInterval(func() {
auto_delivery.Init() // 初始化骑手列表
auto_delivery.AutoSettingFakeDelivery()
}, 10*time.Second, 3*time.Minute)
// 定时任务更新负责人信息
ScheduleTimerFunc("RefreshStoreOperator", func() {
cms.UpdateStoreOperatorConfig()
}, []string{
"04:00:00",
})
// 每天更新美团-门店结算方式[结算给企业/结算给个人]
ScheduleTimerFunc("LoadingStoreOrderSettleAmount", func() {
delivery.LoadingStoreOrderSettleAmount(0, 0, nil)
}, []string{
"19:50:00",
})
ScheduleTimerFunc("UpdateStoreName ", func() {
cms.UpdateStoreName()
}, []string{
"13:35:00",
})
// 定时任务更新昨天的都要商品和本地商品id的映射关系
//ScheduleTimerFunc("RefreshStoreOperator", func() {
// t := time.Now()
// cms.SyncTiktokMainIdToLocal(jxcontext.AdminCtx, &tiktok_store.MainSku{
// AppOrgCode: "",
// CheckStatus: 3,
// StartTime: time.Date(t.Year(), t.Month(), t.Day()-1, 0, 0, 1, 0, time.Local).Unix(),
// EndTime: time.Date(t.Year(), t.Month(), t.Day()-1, 23, 59, 59, 0, time.Local).Unix(),
// Page: 1,
// PageSize: 100,
// })
//}, []string{
// "04:30:00",
//})
ScheduleTimerFuncByInterval(func() {
defsch.FixedScheduler.ConfirmSelfTakeOrders(jxcontext.AdminCtx, []int{model.VendorIDJD}, time.Now().Add(-48*time.Hour), time.Now().Add(-30*time.Minute), true, true)
}, 5*time.Second, 10*time.Minute)
ScheduleTimerFuncByInterval(func() {
report.RefreshStoreManageState(jxcontext.AdminCtx, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI})
}, 5*time.Second, 40*time.Minute)
ScheduleTimerFuncByInterval(func() {
orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-30*time.Minute), time.Now())
orderman.UpdateJdsOrdersStatus(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -1), time.Now())
}, 5*time.Second, 5*time.Minute)
ScheduleTimerFuncByInterval(func() {
curDate := utils.Time2Date(time.Now())
orderman.FixedOrderManager.AmendMissingOrders(jxcontext.AdminCtx, []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDDD}, 0, curDate, curDate, true, true)
}, 5*time.Second, 10*time.Minute)
// 抖音更新门店商品 ,接口收费暂不使用
//if beego.BConfig.RunMode != "jxgy" {
// ScheduleTimerFunc("RefreshSyncSkuList", func() {
// syncStoreSkuTiktok()
// }, []string{"13:00:00"})
//}
// 淘鲜达更新门店商品 ,接口收费暂不使用
ScheduleTimerFunc("RefreshSyncSkuListTao", func() {
syncStoreSkuTao(hangzhou) syncStoreSkuTao(hangzhou)
}, []string{ }, []string{
"18:50:00", "18:50:00",
"20:50:00", "20:50:00",
"22:28:00", "22:43:00",
"00:50:00", "00:50:00",
"02:50:00", "02:50:00",
"04:50:00", "04:50:00",