调整奖励回调接口,调整奖励领取接口

This commit is contained in:
chy
2025-06-26 09:38:09 +08:00
parent ecee39efff
commit e1d8f0becd
9 changed files with 45 additions and 13 deletions

View File

@ -30,6 +30,7 @@ type RewardCallbackColumns struct {
PrizeSubType string // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等 PrizeSubType string // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num string // 奖励个数,默认 1比如经验值 10 Num string // 奖励个数,默认 1比如经验值 10
CustomInfo string // 透传字段 (json串) CustomInfo string // 透传字段 (json串)
AppId string // 业务 id标识业务方由游戏人生提供
} }
// rewardCallbackColumns holds the columns for the table reward_callback. // rewardCallbackColumns holds the columns for the table reward_callback.
@ -43,6 +44,7 @@ var rewardCallbackColumns = RewardCallbackColumns{
PrizeSubType: "prize_sub_type", PrizeSubType: "prize_sub_type",
Num: "num", Num: "num",
CustomInfo: "custom_info", CustomInfo: "custom_info",
AppId: "app_id",
} }
// NewRewardCallbackDao creates and returns a new DAO object for table data access. // NewRewardCallbackDao creates and returns a new DAO object for table data access.

View File

@ -30,6 +30,7 @@ type RewardWatersColumns struct {
CreatedAt string // CreatedAt string //
UpdatedAt string // UpdatedAt string //
DeletedAt string // DeletedAt string //
GameId string // 游戏唯一 id
} }
// rewardWatersColumns holds the columns for the table reward_waters. // rewardWatersColumns holds the columns for the table reward_waters.
@ -43,6 +44,7 @@ var rewardWatersColumns = RewardWatersColumns{
CreatedAt: "created_at", CreatedAt: "created_at",
UpdatedAt: "updated_at", UpdatedAt: "updated_at",
DeletedAt: "deleted_at", DeletedAt: "deleted_at",
GameId: "game_id",
} }
// NewRewardWatersDao creates and returns a new DAO object for table data access. // NewRewardWatersDao creates and returns a new DAO object for table data access.

View File

@ -359,27 +359,27 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
// GetLift 领取奖励 // GetLift 领取奖励
func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) { func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
giftParam := model.GiftParam{}
// 判断奖励类型 // 判断奖励类型
if in.Source == 1 { if in.Source == 1 {
// 系统奖励处理 // 系统奖励处理
if in.RewradTypeId != 16 { if in.RewradTypeId != 16 {
// 需要大区角色 // 需要大区角色
giftParam.AreaId = in.AreaId
giftParam.Gid = in.GameId
giftParam.RoleIdx = in.RoleIdx
giftParam.TaskId = in.TaskId
} else { } else {
// 不需要 // 不需要
giftParam.TaskId = in.TaskId
giftParam.Gid = in.GameId
} }
} else { } else {
// 门店奖励处理 // 门店奖励处理
} }
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: model.GiftParam{ activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: giftParam})
TaskId: in.TaskId,
AreaId: in.AreaId,
Gid: in.GameId,
RoleIdx: in.RoleIdx,
}})
if err != nil { if err != nil {
return nil, err 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{ _, err = dao.RewardWaters.Ctx(ctx).Insert(model.RewardWaters{
OrderId: item.Water.OrderId, OrderId: item.Water.OrderId,
Status: int64(item.Water.Status), Status: int64(item.Result),
Uid: item.Water.Uid, Uid: item.Water.Uid,
TaskId: "BZD",
Water: string(marshal), Water: string(marshal),
TaskId: in.TaskId,
GameId: int64(in.GameId),
}) })
if err != nil { if err != nil {
return nil, ecode.Fail.Sub("添加奖励领取记录异常") 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 return nil, err
@ -504,7 +515,7 @@ func (s *sReward) OperateTaskReward(ctx context.Context, in *model.OperateTaskRe
// CallBack 奖励回调 // CallBack 奖励回调
func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error) { 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, OrderId: in.OrderId,
PrizeId: in.PrizeId, PrizeId: in.PrizeId,
PrizeType: in.PrizeType, PrizeType: in.PrizeType,
@ -512,6 +523,17 @@ func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out
Uid: in.Uid, Uid: in.Uid,
Num: in.Num, Num: in.Num,
CustomInfo: in.CustomInfo, 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
} }

View File

@ -20,4 +20,5 @@ type RewardCallback struct {
PrizeSubType interface{} // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等 PrizeSubType interface{} // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num interface{} // 奖励个数,默认 1比如经验值 10 Num interface{} // 奖励个数,默认 1比如经验值 10
CustomInfo interface{} // 透传字段 (json串) CustomInfo interface{} // 透传字段 (json串)
AppId interface{} // 业务 id标识业务方由游戏人生提供
} }

View File

@ -21,4 +21,5 @@ type RewardWaters struct {
CreatedAt *gtime.Time // CreatedAt *gtime.Time //
UpdatedAt *gtime.Time // UpdatedAt *gtime.Time //
DeletedAt *gtime.Time // DeletedAt *gtime.Time //
GameId interface{} // 游戏唯一 id
} }

View File

@ -15,4 +15,5 @@ type RewardCallback struct {
PrizeSubType int `json:"prizeSubType" orm:"prize_sub_type" description:"奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等"` // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等 PrizeSubType int `json:"prizeSubType" orm:"prize_sub_type" description:"奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等"` // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num int `json:"num" orm:"num" description:"奖励个数,默认 1比如经验值 10"` // 奖励个数,默认 1比如经验值 10 Num int `json:"num" orm:"num" description:"奖励个数,默认 1比如经验值 10"` // 奖励个数,默认 1比如经验值 10
CustomInfo string `json:"customInfo" orm:"custom_info" description:"透传字段 (json串)"` // 透传字段 (json串) CustomInfo string `json:"customInfo" orm:"custom_info" description:"透传字段 (json串)"` // 透传字段 (json串)
AppId string `json:"appId" orm:"app_id" description:"业务 id标识业务方由游戏人生提供"` // 业务 id标识业务方由游戏人生提供
} }

View File

@ -19,4 +19,5 @@ type RewardWaters struct {
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` // CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` //
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` // UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` //
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""` // DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""` //
GameId int64 `json:"gameId" orm:"game_id" description:"游戏唯一 id"` // 游戏唯一 id
} }

View File

@ -131,6 +131,7 @@ type RewardCallbackIn struct {
PrizeSubType int `json:"prizeSubType"` // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等 PrizeSubType int `json:"prizeSubType"` // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num int `json:"num"` // 奖励个数,默认 1比如经验值 10 Num int `json:"num"` // 奖励个数,默认 1比如经验值 10
CustomInfo string `json:"customInfo"` // 透传字段 (json串) CustomInfo string `json:"customInfo"` // 透传字段 (json串)
AppId string `json:"appId"` // 业务 id
} }
type RewardCallbackOut struct { type RewardCallbackOut struct {

View File

@ -11,5 +11,6 @@ type RewardWaters struct {
Status int64 `json:"status" orm:"status" description:"兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作"` // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作 Status int64 `json:"status" orm:"status" description:"兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作"` // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` // CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` //
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` // UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` //
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""` // DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""`
GameId int64 `json:"gameId" orm:"game_id" description:"游戏ID"`
} }