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

105 lines
2.9 KiB

1 year ago
package awc
import (
"fmt"
"server/common"
"server/config"
"server/modules/web/providers/base"
"server/util"
"github.com/liangdas/mqant/log"
)
type Sub struct {
Base *base.Base
}
func NewSub(base *base.Base) {
base.Sub = &Sub{Base: base}
base.SubInitRouter = AWC
}
func (s *Sub) Init() {
API = APITest
AgentID = AgentIDTest
Cert = CertTest
APIKey = APIKeyTest
BetLimitBrl = BetLimitBrlTest
BetLimitUsdt = BetLimitUsdtTest
if config.GetBase().Release {
API = APIRlease
AgentID = AgentIDRelease
Cert = CertRelease
APIKey = APIKeyRelease
BetLimitBrl = BetLimitBrlRelease
BetLimitUsdt = BetLimitUsdtRelease
}
}
type EnterGameReq struct {
Cert string `json:"cert"`
AgentId string `json:"agentId"`
UserId string `json:"userId"`
IsMobileLogin string `json:"isMobileLogin"`
ExternalURL string `json:"externalURL"`
Platform string `json:"platform"` // SEXYBCRT
GameType string `json:"gameType"` // LIVE
GameCode string `json:"gameCode"`
Hall string `json:"hall"`
Language string `json:"language"` // en
BetLimit string `json:"betLimit"` // {"SEXYBCRT":{"LIVE":{"limitId":[110901,110902]}}}
AutoBetMode string `json:"autoBetMode"` // 1开启自动下注 0隐藏
IsLaunchGameTable bool `json:"isLaunchGameTable"` // 进入指定桌子 true
GameTableId string `json:"gameTableId"` // 桌子id
}
func (s *Sub) EnterGame() string {
uid := s.Base.EnterGameReq.UID
ct := s.Base.EnterGameReq.CurrencyType
gameid := s.Base.EnterGameReq.GameID
subID := s.Base.EnterGameReq.SubID
// lang := s.Base.EnterGameReq.Lang
req := &EnterGameReq{
Cert: Cert,
AgentId: AgentID,
UserId: fmt.Sprintf("%v%s", uid, ct.GetCurrencyName()),
IsMobileLogin: "true",
ExternalURL: "https://www.riowhale.com",
Platform: "SEXYBCRT",
GameType: "LIVE",
GameCode: fmt.Sprintf("MX-LIVE-%03d", gameid),
Hall: "SEXY",
Language: "en",
// BetLimit: ,
AutoBetMode: "1",
// IsLaunchGameTable: true,
// GameTableId: fmt.Sprintf("%d", subID),
}
if subID > 0 {
req.IsLaunchGameTable = true
req.GameTableId = fmt.Sprintf("%d", subID)
}
if ct == common.CurrencyBrazil {
req.BetLimit = BetLimitBrl
} else {
req.BetLimit = BetLimitUsdt
}
url := API + LoginAPI
// reqURL := fmt.Sprintf("%s?Token=%s&GameId=%d&Lang=%s&AgentId=%s&Key=%s", url, token, gameid, reqLang, AgentID, GetSignKey(req))
log.Debug("sexy EnterGame:%+v,url:%s", *req, url)
ret := new(CommonResp)
util.HttpPostForm(url, req, &ret, nil)
log.Debug("sexy EnterGame resp:%+v", ret)
if ret.Status == "1002" { // 账号不存在,先创建
if CreateMember(uid, ct) {
return s.EnterGame() // 再调一次进入游戏
} else {
return ""
}
}
// if str, ok := ret.Data.(string); ok {
// return str
// }
return ret.URL
}