调整任务查询,回调,奖励类型查询
This commit is contained in:
@ -187,9 +187,9 @@ type GiftItem struct {
|
|||||||
|
|
||||||
type CallbackReq struct {
|
type CallbackReq struct {
|
||||||
g.Meta `path:"/reward/callback" method:"post" tags:"Reward" summary:"(tencent)回调"`
|
g.Meta `path:"/reward/callback" method:"post" tags:"Reward" summary:"(tencent)回调"`
|
||||||
Uid string `json:"uid" v:"required#用户id不能为空" dc:"用户id"`
|
Uid string `json:"Uid" dc:"用户id"`
|
||||||
OrderId string `json:"order_id" v:"required#流水订单id不能为空" dc:"用户领取流水订单"`
|
OrderId string `json:"order_id" dc:"用户领取流水订单"`
|
||||||
PrizeChannelId string `json:"prize_channel_id" v:"required#奖品渠道id不能为空" dc:"奖品渠道id"`
|
PrizeChannelId string `json:"prize_channel_id" dc:"奖品渠道id"`
|
||||||
PrizeId string `json:"prize_id"`
|
PrizeId string `json:"prize_id"`
|
||||||
PrizeType uint32 `json:"prize_type"`
|
PrizeType uint32 `json:"prize_type"`
|
||||||
PrizeSubType uint32 `json:"prize_sub_type"`
|
PrizeSubType uint32 `json:"prize_sub_type"`
|
||||||
|
|||||||
@ -80,6 +80,7 @@ type GetTaskReq struct {
|
|||||||
NetBarAccount string `json:"netBarAccount" dc:"门店 id、网关账号必传一个"`
|
NetBarAccount string `json:"netBarAccount" dc:"门店 id、网关账号必传一个"`
|
||||||
GameId int `json:"gameId" v:"required#游戏唯一id不能为空" dc:"游戏唯一id"`
|
GameId int `json:"gameId" v:"required#游戏唯一id不能为空" dc:"游戏唯一id"`
|
||||||
TaskName string `json:"taskName" v:"required#任务名称不能为空" dc:"任务名称"`
|
TaskName string `json:"taskName" v:"required#任务名称不能为空" dc:"任务名称"`
|
||||||
|
TaskType int `json:"taskType" v:"required#任务类型不能为空" dc:"任务类型1:每日 3:周期"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetTaskRes struct {
|
type GetTaskRes struct {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import (
|
|||||||
"server/api/reward/v1"
|
"server/api/reward/v1"
|
||||||
"server/internal/model"
|
"server/internal/model"
|
||||||
"server/internal/service"
|
"server/internal/service"
|
||||||
|
"server/utility/gamelife"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,17 +23,17 @@ func (c *ControllerV1) Callback(ctx context.Context, req *v1.CallbackReq) (res *
|
|||||||
auth := fromCtx.Header.Get("Custom-Data-Auth")
|
auth := fromCtx.Header.Get("Custom-Data-Auth")
|
||||||
glog.Infof(ctx, fmt.Sprintf("appid:%s,timestamp:%s,nonce:%s,auth:%s", appid, timestamp, nonce, auth))
|
glog.Infof(ctx, fmt.Sprintf("appid:%s,timestamp:%s,nonce:%s,auth:%s", appid, timestamp, nonce, auth))
|
||||||
|
|
||||||
data := fmt.Sprintf("%s%s%s%s%d%d%d%s%s%s#%s", req.Uid, req.OrderId, req.PrizeChannelId, req.PrizeId, req.PrizeType, req.PrizeSubType, req.Num, appid, timestamp, nonce, auth)
|
data := fmt.Sprintf("%s%s%s%s%d%d%d%s%s%s#%s", req.Uid, req.OrderId, req.PrizeChannelId, req.PrizeId, req.PrizeType, req.PrizeSubType, req.Num, appid, timestamp, nonce, gamelife.GetGamelifeClient(ctx).GetSecret())
|
||||||
stateOri := md5.Sum([]byte(data))
|
stateOri := md5.Sum([]byte(data))
|
||||||
state := hex.EncodeToString(stateOri[:])
|
state := hex.EncodeToString(stateOri[:])
|
||||||
myAuth := strings.ToUpper(state)
|
myAuth := strings.ToUpper(state)
|
||||||
|
glog.Infof(ctx, fmt.Sprintf("%s,%s,%s,%s,%d,%d,%d,%s,%s,%s,#%s", req.Uid, req.OrderId, req.PrizeChannelId, req.PrizeId, req.PrizeType, req.PrizeSubType, req.Num, appid, timestamp, nonce, auth))
|
||||||
|
|
||||||
glog.Infof(ctx, fmt.Sprintf("myAuth:%s,auth:%s", myAuth, auth))
|
glog.Infof(ctx, fmt.Sprintf("myAuth:%s,auth:%s", myAuth, auth))
|
||||||
if myAuth != auth {
|
if myAuth != auth {
|
||||||
glog.Infof(ctx, fmt.Sprintf("myAuth:%s,auth:%s", myAuth, auth))
|
glog.Infof(ctx, fmt.Sprintf("myAuth:%s,auth:%s", myAuth, auth))
|
||||||
return &v1.CallbackRes{Errcode: 252151000, OrderId: req.OrderId, Datas: []v1.CallbackData{{PrizeCode: req.OrderId}}}, err
|
return &v1.CallbackRes{Errcode: 252151000, OrderId: req.OrderId, Datas: []v1.CallbackData{{PrizeCode: req.OrderId}}}, err
|
||||||
}
|
}
|
||||||
glog.Infof(ctx, fmt.Sprintf("%s,%s,%s,%s,%d,%d,%d,%s,%s,%s,#%s", req.Uid, req.OrderId, req.PrizeChannelId, req.PrizeId, req.PrizeType, req.PrizeSubType, req.Num, appid, timestamp, nonce, auth))
|
|
||||||
|
|
||||||
out, err := service.Reward().CallBack(ctx, &model.RewardCallbackIn{
|
out, err := service.Reward().CallBack(ctx, &model.RewardCallbackIn{
|
||||||
Uid: req.Uid,
|
Uid: req.Uid,
|
||||||
|
|||||||
@ -19,6 +19,7 @@ func (c *ControllerV1) GetTask(ctx context.Context, req *v1.GetTaskReq) (res *v1
|
|||||||
UserId: userId,
|
UserId: userId,
|
||||||
GameId: req.GameId,
|
GameId: req.GameId,
|
||||||
TaskName: req.TaskName,
|
TaskName: req.TaskName,
|
||||||
|
TaskType: req.TaskType,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func (c *ControllerV1) GetTaskList(ctx context.Context, req *v1.GetTaskListReq) (res *v1.GetTaskListRes, err error) {
|
func (c *ControllerV1) GetTaskList(ctx context.Context, req *v1.GetTaskListReq) (res *v1.GetTaskListRes, err error) {
|
||||||
|
|
||||||
userId := g.RequestFromCtx(ctx).Get("id").Int64()
|
userId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
||||||
list, err := service.Task().GetTaskList(ctx, &model.GetTaskListV2In{
|
list, err := service.Task().GetTaskList(ctx, &model.GetTaskListV2In{
|
||||||
Gid: req.Gid,
|
Gid: req.Gid,
|
||||||
NetBarAccount: req.NetBarAccount,
|
NetBarAccount: req.NetBarAccount,
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (c *ControllerV1) SyncTask(ctx context.Context, req *v1.SyncTaskReq) (res *v1.SyncTaskRes, err error) {
|
func (c *ControllerV1) SyncTask(ctx context.Context, req *v1.SyncTaskReq) (res *v1.SyncTaskRes, err error) {
|
||||||
go func() {
|
go func() {
|
||||||
_, err = service.Task().SyncTaskFromGamelife(ctx)
|
_, err = service.Task().SyncTaskFromGamelife(context.Background())
|
||||||
}()
|
}()
|
||||||
return &v1.SyncTaskRes{
|
return &v1.SyncTaskRes{
|
||||||
Message: "同步调用成功,等待数据同步,5分钟后刷新",
|
Message: "同步调用成功,等待数据同步,5分钟后刷新",
|
||||||
|
|||||||
@ -29,6 +29,7 @@ type RewardTypesColumns struct {
|
|||||||
UpdatedAt string // 更新时间
|
UpdatedAt string // 更新时间
|
||||||
DeletedAt string // 软删除时间
|
DeletedAt string // 软删除时间
|
||||||
TencentTypeId string // 腾讯类型 id
|
TencentTypeId string // 腾讯类型 id
|
||||||
|
Source string // 来源1:系统 2:门店
|
||||||
}
|
}
|
||||||
|
|
||||||
// rewardTypesColumns holds the columns for the table reward_types.
|
// rewardTypesColumns holds the columns for the table reward_types.
|
||||||
@ -41,6 +42,7 @@ var rewardTypesColumns = RewardTypesColumns{
|
|||||||
UpdatedAt: "updated_at",
|
UpdatedAt: "updated_at",
|
||||||
DeletedAt: "deleted_at",
|
DeletedAt: "deleted_at",
|
||||||
TencentTypeId: "tencent_type_id",
|
TencentTypeId: "tencent_type_id",
|
||||||
|
Source: "source",
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
||||||
|
|||||||
@ -33,6 +33,7 @@ type UserTasksColumns struct {
|
|||||||
StoreId string // 门店 id
|
StoreId string // 门店 id
|
||||||
TaskName string // 任务名称
|
TaskName string // 任务名称
|
||||||
GameId string // 游戏 id
|
GameId string // 游戏 id
|
||||||
|
TaskType string // 1: 每日任务 3: 周期任务
|
||||||
}
|
}
|
||||||
|
|
||||||
// userTasksColumns holds the columns for the table user_tasks.
|
// userTasksColumns holds the columns for the table user_tasks.
|
||||||
@ -49,6 +50,7 @@ var userTasksColumns = UserTasksColumns{
|
|||||||
StoreId: "store_id",
|
StoreId: "store_id",
|
||||||
TaskName: "task_name",
|
TaskName: "task_name",
|
||||||
GameId: "game_id",
|
GameId: "game_id",
|
||||||
|
TaskType: "task_type",
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
||||||
|
|||||||
@ -556,6 +556,164 @@ 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) {
|
||||||
|
// var reward *model.Reward
|
||||||
|
// var res model.RewardCallbackOut
|
||||||
|
// res.OrderId = in.OrderId
|
||||||
|
// res.AppId = in.AppId
|
||||||
|
//
|
||||||
|
// // 查询奖励
|
||||||
|
// err = dao.Rewards.Ctx(ctx).Where(do.Rewards{PrizeId: in.PrizeId}).Scan(&reward)
|
||||||
|
// if err != nil {
|
||||||
|
// res.Errcode = -1
|
||||||
|
// res.Errmsg = "查询奖励异常"
|
||||||
|
// res.Datas = nil
|
||||||
|
// return &res, ecode.Fail.Sub("查询奖励异常")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if reward == nil {
|
||||||
|
// res.Errcode = -1
|
||||||
|
// res.Errmsg = "查询奖励为空"
|
||||||
|
// res.Datas = nil
|
||||||
|
// return &res, ecode.Params.Sub("查询奖励为空")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 判断是否过期
|
||||||
|
// if reward.ExpireType == 1 {
|
||||||
|
// //时间段过期
|
||||||
|
// if reward.ValidTo.Before(gtime.Now()) {
|
||||||
|
// res.Errcode = consts.BatchOutDate
|
||||||
|
// res.Errmsg = consts.BatchOutDateMSG
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 日
|
||||||
|
// now := time.Now()
|
||||||
|
// // 当天开始时间
|
||||||
|
// start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||||
|
// // 当天结束时间
|
||||||
|
// end := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location())
|
||||||
|
// // 查先询用户当日已领取
|
||||||
|
// //dailyGetNum, err := dao.Rewards.Ctx(ctx).
|
||||||
|
// // LeftJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id=%s.reward_id", dao.Rewards.Table(), dao.UserTaskRewards.Table())).
|
||||||
|
// // Where(dao.Rewards.Columns().PrizeId, in.PrizeId).
|
||||||
|
// // WhereBetween(dao.UserTaskRewards.Columns().UpdatedAt, start, end).
|
||||||
|
// // Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).Count()
|
||||||
|
// //
|
||||||
|
// //// dailyGetNum, err := dao.Rewards.Ctx(ctx).
|
||||||
|
// //// Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id=%s.reward_id", dao.Rewards.Table(),
|
||||||
|
// //// dao.UserTaskRewards.Table())).InnerJoin(dao.RewardWaters.Table(), fmt.Sprintf("%s.external_order_id = %s.order_id", dao.UserTaskRewards.Table(), dao.RewardWaters.Table())).
|
||||||
|
// //// Where(dao.RewardWaters.Columns().Recvuid, in.Uid).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
||||||
|
// //// WhereBetween(dao.UserTaskRewards.Columns().UpdatedAt, start, end).Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
||||||
|
// //
|
||||||
|
// //if err != nil {
|
||||||
|
// // res.Errcode = -1
|
||||||
|
// // res.Errmsg = "查询用户当日领取数量失败"
|
||||||
|
// // res.Datas = nil
|
||||||
|
// // return &res, ecode.Fail.Sub("查询用户当日领取数量失败")
|
||||||
|
// //}
|
||||||
|
// //
|
||||||
|
// //// 判断是否达到用户日限制
|
||||||
|
// //if int(reward.UserDailyLimit) <= dailyGetNum {
|
||||||
|
// // res.Errcode = consts.UserDayLimit
|
||||||
|
// // res.Errmsg = consts.UserDayLimitMSG
|
||||||
|
// //}
|
||||||
|
// //
|
||||||
|
// //// 查先询用户总共已领取
|
||||||
|
// //dailyTotalNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id=%s.reward_id", dao.Rewards.Table(),
|
||||||
|
// // dao.UserTaskRewards.Table())).InnerJoin(dao.RewardWaters.Table(), fmt.Sprintf("%s.external_order_id = %s.order_id", dao.UserTaskRewards.Table(), dao.RewardWaters.Table())).
|
||||||
|
// // Where(dao.RewardWaters.Columns().Recvuid, in.Uid).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
||||||
|
// // Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
||||||
|
// //
|
||||||
|
// //if err != nil {
|
||||||
|
// // res.Errcode = -1
|
||||||
|
// // res.Errmsg = "查询用户当日总共领取数量失败"
|
||||||
|
// // res.Datas = nil
|
||||||
|
// // return &res, ecode.Fail.Sub("查询用户当日总共领取数量失败")
|
||||||
|
// //}
|
||||||
|
// //// 判断是否达到用户总限制
|
||||||
|
// //if int(reward.UserTotalLimit) <= dailyTotalNum {
|
||||||
|
// // res.Errcode = consts.UserTotalLimit
|
||||||
|
// // res.Errmsg = consts.UserTotalLimitMSG
|
||||||
|
// //}
|
||||||
|
// //
|
||||||
|
// //// 查先询该批次当日已领取
|
||||||
|
// //batchDailyGetNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
||||||
|
// // dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
||||||
|
// // WhereBetween(dao.UserTaskRewards.Columns().UpdatedAt, start, end).Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
||||||
|
// //if err != nil {
|
||||||
|
// // res.Errcode = -1
|
||||||
|
// // res.Errmsg = "查询该批次当日总共领取数量失败"
|
||||||
|
// // res.Datas = nil
|
||||||
|
// // return &res, ecode.Fail.Sub("查询该批次当日总共领取数量失败")
|
||||||
|
// //}
|
||||||
|
// //// 判断是否达到该批次日限制
|
||||||
|
// //if int(reward.DailyTotalLimit) <= batchDailyGetNum {
|
||||||
|
// // res.Errcode = consts.BatchDayLimit
|
||||||
|
// // res.Errmsg = consts.BatchDayLimitMSG
|
||||||
|
// //}
|
||||||
|
// //
|
||||||
|
// //// 查先询该批次总共已领取
|
||||||
|
// //batchTotalGetNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
||||||
|
// // dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
||||||
|
// // Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
||||||
|
// //
|
||||||
|
// //if err != nil {
|
||||||
|
// // res.Errcode = -1
|
||||||
|
// // res.Errmsg = "查询该批次总共领取数量失败"
|
||||||
|
// // res.Datas = nil
|
||||||
|
// // return &res, ecode.Fail.Sub("查询该批次总共领取数量失败")
|
||||||
|
// //}
|
||||||
|
// //// 判断是否达到该批次总共限制
|
||||||
|
// //if int(reward.TotalLimit) <= batchTotalGetNum {
|
||||||
|
// // 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,
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// if err != nil {
|
||||||
|
// res.Errcode = -1
|
||||||
|
// res.Errmsg = "存储奖励回调数据异常"
|
||||||
|
// res.Datas = nil
|
||||||
|
// return &res, ecode.Fail.Sub("存储奖励回调数据异常")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 回调成功,组装响应参数
|
||||||
|
// var userTaskReward []*model.UserTaskRewards
|
||||||
|
// if err = dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.%s = %s.%s",
|
||||||
|
// dao.Rewards.Table(), dao.Rewards.Columns().Id, dao.UserTaskRewards.Table(), dao.UserTaskRewards.Columns().RewardId)).Scan(&userTaskReward); err != nil {
|
||||||
|
// return nil, ecode.Fail.Sub("获取用户奖励记录异常")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if userTaskReward == nil {
|
||||||
|
// res.Errcode = -1
|
||||||
|
// res.Errmsg = "用户奖励记录为空"
|
||||||
|
// res.Datas = nil
|
||||||
|
// return &res, ecode.Fail.Sub("用户奖励记录为空")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// callbackData := make([]model.CallbackData, 0)
|
||||||
|
// for _, v := range userTaskReward {
|
||||||
|
// callbackData = append(callbackData, model.CallbackData{
|
||||||
|
// PrizeCode: v.InnerOrderId,
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// res.Datas = callbackData
|
||||||
|
//
|
||||||
|
// return &res, err
|
||||||
|
// }
|
||||||
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) {
|
||||||
var reward *model.Reward
|
var reward *model.Reward
|
||||||
var res model.RewardCallbackOut
|
var res model.RewardCallbackOut
|
||||||
@ -593,76 +751,70 @@ func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out
|
|||||||
start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||||
// 当天结束时间
|
// 当天结束时间
|
||||||
end := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location())
|
end := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location())
|
||||||
// 查先询用户当日已领取
|
|
||||||
dailyGetNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id=%s.reward_id", dao.Rewards.Table(),
|
|
||||||
dao.UserTaskRewards.Table())).InnerJoin(dao.RewardWaters.Table(), fmt.Sprintf("%s.external_order_id = %s.order_id", dao.UserTaskRewards.Table(), dao.RewardWaters.Table())).
|
|
||||||
Where(dao.RewardWaters.Columns().Recvuid, in.Uid).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
|
||||||
WhereBetween(dao.UserTaskRewards.Columns().UpdatedAt, start, end).Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
|
||||||
|
|
||||||
|
value, err := dao.Users.Ctx(ctx).Where(dao.Users.Columns().WxPopenId, fmt.Sprintf("WX_%s", in.Uid)).WhereOr(dao.Users.Columns().QqPopenId, fmt.Sprintf("QQ_%s", in.Uid)).Fields(dao.Users.Columns().Id).Value()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.Errcode = -1
|
res.Errcode = -1
|
||||||
res.Errmsg = "查询用户当日领取数量失败"
|
res.Errmsg = "查询用户ID异常"
|
||||||
res.Datas = nil
|
res.Datas = nil
|
||||||
return &res, ecode.Fail.Sub("查询用户当日领取数量失败")
|
return &res, ecode.Fail.Sub("查询用户ID异常")
|
||||||
}
|
}
|
||||||
|
userId := value.Int64()
|
||||||
|
|
||||||
// 判断是否达到用户日限制
|
// 查询当前用户当天领取总数
|
||||||
if int(reward.UserDailyLimit) <= dailyGetNum {
|
userTodayNum, err := dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: userId}).LeftJoin(dao.UserTaskRewards.Table(), "utr", "utr.user_task_id = user_tasks.id").
|
||||||
|
WhereIn("utr.status", []int{3, 6}).
|
||||||
|
Where("utr.reward_id = ?", reward.Id).WhereBetween("utr.updated_at", start, end).Count()
|
||||||
|
if err != nil {
|
||||||
|
res.Errcode = -1
|
||||||
|
res.Errmsg = "查询用户当天领取数量异常"
|
||||||
|
res.Datas = nil
|
||||||
|
return &res, ecode.Fail.Sub("查询用户当天领取数量异常")
|
||||||
|
}
|
||||||
|
if userTodayNum >= int(reward.UserDailyLimit) {
|
||||||
res.Errcode = consts.UserDayLimit
|
res.Errcode = consts.UserDayLimit
|
||||||
res.Errmsg = consts.UserDayLimitMSG
|
res.Errmsg = consts.UserDayLimitMSG
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查先询用户总共已领取
|
// 查询当前用户该奖励领取总数
|
||||||
dailyTotalNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id=%s.reward_id", dao.Rewards.Table(),
|
userTotalNum, err := dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: userId}).LeftJoin(dao.UserTaskRewards.Table(), "utr", "utr.user_task_id = user_tasks.id").
|
||||||
dao.UserTaskRewards.Table())).InnerJoin(dao.RewardWaters.Table(), fmt.Sprintf("%s.external_order_id = %s.order_id", dao.UserTaskRewards.Table(), dao.RewardWaters.Table())).
|
WhereIn("utr.status", []int{3, 6}).
|
||||||
Where(dao.RewardWaters.Columns().Recvuid, in.Uid).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
Where("utr.reward_id = ?", reward.Id).Count()
|
||||||
Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.Errcode = -1
|
res.Errcode = -1
|
||||||
res.Errmsg = "查询用户当日总共领取数量失败"
|
res.Errmsg = "查询用户领取数量异常"
|
||||||
res.Datas = nil
|
res.Datas = nil
|
||||||
return &res, ecode.Fail.Sub("查询用户当日总共领取数量失败")
|
return &res, ecode.Fail.Sub("查询用户领取数量异常")
|
||||||
}
|
}
|
||||||
// 判断是否达到用户总限制
|
if userTotalNum >= int(reward.UserTotalLimit) {
|
||||||
if int(reward.UserTotalLimit) <= dailyTotalNum {
|
|
||||||
res.Errcode = consts.UserTotalLimit
|
res.Errcode = consts.UserTotalLimit
|
||||||
res.Errmsg = consts.UserTotalLimitMSG
|
res.Errmsg = consts.UserTotalLimitMSG
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查先询该批次当日已领取
|
// 查询该奖励今天发放总数
|
||||||
batchDailyGetNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
todayNum, err := dao.UserTaskRewards.Ctx(ctx).WhereBetween("updated_at", start, end).Where("reward_id = ?", reward.Id).WhereIn("status", []int{3, 6}).Count()
|
||||||
dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
|
||||||
WhereBetween(dao.UserTaskRewards.Columns().UpdatedAt, start, end).Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.Errcode = -1
|
res.Errcode = -1
|
||||||
res.Errmsg = "查询该批次当日总共领取数量失败"
|
res.Errmsg = "查询该批次今天领取数量异常"
|
||||||
res.Datas = nil
|
res.Datas = nil
|
||||||
return &res, ecode.Fail.Sub("查询该批次当日总共领取数量失败")
|
return &res, ecode.Fail.Sub("查询该批次今天领取数量异常")
|
||||||
}
|
}
|
||||||
// 判断是否达到该批次日限制
|
if todayNum >= int(reward.DailyTotalLimit) {
|
||||||
if int(reward.DailyTotalLimit) <= batchDailyGetNum {
|
|
||||||
res.Errcode = consts.BatchDayLimit
|
res.Errcode = consts.BatchDayLimit
|
||||||
res.Errmsg = consts.BatchDayLimitMSG
|
res.Errmsg = consts.BatchDayLimitMSG
|
||||||
}
|
}
|
||||||
|
// 查询该奖励所有领取总数
|
||||||
// 查先询该批次总共已领取
|
totalNum, err := dao.UserTaskRewards.Ctx(ctx).Where("reward_id = ?", reward.Id).WhereIn("status", []int{3, 6}).Count()
|
||||||
batchTotalGetNum, err := dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
|
||||||
dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where(dao.UserTaskRewards.Columns().Status, 3).WhereOr(dao.UserTaskRewards.Columns().Status, 6).
|
|
||||||
Fields(fmt.Sprintf("%s.*,%s.*", dao.Rewards.Table(), dao.UserTaskRewards.Table())).Count()
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.Errcode = -1
|
res.Errcode = -1
|
||||||
res.Errmsg = "查询该批次总共领取数量失败"
|
res.Errmsg = "查询该批次总共领取数量异常"
|
||||||
res.Datas = nil
|
res.Datas = nil
|
||||||
return &res, ecode.Fail.Sub("查询该批次总共领取数量失败")
|
return &res, ecode.Fail.Sub("查询该批次总共领取数量异常")
|
||||||
}
|
}
|
||||||
// 判断是否达到该批次总共限制
|
if totalNum >= int(reward.TotalLimit) {
|
||||||
if int(reward.TotalLimit) <= batchTotalGetNum {
|
|
||||||
res.Errcode = consts.BatchTotalLimit
|
res.Errcode = consts.BatchTotalLimit
|
||||||
res.Errmsg = consts.BatchTotalLimitMSG
|
res.Errmsg = consts.BatchTotalLimitMSG
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = dao.RewardCallback.Ctx(ctx).OmitEmptyData().Insert(do.RewardCallback{
|
_, err = dao.RewardCallback.Ctx(ctx).OmitEmptyData().Insert(do.RewardCallback{
|
||||||
OrderId: in.OrderId,
|
OrderId: in.OrderId,
|
||||||
PrizeId: in.PrizeId,
|
PrizeId: in.PrizeId,
|
||||||
@ -681,26 +833,26 @@ func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out
|
|||||||
return &res, ecode.Fail.Sub("存储奖励回调数据异常")
|
return &res, ecode.Fail.Sub("存储奖励回调数据异常")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回调成功,组装响应参数
|
//// 回调成功,组装响应参数
|
||||||
var userTaskReward []*model.UserTaskRewards
|
//var userTaskReward []*model.UserTaskRewards
|
||||||
if err = dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.%s = %s.%s",
|
//if err = dao.Rewards.Ctx(ctx).Where(dao.Rewards.Columns().PrizeId, in.PrizeId).InnerJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("%s.%s = %s.%s",
|
||||||
dao.Rewards.Table(), dao.Rewards.Columns().Id, dao.UserTaskRewards.Table(), dao.UserTaskRewards.Columns().RewardId)).Scan(&userTaskReward); err != nil {
|
// dao.Rewards.Table(), dao.Rewards.Columns().Id, dao.UserTaskRewards.Table(), dao.UserTaskRewards.Columns().RewardId)).Scan(&userTaskReward); err != nil {
|
||||||
return nil, ecode.Fail.Sub("获取用户奖励记录异常")
|
// return nil, ecode.Fail.Sub("获取用户奖励记录异常")
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
if userTaskReward == nil {
|
//if userTaskReward == nil {
|
||||||
res.Errcode = -1
|
// res.Errcode = -1
|
||||||
res.Errmsg = "用户奖励记录为空"
|
// res.Errmsg = "用户奖励记录为空"
|
||||||
res.Datas = nil
|
// res.Datas = nil
|
||||||
return &res, ecode.Fail.Sub("用户奖励记录为空")
|
// return &res, ecode.Fail.Sub("用户奖励记录为空")
|
||||||
}
|
//}
|
||||||
|
|
||||||
callbackData := make([]model.CallbackData, 0)
|
callbackData := make([]model.CallbackData, 0)
|
||||||
for _, v := range userTaskReward {
|
//for _, v := range userTaskReward {
|
||||||
callbackData = append(callbackData, model.CallbackData{
|
callbackData = append(callbackData, model.CallbackData{
|
||||||
PrizeCode: v.InnerOrderId,
|
PrizeCode: "rewardlsseew0rt70db0lhtazmicw50082uudq",
|
||||||
})
|
})
|
||||||
}
|
//}
|
||||||
|
|
||||||
res.Datas = callbackData
|
res.Datas = callbackData
|
||||||
|
|
||||||
|
|||||||
@ -354,7 +354,19 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
}
|
}
|
||||||
var userTask []*model.UserTask
|
var userTask []*model.UserTask
|
||||||
|
|
||||||
err = dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: in.TaskId, StoreId: storeId, GameId: in.GameId}).WhereNot("status", 3).Scan(&userTask)
|
// 根据任务类型判断是否存在该任务
|
||||||
|
if in.TaskType == 1 {
|
||||||
|
now := time.Now()
|
||||||
|
// 当天开始时间
|
||||||
|
start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||||
|
// 当天结束时间
|
||||||
|
end := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location())
|
||||||
|
err = dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: in.TaskId, StoreId: storeId, GameId: in.GameId}).
|
||||||
|
WhereBetween(dao.UserTasks.Columns().CreatedAt, start, end).WhereNot("status", 3).Scan(&userTask)
|
||||||
|
} else {
|
||||||
|
err = dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: in.TaskId, StoreId: storeId, GameId: in.GameId}).WhereNot("status", 3).Scan(&userTask)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("查询用户该任务记录失败")
|
return nil, ecode.Fail.Sub("查询用户该任务记录失败")
|
||||||
}
|
}
|
||||||
@ -379,6 +391,7 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
SerialNumber: serialNumber,
|
SerialNumber: serialNumber,
|
||||||
TaskName: in.TaskName,
|
TaskName: in.TaskName,
|
||||||
GameId: in.GameId,
|
GameId: in.GameId,
|
||||||
|
TaskType: in.TaskType,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ecode.Fail.Sub("创建用户任务记录失败")
|
return ecode.Fail.Sub("创建用户任务记录失败")
|
||||||
@ -442,7 +455,6 @@ func (s *sTask) GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRe
|
|||||||
|
|
||||||
// GetTaskList PC-WEB获取任务列表
|
// GetTaskList PC-WEB获取任务列表
|
||||||
func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out *model.GetTaskListV2Out, err error) {
|
func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out *model.GetTaskListV2Out, err error) {
|
||||||
|
|
||||||
var tasks []model.Task
|
var tasks []model.Task
|
||||||
var pageIdx string
|
var pageIdx string
|
||||||
var data []model.GameTask
|
var data []model.GameTask
|
||||||
@ -459,10 +471,13 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
return nil, ecode.Fail.Sub("解析任务信息失败")
|
return nil, ecode.Fail.Sub("解析任务信息失败")
|
||||||
}
|
}
|
||||||
tasks[i].Task = ""
|
tasks[i].Task = ""
|
||||||
|
for _, i3 := range tasks[i].TaskRewards {
|
||||||
|
tasks[i].GameTask.Reward = append(tasks[i].GameTask.Reward, i3.Rewards)
|
||||||
|
}
|
||||||
|
data = append(data, tasks[i].GameTask)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &model.GetTaskListV2Out{
|
return &model.GetTaskListV2Out{
|
||||||
Data: tasks,
|
Data: data,
|
||||||
}, nil
|
}, nil
|
||||||
} else {
|
} else {
|
||||||
// 已绑定
|
// 已绑定
|
||||||
@ -515,16 +530,18 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
//任务状态=1或者2不做操作,其他查询门店奖励是否全部领取
|
//任务状态=1或者2不做操作,其他查询门店奖励是否全部领取
|
||||||
if task.Status != 1 && task.Status != 2 {
|
if task.Status != 1 && task.Status != 2 {
|
||||||
count, err := dao.UserTasks.Ctx(ctx).Where(dao.UserTasks.Columns().TaskId, task.TaskID).Where(dao.UserTasks.Columns().UserId, in.UserId).LeftJoin(dao.UserTaskRewards.Table(),
|
count, err := dao.UserTasks.Ctx(ctx).Where(dao.UserTasks.Columns().TaskId, task.TaskID).Where(dao.UserTasks.Columns().UserId, in.UserId).LeftJoin(dao.UserTaskRewards.Table(),
|
||||||
fmt.Sprintf("%s.user_tasks_id = %s.id", dao.UserTaskRewards.Table(), dao.UserTasks.Table())).LeftJoin(dao.Rewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
fmt.Sprintf("%s.user_task_id = %s.id", dao.UserTaskRewards.Table(), dao.UserTasks.Table())).LeftJoin(dao.Rewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
||||||
dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where(dao.Rewards.Columns().Source, 2).Where(dao.UserTaskRewards.Columns().Status, 2).Count()
|
dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where("rewards.source", 2).Where(dao.UserTaskRewards.Columns().Status, 2).Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("查询用户门店任务奖励失败")
|
return nil, ecode.Fail.Sub("查询用户门店任务奖励失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
tasks[i].Status = 2
|
result.TaskList[i].Status = 2
|
||||||
|
//tasks[i].Status = 2
|
||||||
} else {
|
} else {
|
||||||
tasks[i].Status = 3
|
result.TaskList[i].Status = 3
|
||||||
|
//tasks[i].Status = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else {
|
//else {
|
||||||
|
|||||||
@ -20,4 +20,5 @@ type RewardTypes struct {
|
|||||||
UpdatedAt *gtime.Time // 更新时间
|
UpdatedAt *gtime.Time // 更新时间
|
||||||
DeletedAt *gtime.Time // 软删除时间
|
DeletedAt *gtime.Time // 软删除时间
|
||||||
TencentTypeId interface{} // 腾讯类型 id
|
TencentTypeId interface{} // 腾讯类型 id
|
||||||
|
Source interface{} // 来源1:系统 2:门店
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,4 +24,5 @@ type UserTasks struct {
|
|||||||
StoreId interface{} // 门店 id
|
StoreId interface{} // 门店 id
|
||||||
TaskName interface{} // 任务名称
|
TaskName interface{} // 任务名称
|
||||||
GameId interface{} // 游戏 id
|
GameId interface{} // 游戏 id
|
||||||
|
TaskType interface{} // 1: 每日任务 3: 周期任务
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,13 @@ import (
|
|||||||
|
|
||||||
// RewardTypes is the golang structure for table reward_types.
|
// RewardTypes is the golang structure for table reward_types.
|
||||||
type RewardTypes struct {
|
type RewardTypes struct {
|
||||||
Id int64 `json:"id" orm:"id" description:"奖励类型ID"` // 奖励类型ID
|
Id int64 `json:"id" orm:"id" description:"奖励类型ID"` // 奖励类型ID
|
||||||
Name string `json:"name" orm:"name" description:"类型名称"` // 类型名称
|
Name string `json:"name" orm:"name" description:"类型名称"` // 类型名称
|
||||||
Code string `json:"code" orm:"code" description:"唯一编码"` // 唯一编码
|
Code string `json:"code" orm:"code" description:"唯一编码"` // 唯一编码
|
||||||
IconUrl string `json:"iconUrl" orm:"icon_url" description:"图标链接地址"` // 图标链接地址
|
IconUrl string `json:"iconUrl" orm:"icon_url" description:"图标链接地址"` // 图标链接地址
|
||||||
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:"软删除时间"` // 软删除时间
|
||||||
TencentTypeId int `json:"tencentTypeId" orm:"tencent_type_id" description:"腾讯类型 id"` // 腾讯类型 id
|
TencentTypeId int `json:"tencentTypeId" orm:"tencent_type_id" description:"腾讯类型 id"` // 腾讯类型 id
|
||||||
|
Source int64 `json:"source" orm:"source" description:"来源1:系统 2:门店"` // 来源1:系统 2:门店
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,4 +22,5 @@ type UserTasks struct {
|
|||||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||||
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
|
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
|
||||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
||||||
|
TaskType int64 `json:"taskType" orm:"task_type" description:"1: 每日任务 3: 周期任务"` // 1: 每日任务 3: 周期任务
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,11 +38,11 @@ type GameTask struct {
|
|||||||
CycleEnd int64 `json:"cycle_end"`
|
CycleEnd int64 `json:"cycle_end"`
|
||||||
TargetName string `json:"target_name"`
|
TargetName string `json:"target_name"`
|
||||||
TargetTimes int `json:"target_times"`
|
TargetTimes int `json:"target_times"`
|
||||||
Status int `json:"status,omitempty"`
|
Status int `json:"status"`
|
||||||
UserTimes int64 `json:"user_times,omitempty"`
|
UserTimes int64 `json:"user_times"`
|
||||||
GameTaskConfig GameTaskConfig `json:"game_task_config"`
|
GameTaskConfig GameTaskConfig `json:"game_task_config"`
|
||||||
GameTaskConfigParse GameTaskConfigParse `json:"game_task_config_parse"`
|
GameTaskConfigParse GameTaskConfigParse `json:"game_task_config_parse"`
|
||||||
Reward []SimpleReward `json:"reward,omitempty"`
|
Reward []SimpleReward `json:"reward"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GameTaskResponse struct {
|
type GameTaskResponse struct {
|
||||||
|
|||||||
@ -34,18 +34,23 @@ type Reward struct {
|
|||||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间(软删除)"` // 删除时间(软删除)
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间(软删除)"` // 删除时间(软删除)
|
||||||
}
|
}
|
||||||
type SimpleReward struct {
|
type SimpleReward struct {
|
||||||
g.Meta `orm:"table:rewards"`
|
g.Meta `orm:"table:rewards"`
|
||||||
Id int64 `json:"id" orm:"id" description:"奖励ID"` // 奖励ID
|
Id int64 `json:"id" orm:"id" description:"奖励ID"` // 奖励ID
|
||||||
Name string `json:"name" orm:"name" description:"奖励名称"` // 奖励名称
|
Name string `json:"name" orm:"name" description:"奖励名称"` // 奖励名称
|
||||||
RewardTypeId int64 `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID,关联 reward_types 表"` // 奖励类型ID,关联 reward_types 表
|
RewardTypeId int64 `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID,关联 reward_types 表"` // 奖励类型ID,关联 reward_types 表
|
||||||
Source int `json:"source" orm:"source" description:"奖励来源,1=系统奖励(对接腾讯),2=门店追加"` // 奖励来源,1=系统奖励(对接腾讯),2=门店追加
|
Source int `json:"source" orm:"source" description:"奖励来源,1=系统奖励(对接腾讯),2=门店追加"` // 奖励来源,1=系统奖励(对接腾讯),2=门店追加
|
||||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏ID"` // 游戏ID
|
GameId int64 `json:"gameId" orm:"game_id" description:"游戏ID"` // 游戏ID
|
||||||
ImageUrl string `json:"imageUrl" orm:"image_url" description:"奖励图片链接"` // 奖励图片链接
|
ImageUrl string `json:"imageUrl" orm:"image_url" description:"奖励图片链接"` // 奖励图片链接
|
||||||
ExpireType int `json:"expireType" orm:"expire_type" description:"过期方式:1=时间段过期,2=领取后过期"` // 过期方式:1=时间段过期,2=领取后过期
|
ExpireType int `json:"expireType" orm:"expire_type" description:"过期方式:1=时间段过期,2=领取后过期"` // 过期方式:1=时间段过期,2=领取后过期
|
||||||
ValidFrom *gtime.Time `json:"validFrom" orm:"valid_from" description:"有效期开始时间(expire_type=1时)"` // 有效期开始时间(expire_type=1时)
|
ValidFrom *gtime.Time `json:"validFrom" orm:"valid_from" description:"有效期开始时间(expire_type=1时)"` // 有效期开始时间(expire_type=1时)
|
||||||
ValidTo *gtime.Time `json:"validTo" orm:"valid_to" description:"有效期结束时间(expire_type=1时)"` // 有效期结束时间(expire_type=1时)
|
ValidTo *gtime.Time `json:"validTo" orm:"valid_to" description:"有效期结束时间(expire_type=1时)"` // 有效期结束时间(expire_type=1时)
|
||||||
ExpireDays int `json:"expireDays" orm:"expire_days" description:"领取后多少天过期(expire_type=2时)"` // 领取后多少天过期(expire_type=2时)
|
ExpireDays int `json:"expireDays" orm:"expire_days" description:"领取后多少天过期(expire_type=2时)"` // 领取后多少天过期(expire_type=2时)
|
||||||
|
DailyTotalLimit uint64 `json:"dailyTotalLimit" orm:"daily_total_limit" description:"每日发放总限(NULL表示不限制)"` // 每日发放总限(NULL表示不限制)
|
||||||
|
TotalLimit uint64 `json:"totalLimit" orm:"total_limit" description:"奖励总限(NULL表示不限制)"` // 奖励总限(NULL表示不限制)
|
||||||
|
UserDailyLimit uint64 `json:"userDailyLimit" orm:"user_daily_limit" description:"用户每日领取限制(NULL表示不限制)"` // 用户每日领取限制(NULL表示不限制)
|
||||||
|
UserTotalLimit uint64 `json:"userTotalLimit" orm:"user_total_limit" description:"用户领取总次数限制(NULL表示不限制)"` // 用户领取总次数限制(NULL表示不限制)
|
||||||
|
ReceivedNum uint64 `json:"receivedNum" orm:"received_num" description:"已领取数量"` // 已领取数量
|
||||||
|
//GrantQuantity uint64 `json:"grantQuantity" orm:"grant_quantity" description:"每次发放个数"` // 每次发放个数
|
||||||
}
|
}
|
||||||
|
|
||||||
// RewardCreateIn 创建奖励入参
|
// RewardCreateIn 创建奖励入参
|
||||||
|
|||||||
@ -6,13 +6,14 @@ import (
|
|||||||
|
|
||||||
// RewardType 奖励类型表
|
// RewardType 奖励类型表
|
||||||
type RewardType struct {
|
type RewardType struct {
|
||||||
Id int64 `json:"id" orm:"id" description:"奖励类型ID"` // 奖励类型ID
|
Id int64 `json:"id" orm:"id" description:"奖励类型ID"` // 奖励类型ID
|
||||||
Name string `json:"name" orm:"name" description:"类型名称"` // 类型名称
|
Name string `json:"name" orm:"name" description:"类型名称"` // 类型名称
|
||||||
Code string `json:"code" orm:"code" description:"唯一编码"` // 唯一编码
|
Code string `json:"code" orm:"code" description:"唯一编码"` // 唯一编码
|
||||||
IconUrl string `json:"iconUrl" orm:"icon_url" description:"图标链接地址"` // 图标链接地址
|
IconUrl string `json:"iconUrl" orm:"icon_url" description:"图标链接地址"` // 图标链接地址
|
||||||
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:"软删除时间"` // 软删除时间
|
||||||
|
TencentTypeId int `json:"tencentTypeId" orm:"tencent_type_id" description:"腾讯奖励类型ID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RewardTypeCreateIn 创建奖励类型入参
|
// RewardTypeCreateIn 创建奖励类型入参
|
||||||
|
|||||||
@ -26,9 +26,9 @@ type UserTask struct {
|
|||||||
|
|
||||||
type TaskReward struct {
|
type TaskReward struct {
|
||||||
g.Meta `orm:"table:task_rewards"`
|
g.Meta `orm:"table:task_rewards"`
|
||||||
TaskId string `json:"-" orm:"task_id"`
|
TaskId string `json:"-" orm:"task_id"`
|
||||||
RewardId int64 `json:"-" orm:"reward_id"`
|
RewardId int64 `json:"-" orm:"reward_id"`
|
||||||
Rewards Reward `json:"reward" orm:"with:id=reward_id"`
|
Rewards SimpleReward `json:"reward" orm:"with:id=reward_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserTask2 struct {
|
type UserTask2 struct {
|
||||||
@ -88,6 +88,7 @@ type GetTaskIn struct {
|
|||||||
UserId int `json:"userId"`
|
UserId int `json:"userId"`
|
||||||
TaskName string `json:"taskName"`
|
TaskName string `json:"taskName"`
|
||||||
GameId int `json:"gid"`
|
GameId int `json:"gid"`
|
||||||
|
TaskType int `json:"taskType"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetTaskOut struct {
|
type GetTaskOut struct {
|
||||||
|
|||||||
@ -501,3 +501,7 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
|||||||
return nil, ecode.Fail.Sub(fmt.Sprintf("不支持的任务: %s", in.ServiceName))
|
return nil, ecode.Fail.Sub(fmt.Sprintf("不支持的任务: %s", in.ServiceName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *gamelifeClient) GetSecret() string {
|
||||||
|
return s.config.Secret
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user