From c56500548c37e0efeabc1ec5b93f6cc4ae498948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 29 Mar 2021 18:30:07 +0800 Subject: [PATCH] aa --- business/jxstore/act/act.go | 50 +++++++++++++++++++++++++++++++++++ business/jxstore/misc/misc.go | 4 +++ 2 files changed, 54 insertions(+) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 9d7881b8b..873d1fd4f 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -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 +} diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 6e3ecd1ca..2ccf1b11d 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -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)