|
|
|
@ -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" |
|
|
|
@ -641,10 +642,11 @@ func Control(uid int, controlId int) error { |
|
|
|
SnAccount: SnAccount, |
|
|
|
SnAccount: SnAccount, |
|
|
|
Time: time.Now().Unix(), |
|
|
|
Time: time.Now().Unix(), |
|
|
|
}, |
|
|
|
}, |
|
|
|
ThirdName: call.GetProviderUserName(fmt.Sprintf("%d", uid)), |
|
|
|
ThirdName: call.GetProviderUserName(fmt.Sprintf("%d", uid)), |
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
|