新增游戏人生领取奖励相关接口
This commit is contained in:
@ -9,6 +9,7 @@ import (
|
||||
"server/internal/model/do"
|
||||
"server/internal/service"
|
||||
"server/utility/ecode"
|
||||
"server/utility/gamelife"
|
||||
)
|
||||
|
||||
type sReward struct{}
|
||||
@ -321,17 +322,32 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
|
||||
func (s *sReward) GetLift(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error) {
|
||||
|
||||
// 遍历奖励类型列表
|
||||
for _, v := range in.RewradTypeId {
|
||||
if v > 0 {
|
||||
// 发背包+兑换
|
||||
//for _, v := range in.RewradTypeId {
|
||||
// if v > 0 {
|
||||
// // 发背包+兑换
|
||||
//
|
||||
// }
|
||||
// if v > 0 {
|
||||
// // 直接发背包
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
if v > 0 {
|
||||
// 直接发背包
|
||||
}
|
||||
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.GetGift, GiftParam: model.GiftParam{
|
||||
TaskId: in.TaskId,
|
||||
AreaId: in.AreaId,
|
||||
Gid: in.GameId,
|
||||
RoleIdx: in.RoleIdx,
|
||||
}})
|
||||
|
||||
_, ok := activity.(*model.GiftResponse)
|
||||
if !ok {
|
||||
return nil, ecode.Fail.Sub("数据类型转换失败")
|
||||
}
|
||||
|
||||
// 存储数据库记录
|
||||
//for _, item := range result.GiftItem {
|
||||
// item.Result
|
||||
//}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
@ -339,9 +355,39 @@ func (s *sReward) GetLift(ctx context.Context, in *model.RewardCallbackIn) (out
|
||||
// GetGoodsList 调用外部获取物品列表
|
||||
func (s *sReward) GetGoodsList(ctx context.Context, in *model.GetGoodsListIn) (out *model.GetGoodsListOut, err error) {
|
||||
|
||||
// 调用 tencent
|
||||
var user model.User
|
||||
// 查询用户信息
|
||||
//err = dao.Users.Ctx(ctx).Where(do.Users{Id: in.UserId}).Scan(&user)
|
||||
err = dao.Users.Ctx(ctx).Where(do.Users{Id: 19}).Scan(&user)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("查询用户失败")
|
||||
}
|
||||
var pOpenId string
|
||||
// 判断绑定类型 QQ还是WX
|
||||
if in.BindType == 1 {
|
||||
pOpenId = user.QQPopenId
|
||||
} else {
|
||||
pOpenId = user.WXPopenId
|
||||
}
|
||||
|
||||
return nil, err
|
||||
// 调用 tencent
|
||||
result, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.QueryUserGoodsList, BindType: in.BindType,
|
||||
GoodsParam: model.GoodsParam{AppFilter: in.Appfilter, BigTime: in.BigTime, GoodsStatus: int(in.Goodsstatus), Num: int(in.Num), OrderByDesc: true, OrderType: in.OrderType, Pageidx: in.Pageidx, Gid: 26},
|
||||
PopenId: pOpenId, NickName: user.Nickname})
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("请求失败")
|
||||
}
|
||||
|
||||
response, ok := result.(*model.GoodsResponse)
|
||||
if !ok {
|
||||
return nil, ecode.Fail.Sub("类型断言失败")
|
||||
}
|
||||
|
||||
return &model.GetGoodsListOut{
|
||||
List: response.Waters,
|
||||
Pageidx: response.PageIdx,
|
||||
Total: response.Total,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetGoods 物品兑换
|
||||
|
||||
Reference in New Issue
Block a user