diff --git a/worldsrv/player.go b/worldsrv/player.go index 3e51cad..9810d63 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -4377,12 +4377,11 @@ func (this *Player) PhoneLotteryTask(taskId int32, num int64) { } } -func (this *Player) InviteTask(scoreType int32, gameId int32, n int64) { - if this.PSnId == 0 { +func InviteTask(platform string, psnid, snid, scoreType int32, n int64) { + if psnid <= 0 || snid <= 0 { return } - - cfg := PlatformMgrSingleton.GetConfig(this.Platform).ActInviteConfig + cfg := PlatformMgrSingleton.GetConfig(platform).ActInviteConfig switch scoreType { case common.InviteScoreTypeBind: @@ -4391,9 +4390,9 @@ func (this *Player) InviteTask(scoreType int32, gameId int32, n int64) { score, ok := cfg.GetPayScore()[n] if ok { SaveInviteScore(&model.InviteScore{ - Platform: this.Platform, - SnId: this.SnId, - InviteSnId: this.PSnId, + Platform: platform, + SnId: snid, + InviteSnId: psnid, Tp: scoreType, Score: score, Ts: time.Now().Unix(), @@ -4401,9 +4400,9 @@ func (this *Player) InviteTask(scoreType int32, gameId int32, n int64) { }) } else { SaveInviteScore(&model.InviteScore{ - Platform: this.Platform, - SnId: this.SnId, - InviteSnId: this.PSnId, + Platform: platform, + SnId: snid, + InviteSnId: psnid, Tp: common.InviteScoreTypeRecharge, Score: cfg.GetRechargeScore(), Ts: time.Now().Unix(), diff --git a/worldsrv/taskmgr.go b/worldsrv/taskmgr.go index 3732a31..1b4320d 100644 --- a/worldsrv/taskmgr.go +++ b/worldsrv/taskmgr.go @@ -101,7 +101,6 @@ func (t *TaskHandle) TaskUpdate(id int, data any) { case common.TaskTypePay: // 玩家充值 p.PhoneLotteryTask(common.TaskTypePay, num) - p.InviteTask(common.InviteScoreTypePay, int32(info.GameID), num) case common.TaskTypeWinOrLose: // 游戏输赢金币数量 p.PhoneLotteryTask(common.TaskTypeWinOrLose, num) diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 9659207..c21e466 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -1708,6 +1708,7 @@ func init() { SnId: player.SnId, Num: money, }) + InviteTask(msg.Platform, player.PSnId, player.SnId, common.InviteScoreTypePay, money) } player.SendDiffData() } @@ -1781,6 +1782,7 @@ func init() { logger.Logger.Errorf("model.InsertDbShopLog err:%v.", err) return nil } + InviteTask(msg.Platform, findPlayer.PSnId, findPlayer.SnId, common.InviteScoreTypePay, money) } //账变记录 @@ -4160,10 +4162,17 @@ func init() { SnId: player.SnId, Num: int64(info.ConsumeNum), }) + InviteTask(msg.Platform, player.PSnId, player.SnId, common.InviteScoreTypePay, int64(info.ConsumeNum)) } else { if state == 1 { state = 3 } + psnid, err := model.GetPlayerInviteSnid(msg.Platform, info.SnId) + if err != nil { + logger.Logger.Error("UpdateDbShopState.err:", err) + return err + } + InviteTask(msg.Platform, psnid, info.SnId, common.InviteScoreTypePay, int64(info.ConsumeNum)) } err := model.UpdateDbShopState(msg.Platform, msg.OrderId, state) if err != nil {