设置模板id

dev_aagame_provider
zhora 2 weeks ago
parent 5c18c56bda
commit d616e4240b
  1. 32
      modules/web/providers/sn/api.go
  2. 3
      modules/web/providers/sn/base.go
  3. 37
      modules/web/providers/sn/handler.go
  4. 5
      modules/web/providers/sn/values.go

@ -187,6 +187,7 @@ type ControlReq struct {
BaseReq BaseReq
ThirdName string `json:"third_name"` ThirdName string `json:"third_name"`
ControlId int `json:"control_id"` ControlId int `json:"control_id"`
TemplateId string `json:"template_id"`
Data []struct { Data []struct {
TargetRtp int `json:"target_rtp"` TargetRtp int `json:"target_rtp"`
} `json:"data"` } `json:"data"`
@ -210,3 +211,34 @@ type ControlResp struct {
Data struct { Data struct {
} `json:"data"` } `json:"data"`
} }
type ControlTemplateReq struct {
BaseReq
PageSize int `json:"page_size"`
PageIndex int `json:"page_index"`
}
type ControlTemplateResp struct {
Code int `json:"code"`
Success bool `json:"success"`
StatusCode int `json:"status_code"`
System int `json:"system"`
Msg string `json:"msg"`
Prompt string `json:"prompt"`
RequestId string `json:"request_id"`
RequestMethod string `json:"request_method"`
Provider string `json:"provider"`
Doc string `json:"doc"`
Data struct {
List []struct {
TemplateId string `json:"template_id"`
DealerList interface{} `json:"dealer_list"`
Desc string `json:"desc"`
Operator string `json:"operator"`
Time int `json:"time"`
CoinType int `json:"coin_type"`
List interface{} `json:"list"`
} `json:"list"`
TotalCount int `json:"total_count"`
} `json:"data"`
}

@ -25,6 +25,7 @@ func (s *Sub) Init() {
API = APITest API = APITest
APICreate = APICreateUserTest APICreate = APICreateUserTest
APIControl = APIControlTest APIControl = APIControlTest
APIGameControlTemplate = APIGameControlTemplateTest
SnAccount = TestSnAccount SnAccount = TestSnAccount
DefaultLanguage = TestDefaultLanguage DefaultLanguage = TestDefaultLanguage
ApiKey = TestApiKey ApiKey = TestApiKey
@ -36,6 +37,7 @@ func (s *Sub) Init() {
API = APIRlease API = APIRlease
APICreate = APICreateUserRlease APICreate = APICreateUserRlease
APIControl = APIControlRlease APIControl = APIControlRlease
APIGameControlTemplate = APIGameControlTemplateRelease
SnAccount = ReleaseSnAccount SnAccount = ReleaseSnAccount
DefaultLanguage = ReleaseDefaultLanguage DefaultLanguage = ReleaseDefaultLanguage
ApiKey = ReleaseApiKey ApiKey = ReleaseApiKey
@ -44,6 +46,7 @@ func (s *Sub) Init() {
AgentId = ReleaseAgentId AgentId = ReleaseAgentId
SnId = ReleaseSnId SnId = ReleaseSnId
} }
InitGameControlTemplate()
} }
type EnterReq struct { type EnterReq struct {

@ -12,6 +12,7 @@ import (
"server/modules/web/providers/base" "server/modules/web/providers/base"
"server/util" "server/util"
"strconv" "strconv"
"strings"
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -645,6 +646,7 @@ func Control(uid int, controlId int) error {
ControlId: controlId, ControlId: controlId,
Sn: SnId, Sn: SnId,
AgentId: AgentId, AgentId: AgentId,
TemplateId: DefaultTemplateId,
Data: []struct { Data: []struct {
TargetRtp int `json:"target_rtp"` TargetRtp int `json:"target_rtp"`
}{ }{
@ -673,3 +675,38 @@ func Control(uid int, controlId int) error {
return nil return nil
} }
func InitGameControlTemplate() error {
req := &ControlTemplateReq{
BaseReq: BaseReq{
SnAccount: SnAccount,
Time: time.Now().Unix(),
},
}
log.Debug("sn get control template req, %+v", *req)
reqBody, _ := json.Marshal(req)
var tmpValue map[string]interface{}
json.Unmarshal(reqBody, &tmpValue)
req.Sign = GeneratedSign(tmpValue, ApiKey)
var resp ControlTemplateResp
err := util.HttpPost(APIGameControlTemplate, req, &resp, nil)
if err != nil {
log.Error("err:%v", err)
return err
}
if resp.Code != CodeRequestSuccess && resp.Code != CodeRequestExist {
log.Error("sn get control template err, %+v", resp)
return fmt.Errorf("sn get control template err, %+v ", resp)
}
for _, v := range resp.Data.List {
if strings.Contains(v.Desc, "90%50") {
DefaultTemplateId = v.TemplateId
break
}
}
return nil
}

@ -20,6 +20,9 @@ const (
APIControlRlease = "https://ve-api.1betnbet.com/v1/control" APIControlRlease = "https://ve-api.1betnbet.com/v1/control"
APIControlTest = "https://api.nbetps.com/v1/control" APIControlTest = "https://api.nbetps.com/v1/control"
APIGameControlTemplateRelease = "https://ve-api.1betnbet.com/v1/game_control/search_control_template"
APIGameControlTemplateTest = "https://api.nbetps.com/v1/game_control/search_control_template"
TestSnAccount = "wjA77Game_N601" TestSnAccount = "wjA77Game_N601"
TestDefaultLanguage = "en" TestDefaultLanguage = "en"
TestAgentId = 320 TestAgentId = 320
@ -46,6 +49,8 @@ var (
API = "" API = ""
APICreate = "" APICreate = ""
APIControl = "" APIControl = ""
APIGameControlTemplate = ""
DefaultTemplateId = ""
SnAccount, DefaultLanguage, ApiKey, WalletKey, ControlKey string SnAccount, DefaultLanguage, ApiKey, WalletKey, ControlKey string
AgentId, SnId int AgentId, SnId int
) )

Loading…
Cancel
Save