完成操作任务奖励的接口测试
This commit is contained in:
@ -269,7 +269,7 @@ type GetGoodsDetailsRes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OperateTaskRewardReq struct {
|
type OperateTaskRewardReq struct {
|
||||||
g.Meta `path:"/reward/addTaskReward" method:"post" tags:"Reward" summary:"添加任务奖励"`
|
g.Meta `path:"/reward/taskReward" method:"post" tags:"Reward" summary:"添加任务奖励"`
|
||||||
Type int `json:"type" v:"required#操作类型只能为1或2,1是添加、2是删除" dc:"操作类型"`
|
Type int `json:"type" v:"required#操作类型只能为1或2,1是添加、2是删除" dc:"操作类型"`
|
||||||
TaskId int64 `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
|
TaskId int64 `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
|
||||||
RewardId int64 `json:"rewardId" v:"required#奖励id不能为空" dc:"奖励Id"`
|
RewardId int64 `json:"rewardId" v:"required#奖励id不能为空" dc:"奖励Id"`
|
||||||
|
|||||||
@ -2,12 +2,21 @@ package reward
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/gogf/gf/v2/errors/gcode"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
"github.com/gogf/gf/v2/errors/gerror"
|
"server/internal/model"
|
||||||
|
"server/internal/service"
|
||||||
|
|
||||||
"server/api/reward/v1"
|
"server/api/reward/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *ControllerV1) OperateTaskReward(ctx context.Context, req *v1.OperateTaskRewardReq) (res *v1.OperateTaskRewardRes, err error) {
|
func (c *ControllerV1) OperateTaskReward(ctx context.Context, req *v1.OperateTaskRewardReq) (res *v1.OperateTaskRewardRes, err error) {
|
||||||
return nil, gerror.NewCode(gcode.CodeNotImplemented)
|
fromCtx := g.RequestFromCtx(ctx)
|
||||||
|
operatorId := fromCtx.GetCtxVar("id").Int64()
|
||||||
|
operatorRole := fromCtx.GetCtxVar("role").String()
|
||||||
|
out, err := service.Reward().OperateTaskReward(ctx, &model.OperateTaskRewardIn{OperatorId: operatorId, OperatorRole: operatorRole, RewardId: req.RewardId, TaskId: req.TaskId, Type: req.Type})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
|
||||||
|
}
|
||||||
|
return &v1.OperateTaskRewardRes{Success: out.Success}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type AdminsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// AdminsColumns defines and stores column names for the table admins.
|
||||||
@ -50,12 +49,11 @@ var adminsColumns = AdminsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewAdminsDao creates and returns a new DAO object for table data access.
|
// NewAdminsDao creates and returns a new DAO object for table data access.
|
||||||
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
|
func NewAdminsDao() *AdminsDao {
|
||||||
return &AdminsDao{
|
return &AdminsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "admins",
|
table: "admins",
|
||||||
columns: adminsColumns,
|
columns: adminsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,11 +79,7 @@ func (dao *AdminsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type FeedbacksDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// FeedbacksColumns defines and stores column names for the table feedbacks.
|
||||||
@ -52,12 +51,11 @@ var feedbacksColumns = FeedbacksColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewFeedbacksDao creates and returns a new DAO object for table data access.
|
// NewFeedbacksDao creates and returns a new DAO object for table data access.
|
||||||
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
|
func NewFeedbacksDao() *FeedbacksDao {
|
||||||
return &FeedbacksDao{
|
return &FeedbacksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "feedbacks",
|
table: "feedbacks",
|
||||||
columns: feedbacksColumns,
|
columns: feedbacksColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +81,7 @@ func (dao *FeedbacksDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type GamesDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// GamesColumns defines and stores column names for the table games.
|
||||||
@ -46,12 +45,11 @@ var gamesColumns = GamesColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewGamesDao creates and returns a new DAO object for table data access.
|
// NewGamesDao creates and returns a new DAO object for table data access.
|
||||||
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
|
func NewGamesDao() *GamesDao {
|
||||||
return &GamesDao{
|
return &GamesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "games",
|
table: "games",
|
||||||
columns: gamesColumns,
|
columns: gamesColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +75,7 @@ func (dao *GamesDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *GamesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type MerchantAdminsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// MerchantAdminsColumns defines and stores column names for the table merchant_admins.
|
||||||
@ -58,12 +57,11 @@ var merchantAdminsColumns = MerchantAdminsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMerchantAdminsDao creates and returns a new DAO object for table data access.
|
// NewMerchantAdminsDao creates and returns a new DAO object for table data access.
|
||||||
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
|
func NewMerchantAdminsDao() *MerchantAdminsDao {
|
||||||
return &MerchantAdminsDao{
|
return &MerchantAdminsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "merchant_admins",
|
table: "merchant_admins",
|
||||||
columns: merchantAdminsColumns,
|
columns: merchantAdminsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +87,7 @@ func (dao *MerchantAdminsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *MerchantAdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type MerchantsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// MerchantsColumns defines and stores column names for the table merchants.
|
||||||
@ -72,12 +71,11 @@ var merchantsColumns = MerchantsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMerchantsDao creates and returns a new DAO object for table data access.
|
// NewMerchantsDao creates and returns a new DAO object for table data access.
|
||||||
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
|
func NewMerchantsDao() *MerchantsDao {
|
||||||
return &MerchantsDao{
|
return &MerchantsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "merchants",
|
table: "merchants",
|
||||||
columns: merchantsColumns,
|
columns: merchantsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,11 +101,7 @@ func (dao *MerchantsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type RewardTypesDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// RewardTypesColumns defines and stores column names for the table reward_types.
|
||||||
@ -44,12 +43,11 @@ var rewardTypesColumns = RewardTypesColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
||||||
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
|
func NewRewardTypesDao() *RewardTypesDao {
|
||||||
return &RewardTypesDao{
|
return &RewardTypesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "reward_types",
|
table: "reward_types",
|
||||||
columns: rewardTypesColumns,
|
columns: rewardTypesColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,11 +73,7 @@ func (dao *RewardTypesDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type RewardsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// RewardsColumns defines and stores column names for the table rewards.
|
||||||
@ -72,12 +71,11 @@ var rewardsColumns = RewardsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRewardsDao creates and returns a new DAO object for table data access.
|
// NewRewardsDao creates and returns a new DAO object for table data access.
|
||||||
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
|
func NewRewardsDao() *RewardsDao {
|
||||||
return &RewardsDao{
|
return &RewardsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "rewards",
|
table: "rewards",
|
||||||
columns: rewardsColumns,
|
columns: rewardsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,11 +101,7 @@ func (dao *RewardsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type RolesDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// RolesColumns defines and stores column names for the table roles.
|
||||||
@ -48,12 +47,11 @@ var rolesColumns = RolesColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRolesDao creates and returns a new DAO object for table data access.
|
// NewRolesDao creates and returns a new DAO object for table data access.
|
||||||
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
|
func NewRolesDao() *RolesDao {
|
||||||
return &RolesDao{
|
return &RolesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "roles",
|
table: "roles",
|
||||||
columns: rolesColumns,
|
columns: rolesColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +77,7 @@ func (dao *RolesDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *RolesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type StoreAdminsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// StoreAdminsColumns defines and stores column names for the table store_admins.
|
||||||
@ -58,12 +57,11 @@ var storeAdminsColumns = StoreAdminsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreAdminsDao creates and returns a new DAO object for table data access.
|
// NewStoreAdminsDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
|
func NewStoreAdminsDao() *StoreAdminsDao {
|
||||||
return &StoreAdminsDao{
|
return &StoreAdminsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_admins",
|
table: "store_admins",
|
||||||
columns: storeAdminsColumns,
|
columns: storeAdminsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +87,7 @@ func (dao *StoreAdminsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *StoreAdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type StoreDesktopSettingsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings.
|
||||||
@ -34,12 +33,11 @@ var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
|
// NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao {
|
func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao {
|
||||||
return &StoreDesktopSettingsDao{
|
return &StoreDesktopSettingsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_desktop_settings",
|
table: "store_desktop_settings",
|
||||||
columns: storeDesktopSettingsColumns,
|
columns: storeDesktopSettingsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,11 +63,7 @@ func (dao *StoreDesktopSettingsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *StoreDesktopSettingsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type StoreIpsDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns StoreIpsColumns // columns contains all the column names of Table for convenient usage.
|
columns StoreIpsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreIpsColumns defines and stores column names for the table store_ips.
|
// StoreIpsColumns defines and stores column names for the table store_ips.
|
||||||
@ -42,12 +41,11 @@ var storeIpsColumns = StoreIpsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreIpsDao creates and returns a new DAO object for table data access.
|
// NewStoreIpsDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreIpsDao(handlers ...gdb.ModelHandler) *StoreIpsDao {
|
func NewStoreIpsDao() *StoreIpsDao {
|
||||||
return &StoreIpsDao{
|
return &StoreIpsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_ips",
|
table: "store_ips",
|
||||||
columns: storeIpsColumns,
|
columns: storeIpsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,11 +71,7 @@ func (dao *StoreIpsDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *StoreIpsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *StoreIpsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type StoreNetfeeAreaLevelDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns StoreNetfeeAreaLevelColumns // columns contains all the column names of Table for convenient usage.
|
columns StoreNetfeeAreaLevelColumns // columns contains all the column names of Table for convenient usage.
|
||||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreNetfeeAreaLevelColumns defines and stores column names for the table store_netfee_area_level.
|
// StoreNetfeeAreaLevelColumns defines and stores column names for the table store_netfee_area_level.
|
||||||
@ -50,12 +49,11 @@ var storeNetfeeAreaLevelColumns = StoreNetfeeAreaLevelColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access.
|
// NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreNetfeeAreaLevelDao(handlers ...gdb.ModelHandler) *StoreNetfeeAreaLevelDao {
|
func NewStoreNetfeeAreaLevelDao() *StoreNetfeeAreaLevelDao {
|
||||||
return &StoreNetfeeAreaLevelDao{
|
return &StoreNetfeeAreaLevelDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_netfee_area_level",
|
table: "store_netfee_area_level",
|
||||||
columns: storeNetfeeAreaLevelColumns,
|
columns: storeNetfeeAreaLevelColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,11 +79,7 @@ func (dao *StoreNetfeeAreaLevelDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *StoreNetfeeAreaLevelDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *StoreNetfeeAreaLevelDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type StoreRolesDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// StoreRolesColumns defines and stores column names for the table store_roles.
|
||||||
@ -40,12 +39,11 @@ var storeRolesColumns = StoreRolesColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreRolesDao creates and returns a new DAO object for table data access.
|
// NewStoreRolesDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao {
|
func NewStoreRolesDao() *StoreRolesDao {
|
||||||
return &StoreRolesDao{
|
return &StoreRolesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_roles",
|
table: "store_roles",
|
||||||
columns: storeRolesColumns,
|
columns: storeRolesColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,11 +69,7 @@ func (dao *StoreRolesDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *StoreRolesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -1,91 +0,0 @@
|
|||||||
// ==========================================================================
|
|
||||||
// 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 // 任务奖励关联ID
|
|
||||||
TaskId string // 腾讯任务ID
|
|
||||||
RewardId string // 奖励ID
|
|
||||||
StoreId string // 门店ID
|
|
||||||
CreatedAt string // 创建时间
|
|
||||||
UpdatedAt string // 更新时间
|
|
||||||
DeletedAt string // 软删除时间戳
|
|
||||||
}
|
|
||||||
|
|
||||||
// storeTaskRewardsColumns holds the columns for the table store_task_rewards.
|
|
||||||
var storeTaskRewardsColumns = StoreTaskRewardsColumns{
|
|
||||||
Id: "id",
|
|
||||||
TaskId: "task_id",
|
|
||||||
RewardId: "reward_id",
|
|
||||||
StoreId: "store_id",
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@ -16,7 +16,6 @@ type StoresDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// StoresColumns defines and stores column names for the table stores.
|
||||||
@ -52,12 +51,11 @@ var storesColumns = StoresColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoresDao creates and returns a new DAO object for table data access.
|
// NewStoresDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
|
func NewStoresDao() *StoresDao {
|
||||||
return &StoresDao{
|
return &StoresDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "stores",
|
table: "stores",
|
||||||
columns: storesColumns,
|
columns: storesColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +81,7 @@ func (dao *StoresDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *StoresDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type TasksDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// TasksColumns defines and stores column names for the table tasks.
|
||||||
@ -58,12 +57,11 @@ var tasksColumns = TasksColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewTasksDao creates and returns a new DAO object for table data access.
|
// NewTasksDao creates and returns a new DAO object for table data access.
|
||||||
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
|
func NewTasksDao() *TasksDao {
|
||||||
return &TasksDao{
|
return &TasksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "tasks",
|
table: "tasks",
|
||||||
columns: tasksColumns,
|
columns: tasksColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +87,7 @@ func (dao *TasksDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *TasksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type UserTasksDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// UserTasksColumns defines and stores column names for the table user_tasks.
|
||||||
@ -52,12 +51,11 @@ var userTasksColumns = UserTasksColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
||||||
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
|
func NewUserTasksDao() *UserTasksDao {
|
||||||
return &UserTasksDao{
|
return &UserTasksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "user_tasks",
|
table: "user_tasks",
|
||||||
columns: userTasksColumns,
|
columns: userTasksColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +81,7 @@ func (dao *UserTasksDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ type UsersDao struct {
|
|||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of the current 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.
|
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.
|
// UsersColumns defines and stores column names for the table users.
|
||||||
@ -60,12 +59,11 @@ var usersColumns = UsersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewUsersDao creates and returns a new DAO object for table data access.
|
// NewUsersDao creates and returns a new DAO object for table data access.
|
||||||
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
|
func NewUsersDao() *UsersDao {
|
||||||
return &UsersDao{
|
return &UsersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "users",
|
table: "users",
|
||||||
columns: usersColumns,
|
columns: usersColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,11 +89,7 @@ func (dao *UsersDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
// =================================================================================
|
|
||||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
|
||||||
// =================================================================================
|
|
||||||
|
|
||||||
package dao
|
|
||||||
|
|
||||||
import (
|
|
||||||
"server/internal/dao/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
// internalStoreTaskRewardsDao is an internal type for wrapping the internal DAO implementation.
|
|
||||||
type internalStoreTaskRewardsDao = *internal.StoreTaskRewardsDao
|
|
||||||
|
|
||||||
// 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 {
|
|
||||||
internalStoreTaskRewardsDao
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// StoreTaskRewards is a globally accessible object for table store_task_rewards operations.
|
|
||||||
StoreTaskRewards = storeTaskRewardsDao{
|
|
||||||
internal.NewStoreTaskRewardsDao(),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// Add your custom methods and functionality below.
|
|
||||||
@ -476,15 +476,7 @@ func (s *sReward) GetGoodsDetails(ctx context.Context, in *model.GetGoodsDetails
|
|||||||
|
|
||||||
func (s *sReward) OperateTaskReward(ctx context.Context, in *model.OperateTaskRewardIn) (out *model.OperateTaskRewardOut, err error) {
|
func (s *sReward) OperateTaskReward(ctx context.Context, in *model.OperateTaskRewardIn) (out *model.OperateTaskRewardOut, err error) {
|
||||||
// 如果是系统管理员给任务添加奖励,需要校验奖励的来源
|
// 如果是系统管理员给任务添加奖励,需要校验奖励的来源
|
||||||
exist, err := dao.Tasks.Ctx(ctx).Where(do.Tasks{Id: in.TaskId}).Exist()
|
exist, err := dao.Rewards.Ctx(ctx).Where(do.Rewards{Id: in.RewardId}).Exist()
|
||||||
if err != nil {
|
|
||||||
return nil, ecode.Fail.Sub("任务不存在")
|
|
||||||
}
|
|
||||||
if !exist {
|
|
||||||
return nil, ecode.Params.Sub("任务不存在")
|
|
||||||
}
|
|
||||||
|
|
||||||
exist, err = dao.Rewards.Ctx(ctx).Where(do.Rewards{Id: in.RewardId}).Exist()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("奖励不存在")
|
return nil, ecode.Fail.Sub("奖励不存在")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,15 +160,31 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetTaskListIn
|
|||||||
QqNetbarTaskName: task.Title,
|
QqNetbarTaskName: task.Title,
|
||||||
QqNetbarTaskMemo: task.TaskDesc,
|
QqNetbarTaskMemo: task.TaskDesc,
|
||||||
QqNetbarTaskRules: task.RuleDesc,
|
QqNetbarTaskRules: task.RuleDesc,
|
||||||
QqNetbarReward: task.TargetName,
|
QqNetbarTargetName: task.TargetName,
|
||||||
QqNetbarTargetTime: task.TargetTimes,
|
QqNetbarTargetTime: task.TargetTimes,
|
||||||
StartTime: task.CycleStart,
|
StartTime: task.CycleStart,
|
||||||
EndTime: task.CycleEnd,
|
EndTime: task.CycleEnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装门店奖励数据
|
// 组装奖励数据
|
||||||
err := dao.StoreTaskRewards.Ctx(ctx).InnerJoin(dao.Rewards.Table(), fmt.Sprintf("%s.%s = %s.%s", dao.StoreTaskRewards.Table(), dao.StoreTaskRewards.Columns().RewardId, dao.Rewards.Table(), dao.Rewards.Columns().Id)).
|
err := dao.TaskRewards.Ctx(ctx).
|
||||||
Where(dao.StoreTaskRewards.Columns().TaskId, task.TaskID).Fields(fmt.Sprintf("%s.*", dao.Rewards.Table())).Scan(&data.NetbarRewards)
|
LeftJoin(dao.Rewards.Table(),
|
||||||
|
fmt.Sprintf("`%s`.`%s` = `%s`.`%s`",
|
||||||
|
dao.Rewards.Table(), dao.Rewards.Columns().Id,
|
||||||
|
dao.TaskRewards.Table(), dao.TaskRewards.Columns().RewardId)).
|
||||||
|
LeftJoin(dao.RewardTypes.Table(),
|
||||||
|
fmt.Sprintf("`%s`.`%s` = `%s`.`%s`",
|
||||||
|
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Id,
|
||||||
|
dao.Rewards.Table(), dao.Rewards.Columns().RewardTypeId)).
|
||||||
|
Fields(
|
||||||
|
fmt.Sprintf("%s.*, `%s`.`%s` AS %s, `%s`.`%s` AS %s",
|
||||||
|
dao.Rewards.Table(),
|
||||||
|
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Name,
|
||||||
|
"reward_type_name",
|
||||||
|
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Source,
|
||||||
|
"reward_type_source",
|
||||||
|
),
|
||||||
|
).Where(dao.TaskRewards.Columns().TaskId, task.TaskID).Scan(&data.Rewards)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -202,7 +218,7 @@ func (s *sTask) GetLoginTaskList(ctx context.Context, in *model.GetTaskListIn) (
|
|||||||
QqNetbarTaskName: task.Title,
|
QqNetbarTaskName: task.Title,
|
||||||
QqNetbarTaskMemo: task.TaskDesc,
|
QqNetbarTaskMemo: task.TaskDesc,
|
||||||
QqNetbarTaskRules: task.RuleDesc,
|
QqNetbarTaskRules: task.RuleDesc,
|
||||||
QqNetbarReward: task.TargetName,
|
QqNetbarTargetName: task.TargetName,
|
||||||
QqNetbarTargetTime: task.TargetTimes,
|
QqNetbarTargetTime: task.TargetTimes,
|
||||||
StartTime: task.CycleStart,
|
StartTime: task.CycleStart,
|
||||||
EndTime: task.CycleEnd,
|
EndTime: task.CycleEnd,
|
||||||
@ -210,9 +226,22 @@ func (s *sTask) GetLoginTaskList(ctx context.Context, in *model.GetTaskListIn) (
|
|||||||
}
|
}
|
||||||
data.UserTaskResult.Usertimes = task.UserTimes
|
data.UserTaskResult.Usertimes = task.UserTimes
|
||||||
// 组装门店奖励数据
|
// 组装门店奖励数据
|
||||||
err := dao.Tasks.Ctx(ctx).InnerJoin(dao.StoreTaskRewards.Table(), fmt.Sprintf("%s.%s = %s.%s", dao.Tasks.Table(), dao.Tasks.Columns().Id, dao.StoreTaskRewards.Table(), dao.StoreTaskRewards.Columns().TaskId)).
|
err := dao.TaskRewards.Ctx(ctx).
|
||||||
InnerJoin(dao.Rewards.Table(), fmt.Sprintf("%s.%s = %s.%s", dao.StoreTaskRewards.Table(), dao.StoreTaskRewards.Columns().RewardId, dao.Rewards.Table(), dao.Rewards.Columns().Id)).
|
LeftJoin(dao.Rewards.Table(),
|
||||||
Where(dao.Tasks.Columns().QqNetbarTaskId, task.TaskID).Fields(fmt.Sprintf("%s.*", dao.Rewards.Table())).Scan(&data.NetbarRewards)
|
fmt.Sprintf("`%s`.`%s` = `%s`.`%s`",
|
||||||
|
dao.Rewards.Table(), dao.Rewards.Columns().Id,
|
||||||
|
dao.TaskRewards.Table(), dao.TaskRewards.Columns().RewardId)).
|
||||||
|
LeftJoin(dao.RewardTypes.Table(),
|
||||||
|
fmt.Sprintf("`%s`.`%s` = `%s`.`%s`",
|
||||||
|
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Id,
|
||||||
|
dao.Rewards.Table(), dao.Rewards.Columns().RewardTypeId)).
|
||||||
|
Fields(
|
||||||
|
fmt.Sprintf("%s.*, `%s`.`%s` AS %s",
|
||||||
|
dao.Rewards.Table(),
|
||||||
|
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Name,
|
||||||
|
"reward_type_name",
|
||||||
|
),
|
||||||
|
).Where(dao.TaskRewards.Columns().TaskId, task.TaskID).Scan(&data.Rewards)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
// =================================================================================
|
|
||||||
// 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{} // 任务奖励关联ID
|
|
||||||
TaskId interface{} // 腾讯任务ID
|
|
||||||
RewardId interface{} // 奖励ID
|
|
||||||
StoreId interface{} // 门店ID
|
|
||||||
CreatedAt *gtime.Time // 创建时间
|
|
||||||
UpdatedAt *gtime.Time // 更新时间
|
|
||||||
DeletedAt *gtime.Time // 软删除时间戳
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
// =================================================================================
|
|
||||||
// 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:"任务奖励关联ID"` // 任务奖励关联ID
|
|
||||||
TaskId string `json:"taskId" orm:"task_id" description:"腾讯任务ID"` // 腾讯任务ID
|
|
||||||
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
|
|
||||||
StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID"` // 门店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:"软删除时间戳"` // 软删除时间戳
|
|
||||||
}
|
|
||||||
@ -6,6 +6,6 @@ package entity
|
|||||||
|
|
||||||
// TaskRewards is the golang structure for table task_rewards.
|
// TaskRewards is the golang structure for table task_rewards.
|
||||||
type TaskRewards struct {
|
type TaskRewards struct {
|
||||||
TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID
|
TaskId string `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID
|
||||||
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
|
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ type Reward struct {
|
|||||||
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 表
|
||||||
RewardTypeName string `json:"rewardTypeName" orm:"reward_type_name" description:"奖励类型名称"` // 奖励类型名称
|
RewardTypeName string `json:"rewardTypeName" orm:"reward_type_name" description:"奖励类型名称"` // 奖励类型名称
|
||||||
|
RewardTypeSource int `json:"rewardTypeSource" orm:"reward_type_source" description:"奖励类型来源"` // 奖励类型来源
|
||||||
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:"奖励图片链接"` // 奖励图片链接
|
||||||
QqGoodsId string `json:"qqGoodsId" orm:"qq_goods_id" description:"QQ网吧物品ID"` // QQ网吧物品ID
|
QqGoodsId string `json:"qqGoodsId" orm:"qq_goods_id" description:"QQ网吧物品ID"` // QQ网吧物品ID
|
||||||
|
|||||||
@ -1,40 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
|
||||||
)
|
|
||||||
|
|
||||||
// StoreTaskReward 门店任务奖励关联表
|
|
||||||
type StoreTaskReward struct {
|
|
||||||
g.Meta `orm:"table:store_task_rewards"`
|
|
||||||
Id int64 `json:"id" dc:"任务奖励关联ID" orm:"id,primary"`
|
|
||||||
TaskId int64 `json:"taskId" dc:"门店任务ID" orm:"task_id"`
|
|
||||||
RewardId int64 `json:"rewardId" dc:"奖励ID" orm:"reward_id"`
|
|
||||||
StoreId int64 `json:"storeId" dc:"门店ID" orm:"store_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// StoreTaskRewardCreateIn 创建任务奖励关联入参
|
|
||||||
type StoreTaskRewardCreateIn struct {
|
|
||||||
OperatorId int64
|
|
||||||
OperatorRole string
|
|
||||||
TaskId string // 门店任务ID
|
|
||||||
RewardId int64 // 奖励ID
|
|
||||||
StoreId int64 // 门店ID
|
|
||||||
}
|
|
||||||
|
|
||||||
// StoreTaskRewardCreateOut 创建任务奖励关联出参
|
|
||||||
type StoreTaskRewardCreateOut struct {
|
|
||||||
Id int64 // 创建成功后返回的ID
|
|
||||||
}
|
|
||||||
|
|
||||||
// StoreTaskRewardDeleteIn 删除任务奖励关联入参
|
|
||||||
type StoreTaskRewardDeleteIn struct {
|
|
||||||
Id int64 // 任务奖励关联ID
|
|
||||||
OperatorId int64
|
|
||||||
OperatorRole string
|
|
||||||
}
|
|
||||||
|
|
||||||
// StoreTaskRewardDeleteOut 删除任务奖励关联出参
|
|
||||||
type StoreTaskRewardDeleteOut struct {
|
|
||||||
Success bool // 是否删除成功
|
|
||||||
}
|
|
||||||
@ -17,11 +17,11 @@ type Task struct {
|
|||||||
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" description:"任务规则"` // 任务规则
|
QqNetbarTaskRules string `json:"qqNetbarTaskRules" orm:"qq_netbar_task_rules" description:"任务规则"` // 任务规则
|
||||||
QqNetbarTaskMemo string `json:"qqNetbarTaskMemo" orm:"qq_netbar_task_memo" description:"任务描述"` // 任务描述
|
QqNetbarTaskMemo string `json:"qqNetbarTaskMemo" orm:"qq_netbar_task_memo" description:"任务描述"` // 任务描述
|
||||||
QqNetbarTaskName string `json:"qqNetbarTaskName" orm:"qq_netbar_task_name" description:"QQ网吧任务名称"` // QQ网吧任务名称
|
QqNetbarTaskName string `json:"qqNetbarTaskName" orm:"qq_netbar_task_name" description:"QQ网吧任务名称"` // QQ网吧任务名称
|
||||||
QqNetbarReward string `json:"qqNetbarReward" orm:"qq_netbar_reward" description:"qq 网吧奖励名称"` // qq 网吧奖励名称
|
QqNetbarTargetName string `json:"qqNetbarTargetName" orm:"qq_netbar_target_name" description:"任务指标名称"` // 任务指标名称
|
||||||
QqNetbarTargetTime int `json:"qqNetbarTargetTime" orm:"qq_netbar_target_time" description:"qq 网吧任务指标"` // qq 网吧任务指标
|
QqNetbarTargetTime int `json:"qqNetbarTargetTime" orm:"qq_netbar_target_time" description:"qq 网吧任务指标"` // qq 网吧任务指标
|
||||||
StartTime int64 `json:"startTime" orm:"start_time" description:"任务开始时间"` // 任务开始时间
|
StartTime int64 `json:"startTime" orm:"start_time" description:"任务开始时间"` // 任务开始时间
|
||||||
EndTime int64 `json:"endTime" orm:"end_time" description:"任务结束时间"` // 任务结束时间
|
EndTime int64 `json:"endTime" orm:"end_time" description:"任务结束时间"` // 任务结束时间
|
||||||
NetbarRewards []Reward `json:"netbarRewards" orm:"-"`
|
Rewards []Reward `json:"rewards" orm:"-"`
|
||||||
UserTaskResult UserTaskResult `json:"userTaskResult,omitempty"`
|
UserTaskResult UserTaskResult `json:"userTaskResult,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,8 +104,7 @@ func init() {
|
|||||||
enforcer.AddPolicy("store", "/x/reward", "PUT", "更新奖励")
|
enforcer.AddPolicy("store", "/x/reward", "PUT", "更新奖励")
|
||||||
enforcer.AddPolicy("store", "/x/reward/*", "DELETE", "删除奖励")
|
enforcer.AddPolicy("store", "/x/reward/*", "DELETE", "删除奖励")
|
||||||
|
|
||||||
enforcer.AddPolicy("store", "/x/storeTaskReward", "POST", "添加门店任务奖励")
|
enforcer.AddPolicy("store", "/x/reward/taskReward", "POST", "添加/删除门店任务奖励")
|
||||||
enforcer.AddPolicy("store", "/x/storeTaskReward/*", "DELETE", "删除门店任务奖励")
|
|
||||||
|
|
||||||
// 门店角色
|
// 门店角色
|
||||||
enforcer.AddPolicy("store", "/x/store/role", "GET", "获取门店角色列表")
|
enforcer.AddPolicy("store", "/x/store/role", "GET", "获取门店角色列表")
|
||||||
|
|||||||
Reference in New Issue
Block a user