修改任务列表查询
This commit is contained in:
@ -309,10 +309,10 @@ func (s *gamelifeClient) GetBound(ctx context.Context, popenid string) (*model.U
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (s *gamelifeClient) RequestNetbarTaskByGameID(ctx context.Context, in *model.QQNetbarActivityIn) (interface{}, error) {
|
||||
func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbarActivityIn) (interface{}, error) {
|
||||
client := resty.New()
|
||||
switch in.ServiceName {
|
||||
case "GetNonloginTaskList":
|
||||
case consts.GetNonLoginTaskList:
|
||||
result := model.GameTaskResponse{}
|
||||
in.TaskParam.Source = s.PlatId
|
||||
in.TaskParam.BrandId = s.BrandId
|
||||
@ -320,7 +320,7 @@ func (s *gamelifeClient) RequestNetbarTaskByGameID(ctx context.Context, in *mode
|
||||
SetContext(ctx).
|
||||
SetBody(in.TaskParam).
|
||||
SetResult(&result).
|
||||
Post(s.taskUrlMap[s.Mode] + "GetNonloginTaskList")
|
||||
Post(s.taskUrlMap[s.Mode] + consts.GetNonLoginTaskList)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("请求出现异常")
|
||||
}
|
||||
|
||||
@ -1,93 +0,0 @@
|
||||
package tencent
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
"io"
|
||||
"net/http"
|
||||
"server/internal/consts"
|
||||
"server/internal/model"
|
||||
"server/utility/ecode"
|
||||
)
|
||||
|
||||
// GetNonLoginTaskList 获取下发到指定网吧的任务列表(未登录)
|
||||
func GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTaskListIn) (data interface{}, err error) {
|
||||
|
||||
// 请求参数
|
||||
jsonStr, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("参数序列化失败")
|
||||
}
|
||||
|
||||
resp, err := ctxhttp.Post(ctx, http.DefaultClient, consts.TestAddr+"GetNonloginTaskList", "application/json", bytes.NewBuffer(jsonStr))
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("请求失败")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("读取响应失败")
|
||||
}
|
||||
err = json.Unmarshal(body, &data)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("解析响应失败")
|
||||
}
|
||||
return data, err
|
||||
|
||||
}
|
||||
|
||||
// GetLoginTaskList 获取下发到指定网吧的任务列表(已登录)
|
||||
func GetLoginTaskList(ctx context.Context, in *model.GetLoginTaskListIn) (data interface{}, err error) {
|
||||
value, err := g.Redis().Get(ctx, fmt.Sprintf(consts.GameLifeUserKey, in.POpenId))
|
||||
|
||||
if value.IsEmpty() {
|
||||
return nil, ecode.Fail.Sub("从redis获取值异常")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("从redis读取数据失败")
|
||||
}
|
||||
|
||||
var cache model.UserGamelifeCache
|
||||
err = json.Unmarshal(value.Bytes(), &cache)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("获取用户信息失败")
|
||||
}
|
||||
|
||||
req := &model.GetTenCentLoginTaskListIn{
|
||||
Gid: in.Gid,
|
||||
NetBarAccount: in.NetBarAccount,
|
||||
Num: 10,
|
||||
Pageidx: "",
|
||||
BrandId: "",
|
||||
}
|
||||
// 请求参数
|
||||
jsonStr, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("参数序列化失败")
|
||||
}
|
||||
|
||||
resp, err := ctxhttp.Post(ctx, http.DefaultClient, consts.TestAddr+"GetTaskList"+"?"+cache.Params, "application/json", bytes.NewBuffer(jsonStr))
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("请求失败")
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("解析响应体失败")
|
||||
}
|
||||
|
||||
err = json.Unmarshal(body, &data)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("反序列化异常")
|
||||
}
|
||||
|
||||
return data, err
|
||||
}
|
||||
Reference in New Issue
Block a user