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.
49 lines
1.2 KiB
49 lines
1.2 KiB
|
1 year ago
|
package guser
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
"server/common"
|
||
|
|
"server/modules/backend/models"
|
||
|
|
utils "server/modules/backend/util"
|
||
|
|
"server/modules/backend/values"
|
||
|
|
"server/modules/customer/app"
|
||
|
|
)
|
||
|
|
|
||
|
|
func LostUserDetail(c *gin.Context) {
|
||
|
|
a := app.NewApp(c)
|
||
|
|
defer func() {
|
||
|
|
a.Response()
|
||
|
|
}()
|
||
|
|
req := new(values.LostUserDetailReq)
|
||
|
|
if !a.S(req) {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
resp := values.LostUserDetailResp{}
|
||
|
|
|
||
|
|
for i := 0; i < len(common.RoomGameIDs); i++ {
|
||
|
|
resp.List = append(resp.List, getLostUserDetail(req.Uid, common.RoomGameIDs[i]))
|
||
|
|
}
|
||
|
|
|
||
|
|
for i := 0; i < len(common.MillionGameIDs); i++ {
|
||
|
|
resp.List = append(resp.List, getLostUserDetail(req.Uid, common.MillionGameIDs[i].(int)))
|
||
|
|
}
|
||
|
|
|
||
|
|
a.Data = resp
|
||
|
|
}
|
||
|
|
|
||
|
|
func getLostUserDetail(uid int, gameId int) values.LostUserDetail {
|
||
|
|
var lostUserDetail values.LostUserDetail
|
||
|
|
|
||
|
|
lostUserDetail.GameId = gameId
|
||
|
|
|
||
|
|
isWin := true
|
||
|
|
winCount := models.GetWinGameCountByBalance(nil, nil, &uid, nil, &gameId, nil, &isWin)
|
||
|
|
lostUserDetail.GameCount = models.GetGameCountByBalance(nil, nil, &uid, nil, &gameId, nil)
|
||
|
|
|
||
|
|
lostUserDetail.WinPer = utils.GetPer(winCount, lostUserDetail.GameCount)
|
||
|
|
|
||
|
|
lostUserDetail.BreakPer = utils.GetPer(models.GetPlayerBreakCount(nil, nil, &uid, &gameId, nil, nil), lostUserDetail.GameCount)
|
||
|
|
|
||
|
|
return lostUserDetail
|
||
|
|
}
|