|
|
|
|
package handler
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"math/rand"
|
|
|
|
|
"server/call"
|
|
|
|
|
"server/common"
|
|
|
|
|
"server/db"
|
|
|
|
|
"server/modules/web/app"
|
|
|
|
|
"server/modules/web/values"
|
|
|
|
|
"server/util"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/olivere/elastic/v7"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func FirstPage(c *gin.Context) {
|
|
|
|
|
a := app.NewApp(c)
|
|
|
|
|
defer func() {
|
|
|
|
|
a.Response()
|
|
|
|
|
}()
|
|
|
|
|
req := new(values.FirstPageReq)
|
|
|
|
|
if !a.S(req) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
uuid := a.UUID
|
|
|
|
|
cid := a.Channel
|
|
|
|
|
if len(uuid) > 0 {
|
|
|
|
|
// 处理一下新增安装
|
|
|
|
|
util.Go(func() {
|
|
|
|
|
q := elastic.NewBoolQuery()
|
|
|
|
|
q.Filter(elastic.NewTermsQuery("UUID.keyword", uuid))
|
|
|
|
|
q.Filter(elastic.NewTermQuery("Channel", cid))
|
|
|
|
|
if db.ES().Count(common.ESIndexBackOpenRecord, q) > 0 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
id := fmt.Sprintf("%v_%v", cid, uuid)
|
|
|
|
|
db.ES().InsertToESByIDGO(common.ESIndexBackOpenRecord, id, &common.ESOpenRecord{Time: time.Now().Unix(), UUID: uuid, Channel: cid})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resp := &values.FirstPageResp{}
|
|
|
|
|
a.Data = resp
|
|
|
|
|
a.GetUID()
|
|
|
|
|
resp.Activitys = call.GetConfigBanner(a.UID)
|
|
|
|
|
resp.GameTypes = call.GetConfigGameTypes()
|
|
|
|
|
resp.GameMarks = call.GetConfigGameMarks()
|
|
|
|
|
resp.Providers = call.GetConfigGameProviderAllOpen()
|
|
|
|
|
games := call.GetConfigFirstPageGames()
|
|
|
|
|
for _, v := range games {
|
|
|
|
|
one := values.OneFisrtPageGame{
|
|
|
|
|
ConfigFirstPageGames: v,
|
|
|
|
|
List: make([]*common.ConfigGameList, 0),
|
|
|
|
|
}
|
|
|
|
|
if v.Name == "Recent" {
|
|
|
|
|
one.List = append(one.List, call.GetGameRecord(a.UID)...)
|
|
|
|
|
} else if v.Name == "Favorite" {
|
|
|
|
|
one.List = append(one.List, call.GetPlayerFavoriteList(a.UID)...)
|
|
|
|
|
} else {
|
|
|
|
|
if v.JumpType == 1 {
|
|
|
|
|
one.List = call.GetConfigGameList(req.GameNum, v.JumpID)
|
|
|
|
|
} else {
|
|
|
|
|
one.List = call.GetConfigGameList(req.GameNum, 0, v.JumpID)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
resp.Games = append(resp.Games, one)
|
|
|
|
|
}
|
|
|
|
|
for i := common.CurrencyTypeZero + 1; i < common.CurrencyAll; i++ {
|
|
|
|
|
if i == common.CurrencyUSDT {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
resp.Currencys = append(resp.Currencys, values.OneCurrency{
|
|
|
|
|
ID: i,
|
|
|
|
|
Name: strings.ToUpper(i.GetCurrencyName()),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
list := call.GetConfigGameListByType(common.GameTypeSportBook)
|
|
|
|
|
if len(list) > 0 {
|
|
|
|
|
resp.Esport = list[0]
|
|
|
|
|
}
|
|
|
|
|
task := call.GetConfigTaskByTaskType(common.TaskTypeDownload)
|
|
|
|
|
if len(task) > 0 {
|
|
|
|
|
resp.DownloadAppReward = task[0].Reward
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resp.ShowData = values.ShowInfo{
|
|
|
|
|
Reward: rand.Int63n(1000000),
|
|
|
|
|
AverWithdraw: rand.Int63n(1000000),
|
|
|
|
|
MaxBet: rand.Int63n(1000000),
|
|
|
|
|
WithdrawCount: rand.Int63n(1000000),
|
|
|
|
|
}
|
|
|
|
|
}
|