调整奖励回调接口,调整奖励领取接口
This commit is contained in:
@ -359,27 +359,27 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
|
||||
// GetLift 领取奖励
|
||||
func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
|
||||
|
||||
giftParam := model.GiftParam{}
|
||||
// 判断奖励类型
|
||||
if in.Source == 1 {
|
||||
// 系统奖励处理
|
||||
if in.RewradTypeId != 16 {
|
||||
// 需要大区角色
|
||||
|
||||
giftParam.AreaId = in.AreaId
|
||||
giftParam.Gid = in.GameId
|
||||
giftParam.RoleIdx = in.RoleIdx
|
||||
giftParam.TaskId = in.TaskId
|
||||
} else {
|
||||
// 不需要
|
||||
|
||||
giftParam.TaskId = in.TaskId
|
||||
giftParam.Gid = in.GameId
|
||||
}
|
||||
} else {
|
||||
// 门店奖励处理
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
}})
|
||||
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: giftParam})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -398,15 +398,26 @@ func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *mode
|
||||
}
|
||||
_, err = dao.RewardWaters.Ctx(ctx).Insert(model.RewardWaters{
|
||||
OrderId: item.Water.OrderId,
|
||||
Status: int64(item.Water.Status),
|
||||
Status: int64(item.Result),
|
||||
Uid: item.Water.Uid,
|
||||
TaskId: "BZD",
|
||||
Water: string(marshal),
|
||||
TaskId: in.TaskId,
|
||||
GameId: int64(in.GameId),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("添加奖励领取记录异常")
|
||||
}
|
||||
|
||||
// 根据 result判断
|
||||
if item.Result == 1 {
|
||||
// 奖励发放成功,修改状态,扣除数量
|
||||
|
||||
} else if item.Result == 2 || item.Result == 3 {
|
||||
// 发放背包成功,修改状态
|
||||
} else if item.Result == 4 {
|
||||
// 奖励领取失败,不做操作,直接返回
|
||||
}
|
||||
}
|
||||
|
||||
return nil, err
|
||||
@ -504,7 +515,7 @@ func (s *sReward) OperateTaskReward(ctx context.Context, in *model.OperateTaskRe
|
||||
// CallBack 奖励回调
|
||||
func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error) {
|
||||
|
||||
dao.RewardCallback.Ctx(ctx).Insert(do.RewardCallback{
|
||||
_, err = dao.RewardCallback.Ctx(ctx).OmitEmptyData().Insert(do.RewardCallback{
|
||||
OrderId: in.OrderId,
|
||||
PrizeId: in.PrizeId,
|
||||
PrizeType: in.PrizeType,
|
||||
@ -512,6 +523,17 @@ func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out
|
||||
Uid: in.Uid,
|
||||
Num: in.Num,
|
||||
CustomInfo: in.CustomInfo,
|
||||
AppId: in.AppId,
|
||||
})
|
||||
return nil, err
|
||||
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("存储奖励回调数据异常")
|
||||
}
|
||||
|
||||
return &model.RewardCallbackOut{
|
||||
OrderId: in.OrderId,
|
||||
AppId: in.AppId,
|
||||
Errcode: 0,
|
||||
Errmsg: "成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user