gamelife 自定义客户端集成游戏任务接口
This commit is contained in:
@ -21,11 +21,14 @@ import (
|
||||
|
||||
type gamelifeClient struct {
|
||||
PlatId string `json:"platId" `
|
||||
BrandId string `json:"brand_id"`
|
||||
Secret string `json:"secret"`
|
||||
Mode string `json:"mode" `
|
||||
keyivUrlMap map[string]string `json:"-"` // 存储获取用户 aes key 和 iv 的 url
|
||||
boundUrlMap map[string]string `json:"-"` // 存储用户绑定状态的 url
|
||||
unBoundUrlMap map[string]string `json:"-"` // 存储用户解绑状态的 url
|
||||
getBoundUrl map[string]string `json:"-"` // 存储用户绑定状态的 url
|
||||
taskUrlMap map[string]string `json:"-"`
|
||||
}
|
||||
|
||||
var (
|
||||
@ -34,8 +37,10 @@ var (
|
||||
|
||||
func newgamelifeClient(ctx context.Context) *gamelifeClient {
|
||||
instance = &gamelifeClient{
|
||||
PlatId: g.Config().MustGet(ctx, "gamelife.platId").String(),
|
||||
Mode: g.Config().MustGet(ctx, "gamelife.mode").String(),
|
||||
PlatId: g.Config().MustGet(ctx, "gamelife.platId").String(),
|
||||
BrandId: g.Config().MustGet(ctx, "gamelife.brandId").String(),
|
||||
Secret: g.Config().MustGet(ctx, "gamelife.secret").String(),
|
||||
Mode: g.Config().MustGet(ctx, "gamelife.mode").String(),
|
||||
keyivUrlMap: map[string]string{
|
||||
"test": "https://api-test.nes.smoba.qq.com/pvpesport.sgamenes.commcgi.commcgi/GetExplatSecret",
|
||||
"prod": "https://api.nes.smoba.qq.com/pvpesport.sgamenes.commcgi.commcgi/GetExplatSecret",
|
||||
@ -52,6 +57,10 @@ func newgamelifeClient(ctx context.Context) *gamelifeClient {
|
||||
"test": "https://api-test.cafe.qq.com/tipmp.user.authinfo_cgi.authinfo_cgi/GetPlatUserInfo",
|
||||
"prod": "https://api.cafe.qq.com/tipmp.user.authinfo_cgi.authinfo_cgi/GetPlatUserInfo",
|
||||
},
|
||||
taskUrlMap: map[string]string{
|
||||
"test": "https://api-test.cafe.qq.com/netbar.cafe.open_api.open_api/",
|
||||
"prod": "https://api.cafe.qq.com/netbar.cafe.open_api.open_api/",
|
||||
},
|
||||
}
|
||||
glog.Infof(ctx, "初始化 gamelifeClient 成功")
|
||||
return instance
|
||||
@ -299,3 +308,28 @@ func (s *gamelifeClient) GetBound(ctx context.Context, popenid string) (*model.U
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (s *gamelifeClient) RequestNetbarTaskByGameID(ctx context.Context, in *model.QQNetbarActivityIn) (out interface{}, err error) {
|
||||
client := resty.New()
|
||||
switch in.ServiceName {
|
||||
case "GetNonloginTaskList":
|
||||
result := model.QQNetbarTaskNoLoginResponse{}
|
||||
in.TaskParam.Source = s.PlatId
|
||||
in.TaskParam.BrandId = s.BrandId
|
||||
resp, err := client.R().
|
||||
SetContext(ctx).
|
||||
SetBody(in.TaskParam).
|
||||
SetResult(&result).
|
||||
Post(s.taskUrlMap[s.Mode] + "GetNonloginTaskList")
|
||||
if err != nil {
|
||||
err = ecode.Fail.Sub("请求出现异常")
|
||||
return
|
||||
}
|
||||
|
||||
if resp.IsError() {
|
||||
err = ecode.Fail.Sub("请求失败")
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -95,6 +95,9 @@ func init() {
|
||||
enforcer.AddPolicy("store", "/x/reward", "PUT", "更新奖励")
|
||||
enforcer.AddPolicy("store", "/x/reward/*", "DELETE", "删除奖励")
|
||||
|
||||
enforcer.AddPolicy("store", "/x/storeTaskReward", "POST", "添加门店任务奖励")
|
||||
enforcer.AddPolicy("store", "/x/storeTaskReward/*", "DELETE", "删除门店任务奖励")
|
||||
|
||||
// 门店角色
|
||||
enforcer.AddPolicy("store", "/x/store/role", "GET", "获取门店角色列表")
|
||||
enforcer.AddPolicy("store", "/x/store/role", "POST", "添加门店角色")
|
||||
|
||||
Reference in New Issue
Block a user