印度包网
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.
 
 
 

96 lines
2.9 KiB

package statistics
import (
"server/modules/backend/app"
"server/modules/backend/models"
utils "server/modules/backend/util"
"server/modules/backend/values"
"github.com/gin-gonic/gin"
)
func PlayGameDataMillionGame(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.PlayGameDataReq)
if !a.S(req) {
return
}
resp := values.PlayMillionGameDataResp{}
su, eu := utils.GetQueryUnix(req.Start, req.End)
var oneDay int64 = 24 * 60 * 60
for i := su; i < eu; i += oneDay {
s := i
e := i + oneDay
resp.List = append(resp.List, getMillionGameStatisticsInfo(&s, &e, req.Channel, &req.GameId))
}
a.Data = resp
}
// 获取百人场统计数据
func getMillionGameStatisticsInfo(s, e *int64, channel *int, gameId *int) values.MillionStatisticsInfo {
var millionStatistics values.MillionStatisticsInfo
// 日期
millionStatistics.Date = *s
// 总人数
millionStatistics.PlayerCount = models.GetPlayerCount(s, e, channel, gameId, nil)
// 总局数
// GameCount := models.GetMillionGameTotal(s, e, channel, gameId, nil, nil)
// millionStatistics.GameCount = GameCount
// 总利润
// millionStatistics.Profit = models.GetMillionGameProfit(s, e, channel, nil, gameId, nil)
millionGameData := make(map[string]map[string]interface{})
// for i := 0; i < len(common.RoomIDs); i++ {
// gameData := make(map[string]interface{})
// for j := 0; j < len(common.MillionGameResult); j++ {
// result := strconv.Itoa(common.MillionGameResult[j])
// gameData[result] = getMillionStatisticsData(s, e, channel, gameId, &common.RoomIDs[i], &result, &GameCount)
// }
// millionGameData[strconv.Itoa(common.RoomIDs[i])] = gameData
// }
millionStatistics.MillionGameData = millionGameData
return millionStatistics
}
// func getMillionStatisticsData(s, e *int64, channel, gameId, roomID *int, result *string, gameCount *int64) interface{} {
// if result != nil && gameId != nil {
// if *result == "1" && *gameId == common.MillionGameIDs[2].(int) {
// data := make(map[string]int64)
// for i := 0; i < 8; i++ {
// if i == 0 {
// field := "TigerBet"
// data[strconv.Itoa(i)] = models.GetMillionBetCount(s, e, nil, channel, gameId, roomID, &field)
// continue
// }
// field := fmt.Sprintf("Bet%d", i+2)
// data[strconv.Itoa(i)] = models.GetMillionBetCount(s, e, nil, channel, gameId, roomID, &field)
// }
// return data
// } else {
// var res values.MillionGameStatisticsData
// var start int64 = 0
// gameTotal := models.GetMillionGameTotal(s, e, channel, gameId, roomID, result)
// res.GameCount = gameTotal
// res.WinPer = utils.GetPer(models.GetMillionGameProfitCount(s, e, channel, roomID, gameId, &start, result), gameTotal)
// res.GameCountPer = utils.GetPer(gameTotal, *gameCount)
// res.Balance = models.GetMillionGameProfit(s, e, channel, roomID, gameId, result)
// return res
// }
// }
// return nil
// }