From 68abda7e58345fe53f63671fd5854986f1fa3d07 Mon Sep 17 00:00:00 2001 From: zhora Date: Sat, 11 Oct 2025 11:09:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=AF=E4=BB=98=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E6=9F=A5=E8=AF=A2;rtp=E8=AE=A1=E7=AE=97=E6=97=B6?= =?UTF-8?q?=E9=97=B4;=E9=A6=96=E5=85=85=E6=AC=A1=E6=95=B0=E5=85=B1?= =?UTF-8?q?=E4=BA=AB;=E5=85=85=E5=80=BC=E9=87=91=E9=A2=9D=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/config.go | 13 ++++++------- call/user.go | 4 ++++ .../handler/statistics/rechargeOrderList.go | 15 +++++++++++++-- modules/backend/models/db.go | 10 +++++----- modules/backend/values/statistics.go | 17 +++++++++-------- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/call/config.go b/call/config.go index 594dc9c..01c4e24 100644 --- a/call/config.go +++ b/call/config.go @@ -3,7 +3,6 @@ package call import ( "encoding/json" "errors" - "fmt" jsoniter "github.com/json-iterator/go" "net" "server/common" @@ -1473,12 +1472,12 @@ func GetConfigFirstPay() []*common.ConfigFirstPay { func GetConfigFirstPayByCount(amount int64, buyCountMap map[string]int) (times int, per int64, topThree bool) { var buyCount int if buyCountMap != nil { - // todo 一个额度一个首充计算 - buyCount = buyCountMap[fmt.Sprintf("%d", amount)] - //// todo 全部额度公用一个首充计算 - //for _, count := range buyCountMap { - // buyCount += count - //} + //// todo 一个额度一个首充计算 + //buyCount = buyCountMap[fmt.Sprintf("%d", amount)] + // todo 全部额度公用一个首充计算 + for _, count := range buyCountMap { + buyCount += count + } times = buyCount } for _, v := range configFirstPay { diff --git a/call/user.go b/call/user.go index bbd924b..4108f9c 100644 --- a/call/user.go +++ b/call/user.go @@ -888,6 +888,7 @@ func GetRtpControlV1(uid int, withdrawPer ...*int) int { if v := GetConfigPlatform().Rtp; v > 0 { rtp = v } + userInfo, _ := GetUserInfo(uid) rechargeInfo := GetRechargeInfo(uid) cash := GetUserCurrency(uid, common.CurrencyINR) // 当前现金 var withdrawRechargePer, personalRtp int64 @@ -908,6 +909,9 @@ func GetRtpControlV1(uid int, withdrawPer ...*int) int { } rechargeDay := int(math.Ceil(float64(time.Now().Unix()-rechargeInfo.FirstRecharge) / float64(24*60*60))) + if userInfo.Birth > 0 { // rtp计算时间改成用户的注册时间 + rechargeDay = int(math.Ceil(float64(time.Now().Unix()-userInfo.Birth) / float64(24*60*60))) + } rtpControls := GetConfigRtpControl() var rtpControl *common.ConfigRtpControl for _, v := range rtpControls { diff --git a/modules/backend/handler/statistics/rechargeOrderList.go b/modules/backend/handler/statistics/rechargeOrderList.go index 80a6509..e8bf3e6 100644 --- a/modules/backend/handler/statistics/rechargeOrderList.go +++ b/modules/backend/handler/statistics/rechargeOrderList.go @@ -35,9 +35,9 @@ func RechargeOrderList(c *gin.Context) { var str string if req.Status != nil && *req.Status == 2 { - str = fmt.Sprintf(" callback_time >= %d AND callback_time < %d AND event = %d ", su, eu, common.CurrencyEventReCharge) + str = fmt.Sprintf(" callback_time >= %d AND callback_time < %d AND event in (%d,%d) ", su, eu, common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard) } else { - str = fmt.Sprintf(" create_time >= %d AND create_time < %d AND event = %d ", su, eu, common.CurrencyEventReCharge) + str = fmt.Sprintf(" create_time >= %d AND create_time < %d AND event in (%d,%d) ", su, eu, common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard) } if req.Channel != nil { str += fmt.Sprintf(" AND channel_id = %d", *req.Channel) @@ -46,6 +46,17 @@ func RechargeOrderList(c *gin.Context) { str += fmt.Sprintf(" AND status = %d", *req.Status) } + if len(req.PayChannels) > 0 { + payChannelStr := "" + for _, v := range req.PayChannels { + if payChannelStr != "" { + payChannelStr += "," + } + payChannelStr += fmt.Sprintf("%d", v) + } + str += fmt.Sprintf(" AND pay_channel in (%s) ", payChannelStr) + } + queryOrder += " LEFT JOIN ( SELECT uid, COALESCE(SUM(amount), 0) AS totalAmount FROM recharge_order WHERE " + str + " GROUP BY uid) rm ON rm.uid = re.uid " if req.Birth != nil { diff --git a/modules/backend/models/db.go b/modules/backend/models/db.go index 0b475a5..825f8e0 100644 --- a/modules/backend/models/db.go +++ b/modules/backend/models/db.go @@ -1114,9 +1114,9 @@ func GetNewPayCountBySqls(s, e int64, channel ...*int) int64 { var temp int64 sql := fmt.Sprintf(`SELECT COUNT(u.id) AS count FROM users AS u inner JOIN - (select distinct(uid) from recharge_order WHERE event = %v AND status = %v AND callback_time >= %d AND callback_time < %d )as re + (select distinct(uid) from recharge_order WHERE event in (%v,%v) AND status = %v AND callback_time >= %d AND callback_time < %d )as re ON re.uid = u.id - where u.birth >= %d AND u.birth < %d`, common.CurrencyEventReCharge, common.StatusROrderPay, i, i+oneDay, i, i+oneDay) + 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...) } @@ -1308,8 +1308,8 @@ func GetAmountTotalBySQLs(s, e int64, channel ...*int) int64 { } sql := fmt.Sprintf(`SELECT IFNULL(SUM(amount),0) as RechargeAmount FROM recharge_order - WHERE event = %v and status = %v and callback_time >= %d and callback_time < %d `, - common.CurrencyEventReCharge, common.StatusROrderPay, s, e, + WHERE event in (%v,%v) and status = %v and callback_time >= %d and callback_time < %d `, + common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard, common.StatusROrderPay, s, e, ) if len(channel) > 0 { sql += PackChannels(channel...) @@ -1388,7 +1388,7 @@ func GetOrderCount(su, eu int64, status, opt int, channel ...*int) int64 { var model interface{} if opt == 1 { model = &common.RechargeOrder{} - condi = fmt.Sprintf("event = %d ", common.CurrencyEventReCharge) + condi = fmt.Sprintf("event in (%d,%d) ", common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard) } else { model = &common.WithdrawOrder{} condi = fmt.Sprintf("event = %d ", common.CurrencyEventWithDraw) diff --git a/modules/backend/values/statistics.go b/modules/backend/values/statistics.go index d4d0a24..0dd4e23 100644 --- a/modules/backend/values/statistics.go +++ b/modules/backend/values/statistics.go @@ -1151,14 +1151,15 @@ type OneWithdrawDetail struct { // Birth 生日 // Sort 排序 1:按创建时间排序 2:按历史充值排序 3:当前订单金额 type RechargeOrderListReq struct { - Channel *int `json:"Channel"` - Status *int `json:"Status"` - Start string `json:"Start" binding:"required"` - End string `json:"End" binding:"required"` - Page int `json:"Page" binding:"required"` - Num int `json:"Num" binding:"required"` - Birth *string `json:"Birth"` - Sort int `json:"Sort"` + Channel *int `json:"Channel"` + PayChannels []int `json:"PayChannels"` + Status *int `json:"Status"` + Start string `json:"Start" binding:"required"` + End string `json:"End" binding:"required"` + Page int `json:"Page" binding:"required"` + Num int `json:"Num" binding:"required"` + Birth *string `json:"Birth"` + Sort int `json:"Sort"` } type OneRechargeOrderList struct {