157 lines
3.5 KiB
Go
157 lines
3.5 KiB
Go
package stat
|
||
|
||
import (
|
||
"crypto/md5"
|
||
"encoding/hex"
|
||
"fmt"
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||
"time"
|
||
)
|
||
|
||
type GetAgentListReq struct {
|
||
*requests.RpcRequest
|
||
}
|
||
|
||
/**
|
||
返回json格式如下:
|
||
{
|
||
“code": 0,
|
||
"msg": "success",
|
||
"data": {
|
||
"list": []
|
||
}
|
||
}
|
||
*/
|
||
|
||
type GetAgentListResp struct {
|
||
*responses.BaseResponse
|
||
Code int `json:"code"`
|
||
Msg string `json:"msg"`
|
||
Data AgentList `json:"data"`
|
||
}
|
||
type AgentList struct {
|
||
List []Agent `json:"list"`
|
||
}
|
||
type Agent struct {
|
||
AgentId string `json:"agent_id"`
|
||
AgentName string `json:"agent_name"`
|
||
Media string `json:"media"`
|
||
Channel string `json:"channel"`
|
||
MediaName string `json:"media_name"`
|
||
ChannelName string `json:"channel_name"`
|
||
}
|
||
|
||
//const key = "gr_new_game"
|
||
|
||
// CreateGetAgentListReq 获取推广渠道列表请求
|
||
func CreateGetAgentListReq(data map[string]string) *GetAgentListReq {
|
||
req := &GetAgentListReq{
|
||
&requests.RpcRequest{},
|
||
}
|
||
|
||
ts := time.Now().Unix()
|
||
hash := md5.New()
|
||
hash.Write([]byte(fmt.Sprintf("%v%v", ts, key)))
|
||
hashBytes := hash.Sum(nil)
|
||
|
||
token := hex.EncodeToString(hashBytes)
|
||
|
||
req.InitWithApiInfo(HOST, VERSION, "/agent/getAgentList")
|
||
req.Method = requests.POST
|
||
|
||
req.FormParams = data
|
||
if req.FormParams == nil {
|
||
req.FormParams = make(map[string]string)
|
||
}
|
||
req.FormParams["sign"] = token
|
||
req.FormParams["time"] = fmt.Sprintf("%v", ts)
|
||
return req
|
||
}
|
||
|
||
// CreateGetAgentListResp 获取推广渠道列表响应
|
||
func CreateGetAgentListResp() *GetAgentListResp {
|
||
return &GetAgentListResp{
|
||
BaseResponse: &responses.BaseResponse{},
|
||
}
|
||
}
|
||
|
||
type GetAnchorBySiteId struct {
|
||
*requests.RpcRequest
|
||
SiteId int64 `position:"Body" field:"site_id" default:"0" json:"site_id"`
|
||
}
|
||
|
||
type GetAnchorBySiteIdResp struct {
|
||
*responses.BaseResponse
|
||
Code int `json:"code"`
|
||
Msg string `json:"msg"`
|
||
Data struct {
|
||
AnchorName string `json:"anchor_name"`
|
||
} `json:"data"`
|
||
}
|
||
|
||
func CreateGetAnchorBySiteIdReq(siteId int64) *GetAnchorBySiteId {
|
||
req := &GetAnchorBySiteId{
|
||
RpcRequest: &requests.RpcRequest{},
|
||
SiteId: siteId,
|
||
}
|
||
req.InitWithApiInfo(HOST, VERSION, "/site/getAnchorBySiteID")
|
||
req.Method = requests.POST
|
||
return req
|
||
}
|
||
|
||
// ======== 根据口令获取达人名称
|
||
|
||
type GetAnchorByLiveCodeReq struct {
|
||
*requests.RpcRequest
|
||
LiveCode string `position:"Body" field:"live_code" default:"" json:"live_code"`
|
||
}
|
||
|
||
type GetAnchorByLiveCodeResp struct {
|
||
*responses.BaseResponse
|
||
Code int `json:"code"`
|
||
Msg string `json:"msg"`
|
||
Data struct {
|
||
AnchorName string `json:"anchor_name"`
|
||
} `json:"data"`
|
||
}
|
||
|
||
func CreateGetAnchorByLiveCodeReq(liveCode string) *GetAnchorByLiveCodeReq {
|
||
req := &GetAnchorByLiveCodeReq{
|
||
RpcRequest: &requests.RpcRequest{},
|
||
LiveCode: liveCode,
|
||
}
|
||
req.InitWithApiInfo(HOST, VERSION, "/livecode/getAnchorByLiveCode")
|
||
req.Method = requests.POST
|
||
return req
|
||
}
|
||
|
||
// 根据口令获取对应的site_id
|
||
|
||
type GetLiveCodeReq struct {
|
||
*requests.RpcRequest
|
||
LiveCode string `position:"Body" field:"code" default:"" json:"code"`
|
||
}
|
||
|
||
type GetLiveCodeResp struct {
|
||
*responses.BaseResponse
|
||
Code int `json:"code"`
|
||
Msg string `json:"msg"`
|
||
Data struct {
|
||
Code string `json:"code"`
|
||
GameId int64 `json:"game_id"`
|
||
AgentId int64 `json:"agent_id"`
|
||
SiteId int64 `json:"site_id"`
|
||
} `json:"data"`
|
||
}
|
||
|
||
func CreateGetLiveCodeReq(liveCode string) *GetLiveCodeReq {
|
||
req := &GetLiveCodeReq{
|
||
RpcRequest: &requests.RpcRequest{},
|
||
LiveCode: liveCode,
|
||
}
|
||
req.InitWithApiInfo(HOST, VERSION, "/livecode/queryCode")
|
||
req.Method = requests.POST
|
||
return req
|
||
}
|