完善数据上报,每日支付任务认证
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
ea "github.com/earn-alliance/earnalliance-go"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"nova_task/internal/consts"
|
||||
"nova_task/internal/svc"
|
||||
)
|
||||
|
||||
@@ -25,8 +26,13 @@ func (e *Earn) Spec() string {
|
||||
}
|
||||
|
||||
func (e *Earn) Run() {
|
||||
e.pushUserInfo(666)
|
||||
e.pushUserBind()
|
||||
c, err := e.svcCtx.ConfigModel.FindOneByName(e.ctx, consts.EarnAllianceInviterId)
|
||||
if err != nil {
|
||||
logx.Errorw("find earn alliance inviter id failed", logx.Field("err", err))
|
||||
return
|
||||
}
|
||||
e.pushUserInfo(cast.ToUint(c.Value))
|
||||
e.pushUserBind(cast.ToUint(c.Value))
|
||||
}
|
||||
|
||||
func (e *Earn) pushUserInfo(shareId uint) {
|
||||
@@ -54,8 +60,25 @@ func (e *Earn) pushUserInfo(shareId uint) {
|
||||
err = e.svcCtx.PromoteBindModel.UpdatePushUser(e.ctx, u.Id)
|
||||
if err != nil {
|
||||
logx.Errorw("update push user failed", logx.Field("err", err), logx.Field("uid", u.InvitedUid))
|
||||
} else {
|
||||
logx.Infow("push user info success", logx.Field("uid", u.InvitedUid))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Earn) pushUserBind() {}
|
||||
func (e *Earn) pushUserBind(shareId uint) {
|
||||
us, err := e.svcCtx.TouristBindModel.FindRequirePushUser(e.ctx, shareId)
|
||||
if err != nil {
|
||||
logx.Errorw("find require push bind role user failed", logx.Field("err", err), logx.Field("share_id", shareId))
|
||||
return
|
||||
}
|
||||
for _, u := range us {
|
||||
e.svcCtx.Earn.Track(cast.ToString(u.Uid), "BIND_ROLE", nil, nil)
|
||||
err = e.svcCtx.PromoteBindModel.UpdatePushRole(e.ctx, u.Id)
|
||||
if err != nil {
|
||||
logx.Errorw("update push user failed", logx.Field("err", err), logx.Field("uid", u.Uid))
|
||||
} else {
|
||||
logx.Infow("push user info success", logx.Field("uid", u.Uid))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user