调整任务存储,任务查询
This commit is contained in:
@ -212,9 +212,9 @@ type CallbackRes struct {
|
||||
|
||||
type GetLiftReq struct {
|
||||
g.Meta `path:"/reward/getLift" method:"post" tags:"PC/Reward" summary:"(PC)奖励领取"`
|
||||
RewradType int `json:"rewardType" v:"required#奖励类型不能为空" dc:"奖励类型"`
|
||||
RewradId int `json:"rewardId" v:"required#奖励id不能为空" dc:"奖励id"`
|
||||
PopenId string `json:"popenid" v:"required#popenId不能为空" dc:"popenId不能为空"`
|
||||
RewardType int `json:"rewardType" dc:"奖励类型"`
|
||||
RewardId int `json:"rewardId" v:"required#奖励id不能为空" dc:"奖励id"`
|
||||
PopenId string `json:"popenId" v:"required#popenId不能为空" dc:"popenId不能为空"`
|
||||
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1:系统 2:门店"`
|
||||
TaskId string `json:"taskId" 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"`
|
||||
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,
|
||||
TaskId: req.TaskId,
|
||||
PopenId: req.PopenId,
|
||||
RewradTypeId: req.RewradType,
|
||||
RewradTypeId: req.RewardType,
|
||||
RoleIdx: req.RoleIdx,
|
||||
AreaId: req.AreaId,
|
||||
Source: req.Source,
|
||||
BindType: req.BindType,
|
||||
UserTaskId: req.UserTaskId,
|
||||
UserId: userId.Int(),
|
||||
RewardId: req.RewradId,
|
||||
RewardId: req.RewardId,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
@ -21,40 +21,28 @@ type TasksDao struct {
|
||||
|
||||
// TasksColumns defines and stores column names for the table tasks.
|
||||
type TasksColumns struct {
|
||||
Id string // 任务唯一标识符
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
GameId string // 游戏唯一id
|
||||
StoreId string // 门店 id
|
||||
Status string // 1:启用 2:禁用
|
||||
QqNetbarTaskId string // QQ网吧任务ID
|
||||
QqNetbarTaskRules string // 任务规则
|
||||
QqNetbarTaskMemo string // 任务描述
|
||||
QqNetbarTaskName string // QQ网吧任务名称
|
||||
QqNetbarReward string // qq 网吧奖励名称
|
||||
QqNetbarTargetTime string // qq 网吧任务指标
|
||||
StartTime string // 任务开始时间
|
||||
EndTime string // 任务结束时间
|
||||
Id string // 任务唯一标识符
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
GameId string // 游戏唯一id
|
||||
StoreId string // 门店 id
|
||||
NetbarAcconut string // 网关
|
||||
TaskId string // 任务 id
|
||||
Task string // 任务
|
||||
}
|
||||
|
||||
// tasksColumns holds the columns for the table tasks.
|
||||
var tasksColumns = TasksColumns{
|
||||
Id: "id",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
GameId: "game_id",
|
||||
StoreId: "store_id",
|
||||
Status: "status",
|
||||
QqNetbarTaskId: "qq_netbar_task_id",
|
||||
QqNetbarTaskRules: "qq_netbar_task_rules",
|
||||
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",
|
||||
Id: "id",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
GameId: "game_id",
|
||||
StoreId: "store_id",
|
||||
NetbarAcconut: "netbar_acconut",
|
||||
TaskId: "task_id",
|
||||
Task: "task",
|
||||
}
|
||||
|
||||
// NewTasksDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@ -24,7 +24,7 @@ type UserTasksColumns struct {
|
||||
Id string // 用户任务唯一标识符
|
||||
UserId string // 用户ID
|
||||
TaskId string // 腾讯任务ID
|
||||
Status string // 任务状态:1=进行中,2=已完成中,3=未完成
|
||||
Status string // 任务状态:1=进行中,2=已完成,3=待领取奖励
|
||||
SerialNumber string // 流水号,确保用户任务唯一性
|
||||
CreatedAt 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.RewradTypeId != 16 {
|
||||
if in.RewradTypeId == 16 {
|
||||
// 需要大区角色
|
||||
giftParam.AreaId = in.AreaId
|
||||
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("数据类型转换失败")
|
||||
}
|
||||
|
||||
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) {
|
||||
for _, item := range result.GiftItem {
|
||||
|
||||
@ -11,20 +11,14 @@ import (
|
||||
|
||||
// Tasks is the golang structure of table tasks for DAO operations like Where/Data.
|
||||
type Tasks struct {
|
||||
g.Meta `orm:"table:tasks, do:true"`
|
||||
Id interface{} // 任务唯一标识符
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 更新时间
|
||||
DeletedAt *gtime.Time // 软删除时间戳
|
||||
GameId interface{} // 游戏唯一id
|
||||
StoreId interface{} // 门店 id
|
||||
Status interface{} // 1:启用 2:禁用
|
||||
QqNetbarTaskId interface{} // QQ网吧任务ID
|
||||
QqNetbarTaskRules interface{} // 任务规则
|
||||
QqNetbarTaskMemo interface{} // 任务描述
|
||||
QqNetbarTaskName interface{} // QQ网吧任务名称
|
||||
QqNetbarReward interface{} // qq 网吧奖励名称
|
||||
QqNetbarTargetTime interface{} // qq 网吧任务指标
|
||||
StartTime interface{} // 任务开始时间
|
||||
EndTime interface{} // 任务结束时间
|
||||
g.Meta `orm:"table:tasks, do:true"`
|
||||
Id interface{} // 任务唯一标识符
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 更新时间
|
||||
DeletedAt *gtime.Time // 软删除时间戳
|
||||
GameId interface{} // 游戏唯一id
|
||||
StoreId interface{} // 门店 id
|
||||
NetbarAcconut interface{} // 网关
|
||||
TaskId interface{} // 任务 id
|
||||
Task interface{} // 任务
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ type UserTasks struct {
|
||||
Id interface{} // 用户任务唯一标识符
|
||||
UserId interface{} // 用户ID
|
||||
TaskId interface{} // 腾讯任务ID
|
||||
Status interface{} // 任务状态:1=进行中,2=已完成中,3=未完成
|
||||
Status interface{} // 任务状态:1=进行中,2=已完成,3=待领取奖励
|
||||
SerialNumber interface{} // 流水号,确保用户任务唯一性
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 更新时间
|
||||
|
||||
@ -10,19 +10,13 @@ import (
|
||||
|
||||
// Tasks is the golang structure for table tasks.
|
||||
type Tasks struct {
|
||||
Id int64 `json:"id" orm:"id" description:"任务唯一标识符"` // 任务唯一标识符
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||
GameId int64 `json:"gameId" orm:"game_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:禁用
|
||||
QqNetbarTaskId string `json:"qqNetbarTaskId" orm:"qq_netbar_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID
|
||||
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" 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:"任务结束时间"` // 任务结束时间
|
||||
Id int64 `json:"id" orm:"id" description:"任务唯一标识符"` // 任务唯一标识符
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏唯一id"` // 游戏唯一id
|
||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||
NetbarAcconut string `json:"netbarAcconut" orm:"netbar_acconut" description:"网关"` // 网关
|
||||
TaskId string `json:"taskId" orm:"task_id" description:"任务 id"` // 任务 id
|
||||
Task string `json:"task" orm:"task" description:"任务"` // 任务
|
||||
}
|
||||
|
||||
@ -10,16 +10,16 @@ import (
|
||||
|
||||
// UserTasks is the golang structure for table user_tasks.
|
||||
type UserTasks struct {
|
||||
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
||||
UserId int64 `json:"userId" orm:"user_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=未完成
|
||||
SerialNumber string `json:"serialNumber" orm:"serial_number" description:"流水号,确保用户任务唯一性"` // 流水号,确保用户任务唯一性
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
CompletedAt *gtime.Time `json:"completedAt" orm:"completed_at" description:"任务完成时间"` // 任务完成时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
|
||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
||||
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
||||
UserId int64 `json:"userId" orm:"user_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=待领取奖励
|
||||
SerialNumber string `json:"serialNumber" orm:"serial_number" description:"流水号,确保用户任务唯一性"` // 流水号,确保用户任务唯一性
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
CompletedAt *gtime.Time `json:"completedAt" orm:"completed_at" description:"任务完成时间"` // 任务完成时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
|
||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var result model.GiftResponse
|
||||
var result *model.GiftResponse
|
||||
resp, err := client.R().
|
||||
SetContext(ctx).
|
||||
SetBody(in.GiftParam).
|
||||
@ -423,7 +423,10 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
||||
if err != nil || resp.IsError() {
|
||||
return nil, ecode.Fail.Sub("请求出现异常")
|
||||
}
|
||||
return &result, nil
|
||||
if result == nil {
|
||||
return nil, ecode.Fail.Sub("请求结果为空")
|
||||
}
|
||||
return result, nil
|
||||
case consts.QueryUserGoodsList:
|
||||
value, err := dao.Games.Ctx(ctx).Where(do.Games{GameId: in.GoodsParam.Gid}).Fields(dao.Games.Columns().GameCode).Value()
|
||||
if err != nil {
|
||||
|
||||
@ -48,7 +48,7 @@ func init() {
|
||||
// 游戏列表
|
||||
enforcer.AddPolicy("guest", "/x/game", "GET", "获取游戏列表")
|
||||
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", "获取物品详情")
|
||||
}
|
||||
// 用户
|
||||
|
||||
Reference in New Issue
Block a user