diff --git a/call/pay.go b/call/pay.go index e8045d2..3cc832d 100644 --- a/call/pay.go +++ b/call/pay.go @@ -244,6 +244,8 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s // 正常商城充值 var bonus = r.Bonus discountOriginAmount := r.Amount // 折扣前的价格 + // todo 前面的topThree判断状态更新,后面的topThree判断打码量 + topThree = r.Times > 0 && r.Times <= 3 if r.ProductID != 0 { amount := PayExtra(r) // 判断特殊购买,如优惠券 if amount == 0 { diff --git a/modules/backend/handler/firstpage.go b/modules/backend/handler/firstpage.go index b655ef8..c4d5687 100644 --- a/modules/backend/handler/firstpage.go +++ b/modules/backend/handler/firstpage.go @@ -94,6 +94,9 @@ func GetFirstPageData(start, end int64, channels ...*int) *values.FirstPageData // 新增付费人数 ret.NewPayCount = models.GetNewPayCountBySqls(start, end, channels...) + // 新增付费复充人数 + ret.NewPayRepeatCount = models.GetNewPayRepeatCountBySqls(start, end, channels...) + // 付费总额 ret.RechargeTotal = models.GetAmountTotalBySQLs(start, end, channels...) diff --git a/modules/backend/handler/guser/editGameUserGold.go b/modules/backend/handler/guser/editGameUserGold.go index f193ef2..a402930 100644 --- a/modules/backend/handler/guser/editGameUserGold.go +++ b/modules/backend/handler/guser/editGameUserGold.go @@ -42,6 +42,35 @@ func EditGameUserGold(c *gin.Context) { a.RecordEdit(values.PowerGUser, fmt.Sprintf("修改玩家%v金币:%v", req.UID, req.Amount)) } +func EditGameUserBet(c *gin.Context) { + a := app.NewApp(c) + defer func() { + a.Response() + }() + req := new(values.EditGameUserBetReq) + if !a.S(req) { + return + } + user, _ := call.GetUserXInfo(req.UID, "channel_id") + update := &common.UpdateCurrency{ + CurrencyBalance: &common.CurrencyBalance{ + UID: req.UID, + Type: req.CurrencyType, + Event: common.CurrencyEventGM, + ChannelID: user.ChannelID, + NeedBet: req.BetAmount, + Exs1: "后台操作修改玩家打码量", + }, + } + err := call.MineCurrencyProReal(update).Err + if err != nil { + log.Error("err:%v", err) + a.Code = values.CodeRetry + return + } + a.RecordEdit(values.PowerGUser, fmt.Sprintf("修改玩家%v打码量:%v", req.UID, req.BetAmount)) +} + func EditGameUserRtp(c *gin.Context) { a := app.NewApp(c) defer func() { diff --git a/modules/backend/handler/statistics/platformData.go b/modules/backend/handler/statistics/platformData.go index 30666d1..d730897 100644 --- a/modules/backend/handler/statistics/platformData.go +++ b/modules/backend/handler/statistics/platformData.go @@ -134,6 +134,8 @@ func GetPlatformData(start, end int64, platform ...*int) *values.PlatformData { ret.NewRegisterPer = utils.GetPer(disNewCount, ret.DownloadCount) // 新增付费人数 ret.NewPayCount = models.GetNewPayCountBySqls(start, end, platform...) + // 新增付费复充人数 + ret.NewPayRepeatCount = models.GetNewPayRepeatCountBySqls(start, end, platform...) // 新增付费率 = 新增付费人数/新增注册人数 ret.NewPayPer = utils.GetPer(ret.NewPayCount, ret.NewCount) // 新增付费次数 diff --git a/modules/backend/handler/statistics/reviewAppSummary.go b/modules/backend/handler/statistics/reviewAppSummary.go index d2cb26c..2c7808d 100644 --- a/modules/backend/handler/statistics/reviewAppSummary.go +++ b/modules/backend/handler/statistics/reviewAppSummary.go @@ -104,6 +104,7 @@ func ReviewAppSummary(c *gin.Context) { resp.Total.DownloadCount = 0 // resp.Total.NewPlayCount = 0 resp.Total.NewPayCount = 0 + resp.Total.NewPayRepeatCount = 0 resp.Total.NewPayAmount = 0 // resp.Total.OldCount = 0 // resp.Total.OldPayCount = 0 @@ -122,6 +123,7 @@ func ReviewAppSummary(c *gin.Context) { resp.Total.DownloadCount += resp.PlatformData[i].DownloadCount // resp.Total.NewPlayCount += resp.PlatformData[i].NewPlayCount resp.Total.NewPayCount += resp.PlatformData[i].NewPayCount + resp.Total.NewPayRepeatCount += resp.PlatformData[i].NewPayRepeatCount resp.Total.NewPayAmount += resp.PlatformData[i].NewPayAmount // resp.Total.OldCount += resp.PlatformData[i].OldCount // resp.Total.OldPayCount += resp.PlatformData[i].OldPayCount diff --git a/modules/backend/handler/statistics/reviewData.go b/modules/backend/handler/statistics/reviewData.go index 53b9429..4dd9904 100644 --- a/modules/backend/handler/statistics/reviewData.go +++ b/modules/backend/handler/statistics/reviewData.go @@ -128,6 +128,7 @@ func ReviewData(c *gin.Context) { total.DownloadCount += one.DownloadCount // total.NewPlayCount += one.NewPlayCount total.NewPayCount += one.NewPayCount + total.NewPayRepeatCount += one.NewPayRepeatCount total.NewPayAmount += one.NewPayAmount // total.OldCount += one.OldCount // total.OldPayCount += one.OldPayCount @@ -263,6 +264,8 @@ func GetReviewPlatformData(start, end int64, platform ...*int) *values.ReviewDat // 新增付费人数 ret.NewPayCount = models.GetNewPayCountBySqls(start, end, platform...) + // 新增付费复充人数 + ret.NewPayRepeatCount = models.GetNewPayRepeatCountBySqls(start, end, platform...) // 新增付费率 = 新增付费人数/新增注册人数 ret.NewPayPer = utils.GetPer(ret.NewPayCount, ret.NewCount) // 首次付费人数 diff --git a/modules/backend/models/db.go b/modules/backend/models/db.go index 964bac9..9339dc4 100644 --- a/modules/backend/models/db.go +++ b/modules/backend/models/db.go @@ -1130,6 +1130,35 @@ func GetNewPayCountBySqls(s, e int64, channel ...*int) int64 { return count } +// 查询当天注册用户付费复充人数 +func GetNewPayRepeatCountBySqls(s, e int64, channel ...*int) int64 { + var oneDay int64 = 24 * 60 * 60 + var count int64 + + if e == s { + e += oneDay + } + + for i := s; i < e; i += oneDay { + var temp int64 + sql := fmt.Sprintf(`SELECT COUNT(u.id) AS count FROM users AS u + inner JOIN + (select uid from recharge_order WHERE event in (%v,%v) AND status = %v AND callback_time >= %d AND callback_time < %d GROUP BY uid HAVING COUNT(*) >= 2)as re + ON re.uid = u.id + where u.birth >= %d AND u.birth < %d`, common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard, common.StatusROrderPay, i, i+oneDay, i, i+oneDay) + if len(channel) > 0 { + sql += PackChannels(channel...) + } + err := db.Mysql().QueryBySql(sql, &temp) + if err != nil { + log.Error("查询当日新增付费复充人数失败, error : [%s]", err.Error()) + } + count += temp + } + + return count +} + // 查询新用户复充人数 func GetNewMultiPayCountBySqls(s, e int64, channel ...*int) int64 { var oneDay int64 = 24 * 60 * 60 diff --git a/modules/backend/routers/routers_guser.go b/modules/backend/routers/routers_guser.go index 600876a..1f9ffd0 100644 --- a/modules/backend/routers/routers_guser.go +++ b/modules/backend/routers/routers_guser.go @@ -19,6 +19,7 @@ func guser(e *gin.Engine) { e.POST("/guser/controlBalance", handler.GetGameUserControlBalance) // e.POST("/guser/controlCardData", handler.ControlCardData) e.POST("/guser/editGold", handler.EditGameUserGold) + e.POST("/guser/editBet", handler.EditGameUserBet) e.POST("/guser/editRtp", handler.EditGameUserRtp) e.POST("/guser/editStatus", handler.EditGameUserStatus) e.POST("/guser/addUserTag", handler.AddUserTag) diff --git a/modules/backend/values/gameuser.go b/modules/backend/values/gameuser.go index 0526baa..e695f95 100644 --- a/modules/backend/values/gameuser.go +++ b/modules/backend/values/gameuser.go @@ -455,6 +455,12 @@ type EditGameUserGoldReq struct { Amount int64 `json:"Amount" binding:"required"` } +type EditGameUserBetReq struct { + CurrencyType common.CurrencyType `json:"CurrencyType" binding:"required"` + UID int `json:"UID" binding:"required"` + BetAmount int64 `json:"BetAmount" binding:"required"` +} + type EditGameUserRtpReq struct { UID int `json:"UID" binding:"required"` Val int diff --git a/modules/backend/values/tables.go b/modules/backend/values/tables.go index 1be3aef..6699edc 100644 --- a/modules/backend/values/tables.go +++ b/modules/backend/values/tables.go @@ -63,6 +63,7 @@ type ReviewData struct { FirstPayCount int64 `gorm:"column:FirstPayCount;type:int(11);default:0;comment:首次付费人数"` FirstPayPer string `gorm:"column:FirstPayPer;type:varchar(64);default:'';comment:首充付费率"` NewPayCount int64 `gorm:"column:NewPayCount;type:int(11);default:0;comment:新增付费人数"` + NewPayRepeatCount int64 `gorm:"column:NewPayRepeatCount;default:0;type:int(11);comment:新增付费复充人数"` NewPayPer string `gorm:"column:NewPayPer;type:varchar(64);default:'';comment:新增付费率"` NewPayAmount int64 `gorm:"column:NewPayAmount;type:bigint(20);default:0;comment:新增付费金额"` ActivePayCount int64 `gorm:"column:ActivePayCount;type:int(11);default:0;comment:活跃付费人数"` @@ -92,6 +93,7 @@ type FirstPageData struct { PlatformID int `gorm:"column:PlatformID;type:int(11);uniqueIndex:tid;not null;comment:渠道号"` NewCount int64 `gorm:"column:NewCount;type:int(11);default:0;comment:新增人数"` NewPayCount int64 `gorm:"column:NewPayCount;type:int(11);default:0;comment:新增付费人数"` + NewPayRepeatCount int64 `gorm:"column:NewPayRepeatCount;default:0;type:int(11);comment:新增付费复充人数"` RechargeTotal int64 `gorm:"column:RechargeTotal;type:bigint(20);default:0;comment:总付费"` WithdrawTotal int64 `gorm:"column:WithdrawTotal;type:bigint(20);default:0;comment:总赠送"` RechargeOrderCreate int64 `gorm:"column:RechargeOrderCreate;type:int(11);default:0;comment:发起充值订单总数"` @@ -122,6 +124,7 @@ type PlatformData struct { NewCount int64 `gorm:"column:NewCount;type:int(11);default:0;comment:新增人数"` NewRegisterPer string `gorm:"column:NewRegisterPer;type:varchar(64);default:'';comment:新增注册率"` NewPayCount int64 `gorm:"column:NewPayCount;type:int(11);default:0;comment:新增付费人数"` + NewPayRepeatCount int64 `gorm:"column:NewPayRepeatCount;default:0;type:int(11);comment:新增付费复充人数"` NewPayPer string `gorm:"column:NewPayPer;type:varchar(64);default:'';comment:新增付费率"` NewPayCountAll int64 `gorm:"column:NewPayCountAll;type:int(11);default:0;comment:新增付费次数"` NewPayMultiPer string `gorm:"column:NewPayMultiPer;type:varchar(64);default:'';comment:新户复充率"`