aa
This commit is contained in:
@@ -5,9 +5,15 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
|
||||
"github.com/astaxie/beego/plugins/authz"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
@@ -1747,3 +1753,47 @@ func GetVendorPopActDetail(ctx *jxcontext.Context, vendorID, storeID, actID int)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
func GetNewVendorPopActs(ctx *jxcontext.Context) (err error) {
|
||||
actList, err := api.EbaiAPI.GetMainActivityList(utils.Str2Int(ebai.EbaiSupplierIDhc))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
send := func(vendorID int, name1, name2 string) {
|
||||
var (
|
||||
roleList []*authz.RoleInfo
|
||||
opName = ""
|
||||
userIDs []string
|
||||
)
|
||||
if vendorID == model.VendorIDEBAI {
|
||||
opName = "lirongwei"
|
||||
} else {
|
||||
opName = "xiaoqiu"
|
||||
}
|
||||
roleList = append(roleList, autils.NewRole(opName, 0))
|
||||
if userIDMap, err := cms.GetRolesUserList(jxcontext.AdminCtx, roleList); err == nil {
|
||||
for _, v := range userIDMap {
|
||||
for _, vv := range v {
|
||||
userIDs = append(userIDs, vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, v := range userIDs {
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, v, model.VendorNames[vendorID]+"有新平台流量活动了!", model.VendorNames[vendorID]+"有未报名的平台流量活动,请查看!活动名:"+name1+"->"+name2)
|
||||
}
|
||||
}
|
||||
for _, v := range actList {
|
||||
results, _ := api.EbaiAPI.GetMainActivityDetail(int(v.ActivityID))
|
||||
for _, vv := range results {
|
||||
local, _ := time.LoadLocation("Local")
|
||||
t, _ := time.ParseInLocation("2006-01-02 15:04:05", vv.SigninEndTime, local)
|
||||
if time.Now().Sub(t) < 0 {
|
||||
result, _ := api.EbaiAPI.GetSubActivityDetail(int(vv.ID))
|
||||
if result.Status.Value == "NO_SIGN_UP" {
|
||||
send(model.VendorIDEBAI, vv.Name, result.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -283,6 +283,10 @@ func Init() {
|
||||
ScheduleTimerFunc("RefreshMTWMToken", func() {
|
||||
cms.RefreshMTWMToken(jxcontext.AdminCtx)
|
||||
}, updateActStatusTimeList)
|
||||
//获取最新平台流量活动
|
||||
ScheduleTimerFunc("GetVendorPopActs", func() {
|
||||
act.GetNewVendorPopActs(jxcontext.AdminCtx)
|
||||
}, dailyHeartbeat)
|
||||
}
|
||||
ScheduleTimerFunc("AutoSaleStoreSku", func() {
|
||||
cms.AutoSaleStoreSku(jxcontext.AdminCtx, nil, false)
|
||||
|
||||
Reference in New Issue
Block a user