From 15c785b8ffa66c27d8896bfb788992565aa5925d Mon Sep 17 00:00:00 2001 From: mofangmin Date: Tue, 16 Jul 2024 14:32:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B4=BB=E5=8A=A8=E9=82=80?= =?UTF-8?q?=E8=AF=B7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/share.go | 6 ++++-- common/share.go | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/call/share.go b/call/share.go index 9a31850..0fb8d1b 100644 --- a/call/share.go +++ b/call/share.go @@ -32,12 +32,14 @@ func ShareBind(share string, isOld bool, uid, cid int) { if share == "" || isOld { return } + activityId := 0 now := time.Now().Unix() codeInfo := &common.ShareActivityCode{ShareCode: share} upInfo := &common.ShareInfo{} db.Mysql().Get(codeInfo) if codeInfo.Id > 0 { upInfo.UID = codeInfo.UID + activityId = codeInfo.ActivityId // 判断是否过期 if now < codeInfo.ExpireAt { util.Go(func() { @@ -52,14 +54,14 @@ func ShareBind(share string, isOld bool, uid, cid int) { if upInfo.ID <= 0 { return } - shareInfo := &common.ShareInfo{UID: uid, UP1: upInfo.UID, UP2: upInfo.UP1, UP3: upInfo.UP2, Time: time.Now().Unix(), ChannelID: cid, Share: util.GetShareCode(uid)} + shareInfo := &common.ShareInfo{UID: uid, UP1: upInfo.UID, UP2: upInfo.UP1, UP3: upInfo.UP2, Time: time.Now().Unix(), ChannelID: cid, Share: util.GetShareCode(uid), ActivityId: activityId} db.Mysql().Create(shareInfo) // 更新上级邀请玩家数 db.Mysql().Update(&common.ShareInfo{UID: upInfo.UID}, map[string]interface{}{"invites": gorm.Expr("invites + 1")}) // 完成邀请任务 - CheckTask(Task{Uid: uid, Value: 1, Types: []common.TaskType{common.TaskTypeInvite}}) + CheckTask(Task{Uid: upInfo.UID, Value: 1, Types: []common.TaskType{common.TaskTypeInvite}}) } // 判断分享,发放有效用户奖励 diff --git a/common/share.go b/common/share.go index c6f8ba2..bcf06a4 100644 --- a/common/share.go +++ b/common/share.go @@ -42,6 +42,7 @@ type ShareInfo struct { BetReward int64 `gorm:"column:bet_reward;type:bigint(20);default:0;comment:邀请人下注获得的金额"` AvailableReward int64 `gorm:"column:available_reward;type:bigint(20);default:0;comment:可支配佣金"` Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:加入的时间"` + ActivityId int `gorm:"column:activity_id;type:int(11);default:0;comment:来自于哪个分享活动"` } // 绑定关系