修改奖励领取,新增奖励物品详情查询
This commit is contained in:
@ -2,6 +2,7 @@ package reward
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"server/internal/consts"
|
||||
"server/internal/dao"
|
||||
@ -319,7 +320,8 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *sReward) GetLift(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error) {
|
||||
// GetLift 领取奖励
|
||||
func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
|
||||
|
||||
// 遍历奖励类型列表
|
||||
//for _, v := range in.RewradTypeId {
|
||||
@ -332,22 +334,40 @@ func (s *sReward) GetLift(ctx context.Context, in *model.RewardCallbackIn) (out
|
||||
// }
|
||||
//}
|
||||
|
||||
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.GetGift, GiftParam: model.GiftParam{
|
||||
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: model.GiftParam{
|
||||
TaskId: in.TaskId,
|
||||
AreaId: in.AreaId,
|
||||
Gid: in.GameId,
|
||||
RoleIdx: in.RoleIdx,
|
||||
}})
|
||||
|
||||
_, ok := activity.(*model.GiftResponse)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result, ok := activity.(*model.GiftResponse)
|
||||
if !ok {
|
||||
return nil, ecode.Fail.Sub("数据类型转换失败")
|
||||
}
|
||||
|
||||
// 存储数据库记录
|
||||
//for _, item := range result.GiftItem {
|
||||
// item.Result
|
||||
//}
|
||||
for _, item := range result.GiftItem {
|
||||
marshal, err := json.Marshal(item.Water)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("序列化 json 数据出现异常")
|
||||
}
|
||||
_, err = dao.RewardWaters.Ctx(ctx).Insert(model.RewardWaters{
|
||||
OrderId: item.Water.OrderId,
|
||||
Status: int64(item.Water.Status),
|
||||
Uid: item.Water.Uid,
|
||||
TaskId: "BZD",
|
||||
Water: string(marshal),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("添加奖励领取记录异常")
|
||||
}
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
@ -399,5 +419,25 @@ func (s *sReward) GetGoods(ctx context.Context, in *model.GetGoodsGetIn) (out *m
|
||||
func (s *sReward) GetGoodsDetails(ctx context.Context, in *model.QueryUserGoodsDetailParam) (out *model.QueryUserGoodsDetailResponse, err error) {
|
||||
|
||||
//
|
||||
return nil, err
|
||||
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.QueryUserGoodsDetail, QueryUserGoodsDetailParam: model.QueryUserGoodsDetailParam{
|
||||
Gid: in.Gid,
|
||||
WinningTime: in.WinningTime,
|
||||
OrderId: in.OrderId,
|
||||
IsActInfo: in.IsActInfo,
|
||||
IsDocument: in.IsDocument,
|
||||
IsDetail: in.IsDetail,
|
||||
}})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result, ok := activity.(*model.QueryUserGoodsDetailResponse)
|
||||
if !ok {
|
||||
return nil, ecode.Fail.Sub("数据类型转换失败")
|
||||
}
|
||||
|
||||
return &model.QueryUserGoodsDetailResponse{
|
||||
Water: result.Water,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user