调整任务存储,任务查询
This commit is contained in:
@ -212,9 +212,9 @@ type CallbackRes struct {
|
|||||||
|
|
||||||
type GetLiftReq struct {
|
type GetLiftReq struct {
|
||||||
g.Meta `path:"/reward/getLift" method:"post" tags:"PC/Reward" summary:"(PC)奖励领取"`
|
g.Meta `path:"/reward/getLift" method:"post" tags:"PC/Reward" summary:"(PC)奖励领取"`
|
||||||
RewradType int `json:"rewardType" v:"required#奖励类型不能为空" dc:"奖励类型"`
|
RewardType int `json:"rewardType" dc:"奖励类型"`
|
||||||
RewradId int `json:"rewardId" v:"required#奖励id不能为空" dc:"奖励id"`
|
RewardId int `json:"rewardId" v:"required#奖励id不能为空" dc:"奖励id"`
|
||||||
PopenId string `json:"popenid" v:"required#popenId不能为空" dc:"popenId不能为空"`
|
PopenId string `json:"popenId" v:"required#popenId不能为空" dc:"popenId不能为空"`
|
||||||
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1:系统 2:门店"`
|
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1:系统 2:门店"`
|
||||||
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
|
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
|
||||||
GameId int `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"`
|
GameId int `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"`
|
||||||
|
|||||||
@ -100,3 +100,17 @@ type GetUserTaskRecordsListRes struct {
|
|||||||
List interface{} `json:"list"`
|
List interface{} `json:"list"`
|
||||||
Total int `json:"total"`
|
Total int `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetTaskListReq struct {
|
||||||
|
g.Meta `path:"/task/list" method:"get" tags:"Backend-PC/Task" summary:"任务列表"`
|
||||||
|
}
|
||||||
|
type GetTaskListRes struct {
|
||||||
|
List interface{} `json:"list"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SyncTaskReq struct {
|
||||||
|
g.Meta `path:"/task/sync" method:"post" tags:"Backend/Task" summary:"同步任务"`
|
||||||
|
}
|
||||||
|
type SyncTaskRes struct {
|
||||||
|
}
|
||||||
|
|||||||
@ -15,14 +15,14 @@ func (c *ControllerV1) GetLift(ctx context.Context, req *v1.GetLiftReq) (res *v1
|
|||||||
GameId: req.GameId,
|
GameId: req.GameId,
|
||||||
TaskId: req.TaskId,
|
TaskId: req.TaskId,
|
||||||
PopenId: req.PopenId,
|
PopenId: req.PopenId,
|
||||||
RewradTypeId: req.RewradType,
|
RewradTypeId: req.RewardType,
|
||||||
RoleIdx: req.RoleIdx,
|
RoleIdx: req.RoleIdx,
|
||||||
AreaId: req.AreaId,
|
AreaId: req.AreaId,
|
||||||
Source: req.Source,
|
Source: req.Source,
|
||||||
BindType: req.BindType,
|
BindType: req.BindType,
|
||||||
UserTaskId: req.UserTaskId,
|
UserTaskId: req.UserTaskId,
|
||||||
UserId: userId.Int(),
|
UserId: userId.Int(),
|
||||||
RewardId: req.RewradId,
|
RewardId: req.RewardId,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -27,15 +27,9 @@ type TasksColumns struct {
|
|||||||
DeletedAt string // 软删除时间戳
|
DeletedAt string // 软删除时间戳
|
||||||
GameId string // 游戏唯一id
|
GameId string // 游戏唯一id
|
||||||
StoreId string // 门店 id
|
StoreId string // 门店 id
|
||||||
Status string // 1:启用 2:禁用
|
NetbarAcconut string // 网关
|
||||||
QqNetbarTaskId string // QQ网吧任务ID
|
TaskId string // 任务 id
|
||||||
QqNetbarTaskRules string // 任务规则
|
Task string // 任务
|
||||||
QqNetbarTaskMemo string // 任务描述
|
|
||||||
QqNetbarTaskName string // QQ网吧任务名称
|
|
||||||
QqNetbarReward string // qq 网吧奖励名称
|
|
||||||
QqNetbarTargetTime string // qq 网吧任务指标
|
|
||||||
StartTime string // 任务开始时间
|
|
||||||
EndTime string // 任务结束时间
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tasksColumns holds the columns for the table tasks.
|
// tasksColumns holds the columns for the table tasks.
|
||||||
@ -46,15 +40,9 @@ var tasksColumns = TasksColumns{
|
|||||||
DeletedAt: "deleted_at",
|
DeletedAt: "deleted_at",
|
||||||
GameId: "game_id",
|
GameId: "game_id",
|
||||||
StoreId: "store_id",
|
StoreId: "store_id",
|
||||||
Status: "status",
|
NetbarAcconut: "netbar_acconut",
|
||||||
QqNetbarTaskId: "qq_netbar_task_id",
|
TaskId: "task_id",
|
||||||
QqNetbarTaskRules: "qq_netbar_task_rules",
|
Task: "task",
|
||||||
QqNetbarTaskMemo: "qq_netbar_task_memo",
|
|
||||||
QqNetbarTaskName: "qq_netbar_task_name",
|
|
||||||
QqNetbarReward: "qq_netbar_reward",
|
|
||||||
QqNetbarTargetTime: "qq_netbar_target_time",
|
|
||||||
StartTime: "start_time",
|
|
||||||
EndTime: "end_time",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTasksDao creates and returns a new DAO object for table data access.
|
// NewTasksDao creates and returns a new DAO object for table data access.
|
||||||
|
|||||||
@ -24,7 +24,7 @@ type UserTasksColumns struct {
|
|||||||
Id string // 用户任务唯一标识符
|
Id string // 用户任务唯一标识符
|
||||||
UserId string // 用户ID
|
UserId string // 用户ID
|
||||||
TaskId string // 腾讯任务ID
|
TaskId string // 腾讯任务ID
|
||||||
Status string // 任务状态:1=进行中,2=已完成中,3=未完成
|
Status string // 任务状态:1=进行中,2=已完成,3=待领取奖励
|
||||||
SerialNumber string // 流水号,确保用户任务唯一性
|
SerialNumber string // 流水号,确保用户任务唯一性
|
||||||
CreatedAt string // 创建时间
|
CreatedAt string // 创建时间
|
||||||
UpdatedAt string // 更新时间
|
UpdatedAt string // 更新时间
|
||||||
|
|||||||
@ -353,7 +353,7 @@ func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *mode
|
|||||||
// 判断奖励类型
|
// 判断奖励类型
|
||||||
if in.Source == 1 {
|
if in.Source == 1 {
|
||||||
// 系统奖励处理
|
// 系统奖励处理
|
||||||
if in.RewradTypeId != 16 {
|
if in.RewradTypeId == 16 {
|
||||||
// 需要大区角色
|
// 需要大区角色
|
||||||
giftParam.AreaId = in.AreaId
|
giftParam.AreaId = in.AreaId
|
||||||
giftParam.Gid = in.GameId
|
giftParam.Gid = in.GameId
|
||||||
@ -380,6 +380,10 @@ func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *mode
|
|||||||
return nil, ecode.Fail.Sub("数据类型转换失败")
|
return nil, ecode.Fail.Sub("数据类型转换失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(result.GiftItem) == 0 {
|
||||||
|
return nil, ecode.Fail.Sub("奖励领取异常")
|
||||||
|
}
|
||||||
|
|
||||||
// 存储数据库记录
|
// 存储数据库记录
|
||||||
if err = dao.RewardWaters.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
if err = dao.RewardWaters.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||||
for _, item := range result.GiftItem {
|
for _, item := range result.GiftItem {
|
||||||
|
|||||||
@ -18,13 +18,7 @@ type Tasks struct {
|
|||||||
DeletedAt *gtime.Time // 软删除时间戳
|
DeletedAt *gtime.Time // 软删除时间戳
|
||||||
GameId interface{} // 游戏唯一id
|
GameId interface{} // 游戏唯一id
|
||||||
StoreId interface{} // 门店 id
|
StoreId interface{} // 门店 id
|
||||||
Status interface{} // 1:启用 2:禁用
|
NetbarAcconut interface{} // 网关
|
||||||
QqNetbarTaskId interface{} // QQ网吧任务ID
|
TaskId interface{} // 任务 id
|
||||||
QqNetbarTaskRules interface{} // 任务规则
|
Task interface{} // 任务
|
||||||
QqNetbarTaskMemo interface{} // 任务描述
|
|
||||||
QqNetbarTaskName interface{} // QQ网吧任务名称
|
|
||||||
QqNetbarReward interface{} // qq 网吧奖励名称
|
|
||||||
QqNetbarTargetTime interface{} // qq 网吧任务指标
|
|
||||||
StartTime interface{} // 任务开始时间
|
|
||||||
EndTime interface{} // 任务结束时间
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ type UserTasks struct {
|
|||||||
Id interface{} // 用户任务唯一标识符
|
Id interface{} // 用户任务唯一标识符
|
||||||
UserId interface{} // 用户ID
|
UserId interface{} // 用户ID
|
||||||
TaskId interface{} // 腾讯任务ID
|
TaskId interface{} // 腾讯任务ID
|
||||||
Status interface{} // 任务状态:1=进行中,2=已完成中,3=未完成
|
Status interface{} // 任务状态:1=进行中,2=已完成,3=待领取奖励
|
||||||
SerialNumber interface{} // 流水号,确保用户任务唯一性
|
SerialNumber interface{} // 流水号,确保用户任务唯一性
|
||||||
CreatedAt *gtime.Time // 创建时间
|
CreatedAt *gtime.Time // 创建时间
|
||||||
UpdatedAt *gtime.Time // 更新时间
|
UpdatedAt *gtime.Time // 更新时间
|
||||||
|
|||||||
@ -16,13 +16,7 @@ type Tasks struct {
|
|||||||
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
|
GameId int64 `json:"gameId" orm:"game_id" description:"游戏唯一id"` // 游戏唯一id
|
||||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||||
Status int `json:"status" orm:"status" description:"1:启用 2:禁用"` // 1:启用 2:禁用
|
NetbarAcconut string `json:"netbarAcconut" orm:"netbar_acconut" description:"网关"` // 网关
|
||||||
QqNetbarTaskId string `json:"qqNetbarTaskId" orm:"qq_netbar_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID
|
TaskId string `json:"taskId" orm:"task_id" description:"任务 id"` // 任务 id
|
||||||
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" description:"任务规则"` // 任务规则
|
Task string `json:"task" orm:"task" description:"任务"` // 任务
|
||||||
QqNetbarTaskMemo string `json:"qqNetbarTaskMemo" orm:"qq_netbar_task_memo" description:"任务描述"` // 任务描述
|
|
||||||
QqNetbarTaskName string `json:"qqNetbarTaskName" orm:"qq_netbar_task_name" description:"QQ网吧任务名称"` // QQ网吧任务名称
|
|
||||||
QqNetbarReward string `json:"qqNetbarReward" orm:"qq_netbar_reward" description:"qq 网吧奖励名称"` // qq 网吧奖励名称
|
|
||||||
QqNetbarTargetTime int `json:"qqNetbarTargetTime" orm:"qq_netbar_target_time" description:"qq 网吧任务指标"` // qq 网吧任务指标
|
|
||||||
StartTime int64 `json:"startTime" orm:"start_time" description:"任务开始时间"` // 任务开始时间
|
|
||||||
EndTime int64 `json:"endTime" orm:"end_time" description:"任务结束时间"` // 任务结束时间
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ type UserTasks struct {
|
|||||||
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
||||||
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
|
||||||
TaskId string `json:"taskId" orm:"task_id" description:"腾讯任务ID"` // 腾讯任务ID
|
TaskId string `json:"taskId" orm:"task_id" description:"腾讯任务ID"` // 腾讯任务ID
|
||||||
Status int `json:"status" orm:"status" description:"任务状态:1=进行中,2=已完成中,3=未完成"` // 任务状态:1=进行中,2=已完成中,3=未完成
|
Status int `json:"status" orm:"status" description:"任务状态:1=进行中,2=已完成,3=待领取奖励"` // 任务状态:1=进行中,2=已完成,3=待领取奖励
|
||||||
SerialNumber string `json:"serialNumber" orm:"serial_number" description:"流水号,确保用户任务唯一性"` // 流水号,确保用户任务唯一性
|
SerialNumber string `json:"serialNumber" orm:"serial_number" 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:"更新时间"` // 更新时间
|
||||||
|
|||||||
@ -414,7 +414,7 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var result model.GiftResponse
|
var result *model.GiftResponse
|
||||||
resp, err := client.R().
|
resp, err := client.R().
|
||||||
SetContext(ctx).
|
SetContext(ctx).
|
||||||
SetBody(in.GiftParam).
|
SetBody(in.GiftParam).
|
||||||
@ -423,7 +423,10 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
|||||||
if err != nil || resp.IsError() {
|
if err != nil || resp.IsError() {
|
||||||
return nil, ecode.Fail.Sub("请求出现异常")
|
return nil, ecode.Fail.Sub("请求出现异常")
|
||||||
}
|
}
|
||||||
return &result, nil
|
if result == nil {
|
||||||
|
return nil, ecode.Fail.Sub("请求结果为空")
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
case consts.QueryUserGoodsList:
|
case consts.QueryUserGoodsList:
|
||||||
value, err := dao.Games.Ctx(ctx).Where(do.Games{GameId: in.GoodsParam.Gid}).Fields(dao.Games.Columns().GameCode).Value()
|
value, err := dao.Games.Ctx(ctx).Where(do.Games{GameId: in.GoodsParam.Gid}).Fields(dao.Games.Columns().GameCode).Value()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -48,7 +48,7 @@ func init() {
|
|||||||
// 游戏列表
|
// 游戏列表
|
||||||
enforcer.AddPolicy("guest", "/x/game", "GET", "获取游戏列表")
|
enforcer.AddPolicy("guest", "/x/game", "GET", "获取游戏列表")
|
||||||
enforcer.AddPolicy("guest", "/x/reward/callback", "POST", "tencent奖励回调")
|
enforcer.AddPolicy("guest", "/x/reward/callback", "POST", "tencent奖励回调")
|
||||||
enforcer.AddPolicy("guest", "/x/reward/getLift", "POST", "tencent奖励领取")
|
enforcer.AddPolicy("user", "/x/reward/getLift", "POST", "tencent奖励领取")
|
||||||
enforcer.AddPolicy("guest", "/x/reward/goodsDetails", "POST", "获取物品详情")
|
enforcer.AddPolicy("guest", "/x/reward/goodsDetails", "POST", "获取物品详情")
|
||||||
}
|
}
|
||||||
// 用户
|
// 用户
|
||||||
|
|||||||
Reference in New Issue
Block a user