diff --git a/api/task/task.go b/api/task/task.go index 76ea5c5..629b1e3 100644 --- a/api/task/task.go +++ b/api/task/task.go @@ -14,4 +14,5 @@ type ITaskV1 interface { Ranking(ctx context.Context, req *v1.RankingReq) (res *v1.RankingRes, err error) NonLoginTaskList(ctx context.Context, req *v1.NonLoginTaskListReq) (res *v1.NonLoginTaskListRes, err error) GetLoginTaskList(ctx context.Context, req *v1.GetLoginTaskListReq) (res *v1.GetLoginTaskListRes, err error) + List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) } diff --git a/api/task/v1/task.go b/api/task/v1/task.go index 82b4874..a137344 100644 --- a/api/task/v1/task.go +++ b/api/task/v1/task.go @@ -2,8 +2,6 @@ package v1 import "github.com/gogf/gf/v2/frame/g" -type ListReq struct { -} type RankingReq struct { g.Meta `path:"/task/ranking" method:"get" tags:"Task" summary:"(PC)任务排行榜"` StoreId int `json:"storeId" v:"required#请选择店铺" dc:"门店id"` @@ -48,3 +46,16 @@ type GetLoginTaskListReq struct { type GetLoginTaskListRes struct { Data interface{} `json:"data"` } + +type ListReq struct { + g.Meta `path:"/task/list" method:"get" tags:"Task" summary:"(PC)任务列表"` + StoreId int `json:"storeId" v:"required#门店 id不能为空" dc:"门店 id"` + Gid int `json:"gid" v:"required#游戏唯一id不能为空" dc:"游戏唯一id"` + Page int `json:"page" dc:"页数"` + Size int `json:"size" dc:"条数"` +} + +type ListRes struct { + List interface{} `json:"list"` + Total int `json:"total"` +} diff --git a/internal/controller/task/task_v1_list.go b/internal/controller/task/task_v1_list.go new file mode 100644 index 0000000..3ea86e2 --- /dev/null +++ b/internal/controller/task/task_v1_list.go @@ -0,0 +1,23 @@ +package task + +import ( + "context" + "server/internal/model" + "server/internal/service" + + "server/api/task/v1" +) + +func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) { + + out, err := service.Task().GetTaskList(ctx, &model.TaskListIn{Gid: req.Gid, StoreId: req.StoreId, Page: req.Page, Size: req.Size}) + + if err != nil { + return nil, err + } + + return &v1.ListRes{ + List: out.List, + Total: out.Total, + }, nil +} diff --git a/internal/dao/internal/admins.go b/internal/dao/internal/admins.go index 7c3f2be..dc72d15 100644 --- a/internal/dao/internal/admins.go +++ b/internal/dao/internal/admins.go @@ -13,9 +13,10 @@ import ( // AdminsDao is the data access object for the table admins. type AdminsDao 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 AdminsColumns // 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 AdminsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // AdminsColumns defines and stores column names for the table admins. @@ -49,11 +50,12 @@ var adminsColumns = AdminsColumns{ } // NewAdminsDao creates and returns a new DAO object for table data access. -func NewAdminsDao() *AdminsDao { +func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao { return &AdminsDao{ - group: "default", - table: "admins", - columns: adminsColumns, + group: "default", + table: "admins", + columns: adminsColumns, + handlers: handlers, } } @@ -79,7 +81,11 @@ func (dao *AdminsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *AdminsDao) 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. diff --git a/internal/dao/internal/feedbacks.go b/internal/dao/internal/feedbacks.go index d67a1e5..7a8d085 100644 --- a/internal/dao/internal/feedbacks.go +++ b/internal/dao/internal/feedbacks.go @@ -13,9 +13,10 @@ import ( // FeedbacksDao is the data access object for the table feedbacks. type FeedbacksDao 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 FeedbacksColumns // 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 FeedbacksColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // FeedbacksColumns defines and stores column names for the table feedbacks. @@ -51,11 +52,12 @@ var feedbacksColumns = FeedbacksColumns{ } // NewFeedbacksDao creates and returns a new DAO object for table data access. -func NewFeedbacksDao() *FeedbacksDao { +func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao { return &FeedbacksDao{ - group: "default", - table: "feedbacks", - columns: feedbacksColumns, + group: "default", + table: "feedbacks", + columns: feedbacksColumns, + handlers: handlers, } } @@ -81,7 +83,11 @@ func (dao *FeedbacksDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *FeedbacksDao) 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. diff --git a/internal/dao/internal/games.go b/internal/dao/internal/games.go index 993ab21..34d43cd 100644 --- a/internal/dao/internal/games.go +++ b/internal/dao/internal/games.go @@ -13,9 +13,10 @@ import ( // GamesDao is the data access object for the table games. type GamesDao 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 GamesColumns // 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 GamesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // GamesColumns defines and stores column names for the table games. @@ -43,11 +44,12 @@ var gamesColumns = GamesColumns{ } // NewGamesDao creates and returns a new DAO object for table data access. -func NewGamesDao() *GamesDao { +func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao { return &GamesDao{ - group: "default", - table: "games", - columns: gamesColumns, + group: "default", + table: "games", + columns: gamesColumns, + handlers: handlers, } } @@ -73,7 +75,11 @@ func (dao *GamesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *GamesDao) 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. diff --git a/internal/dao/internal/merchant_admins.go b/internal/dao/internal/merchant_admins.go index 51ac691..64533e1 100644 --- a/internal/dao/internal/merchant_admins.go +++ b/internal/dao/internal/merchant_admins.go @@ -13,9 +13,10 @@ import ( // MerchantAdminsDao is the data access object for the table merchant_admins. type MerchantAdminsDao 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 MerchantAdminsColumns // 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 MerchantAdminsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // MerchantAdminsColumns defines and stores column names for the table merchant_admins. @@ -57,11 +58,12 @@ var merchantAdminsColumns = MerchantAdminsColumns{ } // NewMerchantAdminsDao creates and returns a new DAO object for table data access. -func NewMerchantAdminsDao() *MerchantAdminsDao { +func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao { return &MerchantAdminsDao{ - group: "default", - table: "merchant_admins", - columns: merchantAdminsColumns, + group: "default", + table: "merchant_admins", + columns: merchantAdminsColumns, + handlers: handlers, } } @@ -87,7 +89,11 @@ func (dao *MerchantAdminsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *MerchantAdminsDao) 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. diff --git a/internal/dao/internal/merchants.go b/internal/dao/internal/merchants.go index 6dd5d05..717f855 100644 --- a/internal/dao/internal/merchants.go +++ b/internal/dao/internal/merchants.go @@ -13,9 +13,10 @@ import ( // MerchantsDao is the data access object for the table merchants. type MerchantsDao 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 MerchantsColumns // 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 MerchantsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // MerchantsColumns defines and stores column names for the table merchants. @@ -71,11 +72,12 @@ var merchantsColumns = MerchantsColumns{ } // NewMerchantsDao creates and returns a new DAO object for table data access. -func NewMerchantsDao() *MerchantsDao { +func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao { return &MerchantsDao{ - group: "default", - table: "merchants", - columns: merchantsColumns, + group: "default", + table: "merchants", + columns: merchantsColumns, + handlers: handlers, } } @@ -101,7 +103,11 @@ func (dao *MerchantsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *MerchantsDao) 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. diff --git a/internal/dao/internal/reward_types.go b/internal/dao/internal/reward_types.go index 7ca873b..c5b3e78 100644 --- a/internal/dao/internal/reward_types.go +++ b/internal/dao/internal/reward_types.go @@ -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. diff --git a/internal/dao/internal/rewards.go b/internal/dao/internal/rewards.go index 80cecdc..93949fb 100644 --- a/internal/dao/internal/rewards.go +++ b/internal/dao/internal/rewards.go @@ -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. @@ -55,11 +56,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, } } @@ -85,7 +87,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. diff --git a/internal/dao/internal/roles.go b/internal/dao/internal/roles.go index 9eab304..b540549 100644 --- a/internal/dao/internal/roles.go +++ b/internal/dao/internal/roles.go @@ -13,9 +13,10 @@ import ( // RolesDao is the data access object for the table roles. type RolesDao 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 RolesColumns // 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 RolesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // RolesColumns defines and stores column names for the table roles. @@ -47,11 +48,12 @@ var rolesColumns = RolesColumns{ } // NewRolesDao creates and returns a new DAO object for table data access. -func NewRolesDao() *RolesDao { +func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao { return &RolesDao{ - group: "default", - table: "roles", - columns: rolesColumns, + group: "default", + table: "roles", + columns: rolesColumns, + handlers: handlers, } } @@ -77,7 +79,11 @@ func (dao *RolesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *RolesDao) 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. diff --git a/internal/dao/internal/store_admins.go b/internal/dao/internal/store_admins.go index 7bcffcc..538322c 100644 --- a/internal/dao/internal/store_admins.go +++ b/internal/dao/internal/store_admins.go @@ -13,9 +13,10 @@ import ( // StoreAdminsDao is the data access object for the table store_admins. type StoreAdminsDao 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 StoreAdminsColumns // 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 StoreAdminsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreAdminsColumns defines and stores column names for the table store_admins. @@ -57,11 +58,12 @@ var storeAdminsColumns = StoreAdminsColumns{ } // NewStoreAdminsDao creates and returns a new DAO object for table data access. -func NewStoreAdminsDao() *StoreAdminsDao { +func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao { return &StoreAdminsDao{ - group: "default", - table: "store_admins", - columns: storeAdminsColumns, + group: "default", + table: "store_admins", + columns: storeAdminsColumns, + handlers: handlers, } } @@ -87,7 +89,11 @@ func (dao *StoreAdminsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreAdminsDao) 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. diff --git a/internal/dao/internal/store_desktop_settings.go b/internal/dao/internal/store_desktop_settings.go index d6469fa..600d641 100644 --- a/internal/dao/internal/store_desktop_settings.go +++ b/internal/dao/internal/store_desktop_settings.go @@ -13,9 +13,10 @@ import ( // StoreDesktopSettingsDao is the data access object for the table store_desktop_settings. type StoreDesktopSettingsDao 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 StoreDesktopSettingsColumns // 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 StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings. @@ -45,11 +46,12 @@ var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{ } // NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access. -func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao { +func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao { return &StoreDesktopSettingsDao{ - group: "default", - table: "store_desktop_settings", - columns: storeDesktopSettingsColumns, + group: "default", + table: "store_desktop_settings", + columns: storeDesktopSettingsColumns, + handlers: handlers, } } @@ -75,7 +77,11 @@ func (dao *StoreDesktopSettingsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreDesktopSettingsDao) 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. diff --git a/internal/dao/internal/store_roles.go b/internal/dao/internal/store_roles.go index 8528459..137e1fa 100644 --- a/internal/dao/internal/store_roles.go +++ b/internal/dao/internal/store_roles.go @@ -13,9 +13,10 @@ import ( // StoreRolesDao is the data access object for the table store_roles. type StoreRolesDao 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 StoreRolesColumns // 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 StoreRolesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreRolesColumns defines and stores column names for the table store_roles. @@ -39,11 +40,12 @@ var storeRolesColumns = StoreRolesColumns{ } // NewStoreRolesDao creates and returns a new DAO object for table data access. -func NewStoreRolesDao() *StoreRolesDao { +func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao { return &StoreRolesDao{ - group: "default", - table: "store_roles", - columns: storeRolesColumns, + group: "default", + table: "store_roles", + columns: storeRolesColumns, + handlers: handlers, } } @@ -69,7 +71,11 @@ func (dao *StoreRolesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreRolesDao) 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. diff --git a/internal/dao/internal/store_task_rewards.go b/internal/dao/internal/store_task_rewards.go new file mode 100644 index 0000000..fa49dfa --- /dev/null +++ b/internal/dao/internal/store_task_rewards.go @@ -0,0 +1,101 @@ +// ========================================================================== +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ========================================================================== + +package internal + +import ( + "context" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/frame/g" +) + +// 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. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards. +type StoreTaskRewardsColumns struct { + Id string // 奖励唯一标识符 + TaskId string // 任务ID,关联tasks表的id + StoreId string // 门店ID + Name string // 奖励名称 + RewardTypeId string // 奖励类型ID + TotalNum string // 奖励总数 + UsedNum string // 已使用数量 + LimitNum string // 限制数量 + CoverImage string // 封面图URL + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// storeTaskRewardsColumns holds the columns for the table store_task_rewards. +var storeTaskRewardsColumns = StoreTaskRewardsColumns{ + Id: "id", + TaskId: "task_id", + StoreId: "store_id", + Name: "name", + RewardTypeId: "reward_type_id", + TotalNum: "total_num", + UsedNum: "used_num", + LimitNum: "limit_num", + CoverImage: "cover_image", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access. +func NewStoreTaskRewardsDao(handlers ...gdb.ModelHandler) *StoreTaskRewardsDao { + return &StoreTaskRewardsDao{ + group: "default", + table: "store_task_rewards", + columns: storeTaskRewardsColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreTaskRewardsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreTaskRewardsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreTaskRewardsDao) Columns() StoreTaskRewardsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreTaskRewardsDao) Group() string { + return dao.group +} + +// 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 { + 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. +// It rolls back the transaction and returns the error if function f returns a non-nil error. +// It commits the transaction and returns nil if function f returns nil. +// +// Note: Do not commit or roll back the transaction in function f, +// as it is automatically handled by this function. +func (dao *StoreTaskRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/stores.go b/internal/dao/internal/stores.go index 8bbdc42..69ed619 100644 --- a/internal/dao/internal/stores.go +++ b/internal/dao/internal/stores.go @@ -13,9 +13,10 @@ import ( // StoresDao is the data access object for the table stores. type StoresDao 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 StoresColumns // 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 StoresColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoresColumns defines and stores column names for the table stores. @@ -51,11 +52,12 @@ var storesColumns = StoresColumns{ } // NewStoresDao creates and returns a new DAO object for table data access. -func NewStoresDao() *StoresDao { +func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao { return &StoresDao{ - group: "default", - table: "stores", - columns: storesColumns, + group: "default", + table: "stores", + columns: storesColumns, + handlers: handlers, } } @@ -81,7 +83,11 @@ func (dao *StoresDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoresDao) 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. diff --git a/internal/dao/internal/tasks.go b/internal/dao/internal/tasks.go index 414dc25..7434913 100644 --- a/internal/dao/internal/tasks.go +++ b/internal/dao/internal/tasks.go @@ -13,35 +13,47 @@ import ( // TasksDao is the data access object for the table tasks. type TasksDao 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 TasksColumns // 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 TasksColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // TasksColumns defines and stores column names for the table tasks. type TasksColumns struct { - Id string // 任务唯一标识符 - QqNetbarTaskId string // QQ网吧任务ID - CreatedAt string // 创建时间 - UpdatedAt string // 更新时间 - DeletedAt string // 软删除时间戳 + Id string // 任务唯一标识符 + QqNetbarTaskId string // QQ网吧任务ID + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 + QqNetbarTaskName string // QQ网吧任务名称 + QqNetbarTaskMemo string // 任务描述 + QqNetbarTaskRules string // 任务规则 + GameId string // 游戏唯一id + StoreId string // 门店 id } // tasksColumns holds the columns for the table tasks. var tasksColumns = TasksColumns{ - Id: "id", - QqNetbarTaskId: "qq_netbar_task_id", - CreatedAt: "created_at", - UpdatedAt: "updated_at", - DeletedAt: "deleted_at", + Id: "id", + QqNetbarTaskId: "qq_netbar_task_id", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", + QqNetbarTaskName: "qq_netbar_task_name", + QqNetbarTaskMemo: "qq_netbar_task_memo", + QqNetbarTaskRules: "qq_netbar_task_rules", + GameId: "game_id", + StoreId: "store_id", } // NewTasksDao creates and returns a new DAO object for table data access. -func NewTasksDao() *TasksDao { +func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao { return &TasksDao{ - group: "default", - table: "tasks", - columns: tasksColumns, + group: "default", + table: "tasks", + columns: tasksColumns, + handlers: handlers, } } @@ -67,7 +79,11 @@ func (dao *TasksDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TasksDao) 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. diff --git a/internal/dao/internal/user_tasks.go b/internal/dao/internal/user_tasks.go index a3ec699..b4e59d1 100644 --- a/internal/dao/internal/user_tasks.go +++ b/internal/dao/internal/user_tasks.go @@ -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. diff --git a/internal/dao/internal/users.go b/internal/dao/internal/users.go index c5aa79d..340eaf7 100644 --- a/internal/dao/internal/users.go +++ b/internal/dao/internal/users.go @@ -13,9 +13,10 @@ import ( // UsersDao is the data access object for the table users. type UsersDao 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 UsersColumns // 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 UsersColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // UsersColumns defines and stores column names for the table users. @@ -59,11 +60,12 @@ var usersColumns = UsersColumns{ } // NewUsersDao creates and returns a new DAO object for table data access. -func NewUsersDao() *UsersDao { +func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao { return &UsersDao{ - group: "default", - table: "users", - columns: usersColumns, + group: "default", + table: "users", + columns: usersColumns, + handlers: handlers, } } @@ -89,7 +91,11 @@ func (dao *UsersDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *UsersDao) 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. diff --git a/internal/dao/store_task_rewards.go b/internal/dao/store_task_rewards.go new file mode 100644 index 0000000..abe6829 --- /dev/null +++ b/internal/dao/store_task_rewards.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// storeTaskRewardsDao is the data access object for the table store_task_rewards. +// You can define custom methods on it to extend its functionality as needed. +type storeTaskRewardsDao struct { + *internal.StoreTaskRewardsDao +} + +var ( + // StoreTaskRewards is a globally accessible object for table store_task_rewards operations. + StoreTaskRewards = storeTaskRewardsDao{internal.NewStoreTaskRewardsDao()} +) + +// Add your custom methods and functionality below. diff --git a/internal/logic/task/task.go b/internal/logic/task/task.go index f3268fc..59ffe29 100644 --- a/internal/logic/task/task.go +++ b/internal/logic/task/task.go @@ -2,9 +2,11 @@ package task import ( "context" + "encoding/json" "fmt" "server/internal/dao" "server/internal/model" + "server/internal/model/do" "server/internal/service" "server/utility/ecode" "server/utility/tencent" @@ -144,7 +146,54 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTa return nil, err } + var store *model.Store + // 获取网吧账号 id用作存储task + err = dao.Stores.Ctx(ctx).Where(dao.Stores.Columns().NetbarAccount, in.NetBarAccount).Scan(&store) + if err != nil { + return nil, ecode.Fail.Sub("查找网吧失败") + } + if store == nil { + return nil, ecode.Fail.Sub("当前网吧不存在") + } + // TODO 任务列表数据处理 + if jsonData, ok := data.(map[string]interface{}); ok { + // 现在可以访问 jsonData 中的字段 + list := jsonData["task_list"] + + // 将 interface{} 转换为结构体 + var result []model.MyData + jsonBytes, err := json.Marshal(list) + if err != nil { + return nil, ecode.Fail.Sub("JSON序列化失败") + } + err = json.Unmarshal(jsonBytes, &result) + if err != nil { + return nil, ecode.Fail.Sub("JSON反序列化失败") + } + + for _, v := range result { + exist, err := dao.Tasks.Ctx(ctx).Where(dao.Tasks.Columns().QqNetbarTaskId, v.TaskId).Exist() + if err != nil { + return nil, ecode.Fail.Sub("查询该任务失败") + } + + // 数据库是否存在,无则添加 + if !exist { + _, err := dao.Tasks.Ctx(ctx).Insert(do.Tasks{ + QqNetbarTaskId: v.TaskId, + QqNetbarTaskMemo: v.QQNetBarTaskMemo, + QqNetbarTaskName: v.QQNetBarTaskName, + QqNetbarTaskRules: v.QQNetBarTaskRules, + GameId: in.Gid, + StoreId: store.Id, + }) + if err != nil { + return nil, ecode.Fail.Sub("添加任务失败") + } + } + } + } return &model.GetNonLoginTaskListOut{ Data: data, @@ -161,8 +210,24 @@ func (s *sTask) GetLoginTaskList(ctx context.Context, in *model.GetLoginTaskList } // TODO 任务列表数据处理 - return &model.GetLoginTaskListOut{ Data: data, }, err } + +func (s *sTask) GetTaskList(ctx context.Context, in *model.TaskListIn) (out *model.TaskListOut, err error) { + + var data []model.Tasks + var total int + m := dao.Tasks.Ctx(ctx) + //err = m.Page(in.Page, in.Size).Where(do.Tasks{GameId: in.Gid, StoreId: in.StoreId}).LeftJoin(dao.StoreTaskRewards.Table(), fmt.Sprintf("`%s`.`id` = `%s`.`task_id`", dao.Tasks.Table(), dao.StoreTaskRewards.Table())).ScanAndCount(&data, &total, false) + err = m.Page(in.Page, in.Size).Where(do.Tasks{GameId: in.Gid, StoreId: in.StoreId}).WithAll().ScanAndCount(&data, &total, false) + + if err != nil { + return nil, ecode.Fail.Sub("任务列表获取失败") + } + return &model.TaskListOut{ + List: data, + Total: total, + }, nil +} diff --git a/internal/model/do/store_task_rewards.go b/internal/model/do/store_task_rewards.go new file mode 100644 index 0000000..a5ec09a --- /dev/null +++ b/internal/model/do/store_task_rewards.go @@ -0,0 +1,27 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreTaskRewards is the golang structure of table store_task_rewards for DAO operations like Where/Data. +type StoreTaskRewards struct { + g.Meta `orm:"table:store_task_rewards, do:true"` + Id interface{} // 奖励唯一标识符 + TaskId interface{} // 任务ID,关联tasks表的id + StoreId interface{} // 门店ID + Name interface{} // 奖励名称 + RewardTypeId interface{} // 奖励类型ID + TotalNum interface{} // 奖励总数 + UsedNum interface{} // 已使用数量 + LimitNum interface{} // 限制数量 + CoverImage interface{} // 封面图URL + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/do/tasks.go b/internal/model/do/tasks.go index 465b459..2152f8f 100644 --- a/internal/model/do/tasks.go +++ b/internal/model/do/tasks.go @@ -11,10 +11,15 @@ 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{} // 任务唯一标识符 - QqNetbarTaskId interface{} // QQ网吧任务ID - CreatedAt *gtime.Time // 创建时间 - UpdatedAt *gtime.Time // 更新时间 - DeletedAt *gtime.Time // 软删除时间戳 + g.Meta `orm:"table:tasks, do:true"` + Id interface{} // 任务唯一标识符 + QqNetbarTaskId interface{} // QQ网吧任务ID + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 + QqNetbarTaskName interface{} // QQ网吧任务名称 + QqNetbarTaskMemo interface{} // 任务描述 + QqNetbarTaskRules interface{} // 任务规则 + GameId interface{} // 游戏唯一id + StoreId interface{} // 门店 id } diff --git a/internal/model/entity/store_task_rewards.go b/internal/model/entity/store_task_rewards.go new file mode 100644 index 0000000..71a77dd --- /dev/null +++ b/internal/model/entity/store_task_rewards.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreTaskRewards is the golang structure for table store_task_rewards. +type StoreTaskRewards struct { + Id int64 `json:"id" orm:"id" description:"奖励唯一标识符"` // 奖励唯一标识符 + TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID,关联tasks表的id"` // 任务ID,关联tasks表的id + StoreId string `json:"storeId" orm:"store_id" description:"门店ID"` // 门店ID + Name string `json:"name" orm:"name" description:"奖励名称"` // 奖励名称 + RewardTypeId string `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID"` // 奖励类型ID + TotalNum int `json:"totalNum" orm:"total_num" description:"奖励总数"` // 奖励总数 + UsedNum int `json:"usedNum" orm:"used_num" description:"已使用数量"` // 已使用数量 + LimitNum int `json:"limitNum" orm:"limit_num" description:"限制数量"` // 限制数量 + CoverImage string `json:"coverImage" orm:"cover_image" description:"封面图URL"` // 封面图URL + 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:"软删除时间戳"` // 软删除时间戳 +} diff --git a/internal/model/entity/tasks.go b/internal/model/entity/tasks.go index 2bb267a..1ee418a 100644 --- a/internal/model/entity/tasks.go +++ b/internal/model/entity/tasks.go @@ -10,9 +10,14 @@ 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:"软删除时间戳"` // 软删除时间戳 + 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 } diff --git a/internal/model/storeTaskReward.go b/internal/model/storeTaskReward.go new file mode 100644 index 0000000..0200f1c --- /dev/null +++ b/internal/model/storeTaskReward.go @@ -0,0 +1,22 @@ +package model + +import ( + "github.com/gogf/gf/v2/frame/g" + "time" +) + +type StoreTaskReward struct { + g.Meta `orm:"table:store_task_rewards"` + Id int64 `orm:"id" json:"id"` // 奖励唯一标识符 + TaskId int64 `orm:"task_id" json:"task_id"` // 任务ID,关联tasks表的id + StoreId string `orm:"store_id" json:"store_id"` // 门店ID + Name string `orm:"name" json:"name"` // 奖励名称 + RewardTypeId string `orm:"reward_type_id" json:"reward_type_id"` // 奖励类型ID + TotalNum int32 `orm:"total_num" json:"total_num"` // 奖励总数 + UsedNum int32 `orm:"used_num" json:"used_num"` // 已使用数量 + LimitNum int32 `orm:"limit_num" json:"limit_num"` // 限制数量 + CoverImage string `orm:"cover_image" json:"cover_image"` // 封面图URL + CreatedAt time.Time `orm:"created_at" json:"created_at"` // 创建时间 + UpdatedAt time.Time `orm:"updated_at" json:"updated_at"` // 更新时间 + DeletedAt time.Time `orm:"deleted_at" json:"deleted_at"` // 软删除时间戳 +} diff --git a/internal/model/task.go b/internal/model/task.go index 79065bb..b7c41b1 100644 --- a/internal/model/task.go +++ b/internal/model/task.go @@ -1,5 +1,21 @@ package model +import "github.com/gogf/gf/v2/os/gtime" + +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 + StoreTaskRewards []StoreTaskReward `json:"storeTaskRewards" orm:"with:task_id=id"` +} + type GetNonLoginTaskListIn struct { NetBarAccount string `json:"netbar_account"` //网关账号 //Page int `json:"page"` // 分页索引 @@ -37,3 +53,26 @@ type GetLoginTaskListOut struct { // Total int `json:"total"` Data interface{} `json:"data"` } + +// 定义一个与 JSON 结构匹配的结构体 +type MyData struct { + TaskId string `json:"task_id"` + //GameId int `json:"game_id"` + QQNetBarTaskMemo string `json:"task_desc"` + QQNetBarTaskName string `json:"title"` + QQNetBarTaskRules string `json:"rule_desc"` + //StoreId int `json:"store_id"` +} + +type TaskListIn struct { + Gid int `json:"gid" v:"required#游戏唯一id不能为空" dc:"游戏唯一id"` + NetBarAccount string `json:"netBarAccount"` + Page int `json:"page" dc:"页数"` + Size int `json:"size" dc:"条数"` + StoreId int `json:"store_id"` +} + +type TaskListOut struct { + List interface{} `json:"list"` + Total int `json:"total"` +} diff --git a/internal/service/task.go b/internal/service/task.go index 7e654c1..845356e 100644 --- a/internal/service/task.go +++ b/internal/service/task.go @@ -16,6 +16,7 @@ type ( // GetNonLoginTaskList 获取下发到指定网吧的任务列表(未登录) GetNonLoginTaskList(ctx context.Context, in *model.GetNonLoginTaskListIn) (out *model.GetNonLoginTaskListOut, err error) GetLoginTaskList(ctx context.Context, in *model.GetLoginTaskListIn) (out *model.GetLoginTaskListOut, err error) + GetTaskList(ctx context.Context, in *model.TaskListIn) (out *model.TaskListOut, err error) } ) diff --git a/utility/myCasbin/casbin.go b/utility/myCasbin/casbin.go index ccd88da..0d36bac 100644 --- a/utility/myCasbin/casbin.go +++ b/utility/myCasbin/casbin.go @@ -46,6 +46,7 @@ func init() { // 游戏列表 enforcer.AddPolicy("guest", "/x/game", "GET", "获取游戏列表") + enforcer.AddPolicy("guest", "/x/task/list", "GET", "获取游戏列表") } // 用户 {