调整腾讯回调和奖励领取接口
This commit is contained in:
@ -627,6 +627,16 @@ func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *mode
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("序列化 json 数据出现异常")
|
||||
}
|
||||
|
||||
exist, err := dao.RewardWaters.Ctx(ctx).Where(do.RewardWaters{OrderId: item.Water.OrderId}).Exist()
|
||||
|
||||
if exist {
|
||||
_, err := dao.RewardWaters.Ctx(ctx).Where(do.RewardWaters{OrderId: item.Water.OrderId}).Delete()
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("删除奖励领取记录异常")
|
||||
}
|
||||
}
|
||||
|
||||
_, err = dao.RewardWaters.Ctx(ctx).Insert(model.RewardWaters{
|
||||
OrderId: item.Water.OrderId,
|
||||
Status: int64(item.Result),
|
||||
@ -1142,17 +1152,37 @@ func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out
|
||||
res.Errcode = consts.BatchTotalLimit
|
||||
res.Errmsg = consts.BatchTotalLimitMSG
|
||||
}
|
||||
_, err = dao.RewardCallback.Ctx(ctx).OmitEmptyData().Insert(do.RewardCallback{
|
||||
OrderId: in.OrderId,
|
||||
PrizeId: in.PrizeId,
|
||||
PrizeType: in.PrizeType,
|
||||
PrizeSubType: in.PrizeSubType,
|
||||
Uid: in.Uid,
|
||||
Num: in.Num,
|
||||
CustomInfo: in.CustomInfo,
|
||||
AppId: in.AppId,
|
||||
InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
||||
})
|
||||
|
||||
if err = dao.RewardWaters.Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
||||
exist, err := dao.RewardCallback.Ctx(ctx).Where(do.RewardCallback{OrderId: in.OrderId}).Exist()
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("查询回调记录异常")
|
||||
}
|
||||
|
||||
if exist {
|
||||
_, err = dao.RewardCallback.Ctx(ctx).Where(do.RewardCallback{OrderId: in.OrderId}).Delete()
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("删除回调记录异常")
|
||||
}
|
||||
}
|
||||
_, err = dao.RewardCallback.Ctx(ctx).OmitEmptyData().Insert(do.RewardCallback{
|
||||
OrderId: in.OrderId,
|
||||
PrizeId: in.PrizeId,
|
||||
PrizeType: in.PrizeType,
|
||||
PrizeSubType: in.PrizeSubType,
|
||||
Uid: in.Uid,
|
||||
Num: in.Num,
|
||||
CustomInfo: in.CustomInfo,
|
||||
AppId: in.AppId,
|
||||
InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
||||
})
|
||||
return err
|
||||
}); err != nil {
|
||||
res.Errcode = -1
|
||||
res.Errmsg = "存储奖励回调数据异常"
|
||||
res.Datas = nil
|
||||
return &res, ecode.Fail.Sub("存储奖励回调数据异常")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
res.Errcode = -1
|
||||
|
||||
Reference in New Issue
Block a user