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.
59 lines
1.4 KiB
59 lines
1.4 KiB
package pgsoft |
|
|
|
import ( |
|
"fmt" |
|
"net/url" |
|
"server/common" |
|
"server/config" |
|
"server/modules/web/providers/base" |
|
|
|
"github.com/liangdas/mqant/log" |
|
) |
|
|
|
type Sub struct { |
|
Base *base.Base |
|
} |
|
|
|
func NewSub(base *base.Base) { |
|
base.Sub = &Sub{Base: base} |
|
base.SubInitRouter = PGSoft |
|
base.SettleWithoutBet = true |
|
} |
|
|
|
func (s *Sub) Init() { |
|
if config.GetBase().Release { |
|
API = APIURL |
|
OperatorToken = OperatorTokenRelease |
|
SecretKey = SecretKeyRelease |
|
Salt = SaltRelease |
|
} else { |
|
API = APITest |
|
OperatorToken = OperatorTokenTest |
|
SecretKey = SecretKeyTest |
|
Salt = SaltTest |
|
} |
|
} |
|
|
|
func (s *Sub) EnterGame() string { |
|
gameid := s.Base.EnterGameReq.GameID |
|
token := common.GetProviderUserToken(s.Base.EnterGameReq.Token) |
|
lang := s.Base.EnterGameReq.Lang |
|
// reqURL := fmt.Sprintf("https://m.pgr-nmga.com/%d/index.html?btt=1&ot=%s&ops=%s&l=%s&oc=1", gameid, OperatorToken, token, lang) |
|
// return reqURL |
|
reqURL := API + "/external-game-launcher/api/v1/GetLaunchURLHTML" |
|
log.Debug("enter pgsoft url:%s", reqURL) |
|
|
|
send := url.Values{} |
|
send.Add("operator_token", OperatorToken) |
|
send.Add("path", fmt.Sprintf("/%d/index.html", gameid)) |
|
send.Add("url_type", "game-entry") |
|
send.Add("client_ip", s.Base.IP) |
|
send.Add("extra_args", fmt.Sprintf("btt=1&ops=%s&l=%s", token, lang)) |
|
ret, err := HttpPostForm(reqURL, send) |
|
if err != nil { |
|
log.Error("err:%v", err) |
|
return "" |
|
} |
|
log.Debug("pgsoft resp:%+v", len(ret)) |
|
return ret |
|
}
|
|
|