You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
|
1 year ago
|
package guser
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
"github.com/liangdas/mqant/log"
|
||
|
|
"server/common"
|
||
|
|
"server/db"
|
||
|
|
"server/modules/backend/models"
|
||
|
|
utils "server/modules/backend/util"
|
||
|
|
"server/modules/backend/values"
|
||
|
|
"server/modules/customer/app"
|
||
|
|
)
|
||
|
|
|
||
|
|
func GetGameUserControlBalance(c *gin.Context) {
|
||
|
|
a := app.NewApp(c)
|
||
|
|
defer func() {
|
||
|
|
a.Response()
|
||
|
|
}()
|
||
|
|
req := new(values.GetGameUserControlBalanceReq)
|
||
|
|
if !a.S(req) {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
resp := values.GetGameUserControlBalanceResp{
|
||
|
|
List: []common.CurrencyBalance{},
|
||
|
|
}
|
||
|
|
s, e := utils.GetQueryUnix(req.Start, req.End)
|
||
|
|
count, err := db.ES().QueryPlayerControlBalance(req.UID, req.Page-1, req.Num, &s, &e, &resp.List, req.ControlType)
|
||
|
|
if err != nil {
|
||
|
|
log.Error("err:%v", err)
|
||
|
|
a.Code = values.CodeRetry
|
||
|
|
return
|
||
|
|
}
|
||
|
|
resp.Count = count
|
||
|
|
|
||
|
|
event := int(common.CurrencyEventGameSettle)
|
||
|
|
// 查询控杀次数
|
||
|
|
resp.ControlCount = models.GetControlCount(&s, &e, &req.UID, &event, false)
|
||
|
|
loseCount := models.GetControlCount(&s, &e, &req.UID, &event, true)
|
||
|
|
resp.ControlPer = utils.GetPer(loseCount, resp.ControlCount)
|
||
|
|
|
||
|
|
// 幸运次数
|
||
|
|
resp.LuckCount = models.GetLuckCount(&s, &e, &req.UID, nil, &event, false, false)
|
||
|
|
winCount := models.GetLuckCount(&s, &e, &req.UID, nil, &event, true, false)
|
||
|
|
resp.LuckPer = utils.GetPer(winCount, resp.LuckCount)
|
||
|
|
|
||
|
|
a.Data = resp
|
||
|
|
}
|