任务列表新增 qq网吧奖励名称,状态
This commit is contained in:
@ -13,9 +13,10 @@ import (
|
||||
|
||||
// RewardTypesDao is the data access object for the table reward_types.
|
||||
type RewardTypesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// RewardTypesColumns defines and stores column names for the table reward_types.
|
||||
@ -45,11 +46,12 @@ var rewardTypesColumns = RewardTypesColumns{
|
||||
}
|
||||
|
||||
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
||||
func NewRewardTypesDao() *RewardTypesDao {
|
||||
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
|
||||
return &RewardTypesDao{
|
||||
group: "default",
|
||||
table: "reward_types",
|
||||
columns: rewardTypesColumns,
|
||||
group: "default",
|
||||
table: "reward_types",
|
||||
columns: rewardTypesColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +77,11 @@ func (dao *RewardTypesDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,9 +13,10 @@ import (
|
||||
|
||||
// RewardsDao is the data access object for the table rewards.
|
||||
type RewardsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// RewardsColumns defines and stores column names for the table rewards.
|
||||
@ -49,11 +50,12 @@ var rewardsColumns = RewardsColumns{
|
||||
}
|
||||
|
||||
// NewRewardsDao creates and returns a new DAO object for table data access.
|
||||
func NewRewardsDao() *RewardsDao {
|
||||
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
|
||||
return &RewardsDao{
|
||||
group: "default",
|
||||
table: "rewards",
|
||||
columns: rewardsColumns,
|
||||
group: "default",
|
||||
table: "rewards",
|
||||
columns: rewardsColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +81,11 @@ func (dao *RewardsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,9 +13,10 @@ import (
|
||||
|
||||
// StoreTaskRewardsDao is the data access object for the table store_task_rewards.
|
||||
type StoreTaskRewardsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards.
|
||||
@ -45,11 +46,12 @@ var storeTaskRewardsColumns = StoreTaskRewardsColumns{
|
||||
}
|
||||
|
||||
// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreTaskRewardsDao() *StoreTaskRewardsDao {
|
||||
func NewStoreTaskRewardsDao(handlers ...gdb.ModelHandler) *StoreTaskRewardsDao {
|
||||
return &StoreTaskRewardsDao{
|
||||
group: "default",
|
||||
table: "store_task_rewards",
|
||||
columns: storeTaskRewardsColumns,
|
||||
group: "default",
|
||||
table: "store_task_rewards",
|
||||
columns: storeTaskRewardsColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +77,11 @@ func (dao *StoreTaskRewardsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoreTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -31,6 +31,8 @@ type TasksColumns struct {
|
||||
QqNetbarTaskRules string // 任务规则
|
||||
GameId string // 游戏唯一id
|
||||
StoreId string // 门店 id
|
||||
QqNetbarReward string //
|
||||
Status string // 1:启用 2:禁用
|
||||
}
|
||||
|
||||
// tasksColumns holds the columns for the table tasks.
|
||||
@ -45,6 +47,8 @@ var tasksColumns = TasksColumns{
|
||||
QqNetbarTaskRules: "qq_netbar_task_rules",
|
||||
GameId: "game_id",
|
||||
StoreId: "store_id",
|
||||
QqNetbarReward: "qq_netbar_reward",
|
||||
Status: "status",
|
||||
}
|
||||
|
||||
// NewTasksDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@ -13,9 +13,10 @@ import (
|
||||
|
||||
// UserTasksDao is the data access object for the table user_tasks.
|
||||
type UserTasksDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// UserTasksColumns defines and stores column names for the table user_tasks.
|
||||
@ -47,11 +48,12 @@ var userTasksColumns = UserTasksColumns{
|
||||
}
|
||||
|
||||
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
||||
func NewUserTasksDao() *UserTasksDao {
|
||||
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
|
||||
return &UserTasksDao{
|
||||
group: "default",
|
||||
table: "user_tasks",
|
||||
columns: userTasksColumns,
|
||||
group: "default",
|
||||
table: "user_tasks",
|
||||
columns: userTasksColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +79,11 @@ func (dao *UserTasksDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -140,7 +140,6 @@ func (s *sTask) UserTaskRankingList(ctx context.Context, in *model.UserTaskRanki
|
||||
// GetNonLoginTaskList 获取下发到指定网吧的任务列表(未登录)
|
||||
func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTaskListIn) (out *model.GetNonLoginTaskListOut, err error) {
|
||||
|
||||
// TODO 调用外部接口
|
||||
// 调用外部接口
|
||||
data, err := tencent.GetNonLoginTaskList(ctx, in)
|
||||
if err != nil {
|
||||
@ -157,7 +156,7 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTa
|
||||
return nil, ecode.Fail.Sub("当前网吧不存在")
|
||||
}
|
||||
|
||||
// TODO 任务列表数据处理
|
||||
// 任务列表数据处理
|
||||
if jsonData, ok := data.(map[string]interface{}); ok {
|
||||
// 现在可以访问 jsonData 中的字段
|
||||
list := jsonData["task_list"]
|
||||
@ -179,6 +178,14 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTa
|
||||
return nil, ecode.Fail.Sub("查询该任务失败")
|
||||
}
|
||||
|
||||
str := ""
|
||||
for i, vv := range v.PrizeList {
|
||||
str += vv.PrizeName
|
||||
if i+1 != len(v.PrizeList) {
|
||||
str += ","
|
||||
}
|
||||
}
|
||||
|
||||
// 数据库是否存在,无则添加
|
||||
if !exist {
|
||||
_, err := dao.Tasks.Ctx(ctx).Insert(do.Tasks{
|
||||
@ -188,6 +195,7 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTa
|
||||
QqNetbarTaskRules: v.QQNetBarTaskRules,
|
||||
GameId: in.Gid,
|
||||
StoreId: store.Id,
|
||||
QqNetbarReward: str,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("添加任务失败")
|
||||
@ -203,14 +211,13 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTa
|
||||
|
||||
func (s *sTask) GetLoginTaskList(ctx context.Context, in *model.GetLoginTaskListIn) (out *model.GetLoginTaskListOut, err error) {
|
||||
|
||||
// TODO 调用外部接口
|
||||
// 调用外部接口
|
||||
data, err := tencent.GetLoginTaskList(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO 任务列表数据处理
|
||||
// 任务列表数据处理
|
||||
return &model.GetLoginTaskListOut{
|
||||
Data: data,
|
||||
}, err
|
||||
|
||||
@ -22,4 +22,6 @@ type Tasks struct {
|
||||
QqNetbarTaskRules interface{} // 任务规则
|
||||
GameId interface{} // 游戏唯一id
|
||||
StoreId interface{} // 门店 id
|
||||
QqNetbarReward interface{} //
|
||||
Status interface{} // 1:启用 2:禁用
|
||||
}
|
||||
|
||||
@ -10,14 +10,16 @@ import (
|
||||
|
||||
// Tasks is the golang structure for table tasks.
|
||||
type Tasks struct {
|
||||
Id int64 `json:"id" orm:"id" description:"任务唯一标识符"` // 任务唯一标识符
|
||||
QqNetbarTaskId string `json:"qqNetbarTaskId" orm:"qq_netbar_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID
|
||||
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:"软删除时间戳"` // 软删除时间戳
|
||||
QqNetbarTaskName string `json:"qqNetbarTaskName" orm:"qq_netbar_task_name" description:"QQ网吧任务名称"` // QQ网吧任务名称
|
||||
QqNetbarTaskMemo string `json:"qqNetbarTaskMemo" orm:"qq_netbar_task_memo" description:"任务描述"` // 任务描述
|
||||
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" description:"任务规则"` // 任务规则
|
||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏唯一id"` // 游戏唯一id
|
||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||
Id int64 `json:"id" orm:"id" description:"任务唯一标识符"` // 任务唯一标识符
|
||||
QqNetbarTaskId string `json:"qqNetbarTaskId" orm:"qq_netbar_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID
|
||||
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:"软删除时间戳"` // 软删除时间戳
|
||||
QqNetbarTaskName string `json:"qqNetbarTaskName" orm:"qq_netbar_task_name" description:"QQ网吧任务名称"` // QQ网吧任务名称
|
||||
QqNetbarTaskMemo string `json:"qqNetbarTaskMemo" orm:"qq_netbar_task_memo" description:"任务描述"` // 任务描述
|
||||
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" description:"任务规则"` // 任务规则
|
||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏唯一id"` // 游戏唯一id
|
||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
|
||||
QqNetbarReward string `json:"qqNetbarReward" orm:"qq_netbar_reward" description:""` //
|
||||
Status int `json:"status" orm:"status" description:"1:启用 2:禁用"` // 1:启用 2:禁用
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@ type Tasks struct {
|
||||
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" 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:"状态"` // 状态
|
||||
QQNetBarReward string `json:"qqNetbarReward" orm:"qq_netbar_reward" description:"qq网吧奖励名称"` // 任务奖励
|
||||
}
|
||||
|
||||
type GetNonLoginTaskListIn struct {
|
||||
@ -64,6 +66,11 @@ type MyData struct {
|
||||
QQNetBarTaskName string `json:"title"`
|
||||
QQNetBarTaskRules string `json:"rule_desc"`
|
||||
//StoreId int `json:"store_id"`
|
||||
PrizeList []PrizeList `json:"prize_list"`
|
||||
}
|
||||
|
||||
type PrizeList struct {
|
||||
PrizeName string `json:"prize_name"`
|
||||
}
|
||||
|
||||
type TaskListIn struct {
|
||||
|
||||
Reference in New Issue
Block a user