增加 8圈自动登录
This commit is contained in:
@ -21,6 +21,151 @@ type (
|
||||
// List 奖励列表
|
||||
List(ctx context.Context, in *model.RewardListIn) (out *model.RewardListOut, err error)
|
||||
// GetLift 领取奖励
|
||||
// func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
|
||||
//
|
||||
// giftParam := model.GiftParam{}
|
||||
// var needUrl bool
|
||||
// // 判断奖励类型
|
||||
// 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
|
||||
//
|
||||
// }
|
||||
// if in.RewardId != 16 && in.RewardId != 37 {
|
||||
// needUrl = true
|
||||
// }
|
||||
// } else {
|
||||
// // 门店奖励处理
|
||||
//
|
||||
// }
|
||||
//
|
||||
// glog.Info(ctx, "调用 tencent开始")
|
||||
// activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: giftParam})
|
||||
//
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// glog.Info(ctx, "调用 tencent结束")
|
||||
// fmt.Print(activity)
|
||||
//
|
||||
// result, ok := activity.(*model.GiftResponse)
|
||||
// if !ok {
|
||||
// return nil, ecode.Fail.Sub("数据类型转换失败")
|
||||
// }
|
||||
//
|
||||
// if len(result.GiftItem) == 0 {
|
||||
// return nil, ecode.Fail.Sub("奖励领取异常")
|
||||
// }
|
||||
//
|
||||
// // 存储数据库记录
|
||||
// var data model.GetRewardOut
|
||||
// if err = dao.RewardWaters.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||
// for _, item := range result.GiftItem {
|
||||
// marshal, err := json.Marshal(item.Water)
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("序列化 json 数据出现异常")
|
||||
// }
|
||||
// _, err = dao.RewardWaters.Ctx(ctx).Insert(model.RewardWaters{
|
||||
// OrderId: item.Water.OrderId,
|
||||
// Status: int64(item.Result),
|
||||
// Uid: item.Water.Uid,
|
||||
// Water: string(marshal),
|
||||
// TaskId: in.TaskId,
|
||||
// GameId: int64(in.GameId),
|
||||
// })
|
||||
//
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("添加奖励领取记录异常")
|
||||
// }
|
||||
//
|
||||
// // 根据 result判断
|
||||
// data.Result = int64(item.Result)
|
||||
// if item.Result == 1 {
|
||||
// //// 奖励发放成功,修改状态,扣除数量
|
||||
// glog.Infof(ctx, "奖励发放成功1,修改状态,扣除数量")
|
||||
// // 查询当前奖励是否为最后一个, 如果是则更新任务状态为2 完成
|
||||
// count, err := dao.UserTaskRewards.Ctx(ctx).Where(do.UserTaskRewards{UserTaskId: in.UserTaskId}).WhereIn(dao.UserTaskRewards.Columns().Status, []int{2, 3, 5}).Count()
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("查询用户任务奖励失败")
|
||||
// }
|
||||
//
|
||||
// if count == 1 {
|
||||
// // 修改任务记录状态2
|
||||
// _, err = dao.UserTasks.Ctx(ctx).Where(do.UserTasks{Id: in.UserTaskId}).Data(do.UserTasks{
|
||||
// Status: 2,
|
||||
// }).Update()
|
||||
//
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("修改用户任务状态失败")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 增加奖励已领取数量
|
||||
// _, err = dao.Rewards.Ctx(ctx).Where(do.Rewards{Id: in.RewardId}).Increment(dao.Rewards.Columns().ReceivedNum, 1)
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("获取奖励领取记录异常")
|
||||
// }
|
||||
//
|
||||
// // 修改用户任务奖励记录状态
|
||||
// _, err = dao.UserTaskRewards.Ctx(ctx).Where(do.UserTaskRewards{UserTaskId: in.UserTaskId, RewardId: in.RewardId}).Data(do.UserTaskRewards{
|
||||
// Status: consts.RewardSuccessStatus,
|
||||
// }).Update()
|
||||
//
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("修改用户任务奖励记录状态异常")
|
||||
// }
|
||||
// } else if item.Result == 2 || item.Result == 3 {
|
||||
// // 发放背包成功,修改状态
|
||||
// glog.Infof(ctx, "奖励发放成功2,修改状态")
|
||||
// _, err = dao.UserTaskRewards.Ctx(ctx).Data(do.UserTaskRewards{
|
||||
// Status: consts.RewardExchangeStatus,
|
||||
// }).Where(do.UserTaskRewards{
|
||||
// Id: in.UserTaskId,
|
||||
// RewardId: in.RewardId,
|
||||
// }).Update()
|
||||
//
|
||||
// if err != nil {
|
||||
// return ecode.Fail.Sub("修改用户任务奖励记录状态异常")
|
||||
// }
|
||||
// } else if item.Result == 4 {
|
||||
// // 奖励领取失败,不做操作,直接返回
|
||||
// glog.Infof(ctx, "领取奖励失败")
|
||||
// return ecode.Fail.Sub("领取奖励失败")
|
||||
// }
|
||||
//
|
||||
// //data.List = append(data.List, model.GetRewardNewOut{
|
||||
// // Result: int64(item.Result),
|
||||
// // Water: item.Water,
|
||||
// //})
|
||||
// }
|
||||
//
|
||||
// return
|
||||
//
|
||||
// }); err != nil {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// if needUrl {
|
||||
// data.Url, err = gamelife.GetGamelifeClient(ctx).GetGamelifePackageUrl(ctx, in.PopenId, in.GameCode, in.GameId, in.BindType)
|
||||
// if err != nil {
|
||||
// return nil, ecode.Fail.Sub("获取绑定链接失败")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //return &model.GetRewardOut{
|
||||
// // List: data.List,
|
||||
// //}, err
|
||||
// return &data, err
|
||||
// }
|
||||
GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error)
|
||||
// GetGoodsList 调用外部获取物品列表
|
||||
GetGoodsList(ctx context.Context, in *model.GetGoodsListIn) (out *model.GetGoodsListOut, err error)
|
||||
|
||||
Reference in New Issue
Block a user