调整奖励接口

This commit is contained in:
chy
2025-06-24 21:15:14 +08:00
parent 1c0b9a2d93
commit cef90a65b5
23 changed files with 522 additions and 257 deletions

View File

@ -21,36 +21,51 @@ type ListRes struct {
}
type CreateReq struct {
g.Meta `path:"/reward" method:"post" tags:"Reward" summary:"(系统、商户、门店后台)创建奖励"`
Name string `json:"name" v:"required#名称不能为空" dc:"名称"`
Description string `json:"description" v:"required#描述不能为空" dc:"描述"`
Value int64 `json:"value" v:"required#数值不能为空" dc:"奖励"`
Status int `json:"status" dc:"状态" d:"1"`
StoreId int64 `json:"storeId" dc:"门店ID"`
RewardTypeId int64 `json:"rewardTypeId" v:"required#奖励类型ID不能为空" dc:"奖励类型ID"`
Source int `json:"source" v:"in:1,2#来源只能为1或2" dc:"来源"`
ExpireType int `json:"expireType" v:"required#过期类型只能为1或2" dc:"过期类型"`
ValidFrom *gtime.Time `json:"validFrom" dc:"有效开始时间expire_type=1 时使用)"`
ValidTo *gtime.Time `json:"validTo" dc:"有效结束时间expire_type=1 时使用)"`
ExpireDays int `json:"expireDays" dc:"领取后多少天过期"`
g.Meta `path:"/reward" method:"post" tags:"Reward" summary:"(系统、商户、门店后台)创建奖励"`
StoreId int64 `json:"storeId" dc:"门店ID"`
Name string `json:"name" v:"required#名称不能为空" dc:"名称"`
RewardTypeId int64 `json:"rewardTypeId" v:"required#奖励类型ID不能为空" dc:"奖励类型ID"`
GameId int64 `json:"gameId" v:"required#游戏ID不能为空" dc:"游戏ID"`
RewardImg string `json:"rewardImg" dc:"奖励图片"`
QQGoodsId string `json:"qqGoodsId" v:"required#不能为空" dc:"QQ网吧物品ID"`
QQGoodsIdStr string `json:"qqGoodsIdStr" v:"required#不能为空" dc:"QQ网吧物品ID字符串"`
Status int `json:"status" dc:"状态" d:"1启用 2禁用"`
ExpireType int `json:"expireType" v:"required#过期类型只能为1或2" dc:"过期类型"`
ValidFrom *gtime.Time `json:"validFrom" dc:"有效开始时间expire_type=1 时使用)"`
ValidTo *gtime.Time `json:"validTo" dc:"有效结束时间expire_type=1 时使用)"`
ExpireDays int `json:"expireDays" dc:"领取后多少天过期"`
DailyTotalLimit int `json:"dailyTotalLimit" v:"required#每日领取总次数限制" dc:"每日领取总次数限制"`
TotalLimit int `json:"totalLimit" v:"required#奖励总限不能为空" dc:"领取总次数限制"`
UserDailyLimit int `json:"userDailyLimit" v:"required#用户每日领取总次数限制" dc:"用户每日领取总次数限制"`
UserTotalLimit int `json:"userTotalLimit" v:"required#用户领取总次数限制" dc:"用户领取总次数限制"`
GrantQuantify int `json:"grantQuantify" v:"required#发放数量不能为空" dc:"发放数量"`
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1"`
}
type CreateRes struct {
Id int64 `json:"id" dc:"奖励ID"`
Success bool `json:"success" dc:"是否成功"`
}
type UpdateReq struct {
g.Meta `path:"/reward" method:"put" tags:"Reward" summary:"(系统、商户、门店后台)更新奖励"`
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Name string `json:"name" v:"required#名称不能为空" dc:"名称"`
Description string `json:"description" v:"required#描述不能为空" dc:"描述"`
Value int64 `json:"value" v:"required#数值不能为空" dc:"奖励值"`
Status int `json:"status" dc:"状态" d:"1"`
StoreId int64 `json:"storeId" dc:"门店ID"`
ExpireType int `json:"expireType" dc:"过期类型" d:"1"`
ValidFrom *gtime.Time `json:"validFrom" dc:"有效开始时间expire_type=1 时使用)"`
ValidTo *gtime.Time `json:"validTo" dc:"有效结束时间(expire_type=1 时使用)"`
ExpireDays int `json:"expireDays" dc:"领取后多少天过期"`
g.Meta `path:"/reward" method:"put" tags:"Reward" summary:"(系统、商户、门店后台)更新奖励"`
Id int64 `json:"id" v:"required#id不能为空" dc:"ID"`
Name string `json:"name" dc:"名称"`
RewardType int `json:"rewardType" dc:"奖励类型"`
GameId int64 `json:"gameId" dc:"游戏id"`
Img string `json:"img" dc:"图片"`
QQGoodsId string `json:"qqGoodsId" dc:"qq商品id"`
QQGoodsIdStr string `json:"qqGoodsIdStr" dc:"qq商品id"`
Status int `json:"status" dc:"状态" d:"1"`
ExpireType int `json:"expireType" dc:"过期类型" d:"1"`
ValidFrom *gtime.Time `json:"validFrom" dc:"有效开始时间expire_type=1 时使用)"`
ValidTo *gtime.Time `json:"validTo" dc:"有效结束时间expire_type=1 时使用)"`
ExpireDays int `json:"expireDays" dc:"领取后多少天过期"`
DailyTotalLimit int `json:"dailyTotalLimit" dc:"每日领取总次数限制"`
TotalLimit int `json:"totalLimit" dc:"领取总次数限制"`
UserDailyLimit int `json:"userDailyLimit" dc:"用户每日领取总次数限制"`
UserTotalLimit int `json:"userTotalLimit" dc:"用户领取总次数限制"`
GrantQuantify int `json:"grantQuantify" dc:"发放数量"`
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1"`
}
type UpdateRes struct {
@ -60,6 +75,7 @@ type UpdateRes struct {
type DeleteReq struct {
g.Meta `path:"/reward/{id}" method:"delete" tags:"Reward" summary:"(系统、商户、门店后台)删除奖励"`
Id int64 `in:"path" json:"id" v:"required#ID不能为空" dc:"ID"`
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1"`
}
type DeleteRes struct {

View File

@ -14,22 +14,30 @@ func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.C
operatorId := fromCtx.GetCtxVar("id").Int64()
operatorRole := fromCtx.GetCtxVar("role").String()
out, err := service.Reward().Create(ctx, &model.RewardCreateIn{
Name: req.Name,
Description: req.Description,
Value: req.Value,
Status: req.Status,
OperatorId: operatorId,
OperatorRole: operatorRole,
StoreId: req.StoreId,
RewardTypeId: req.RewardTypeId,
Source: req.Source,
ExpireType: req.ExpireType,
ExpireDays: req.ExpireDays,
ValidFrom: req.ValidFrom,
ValidTo: req.ValidTo,
StoreId: req.StoreId,
Name: req.Name,
RewardTypeId: req.RewardTypeId,
GameId: req.GameId,
Img: req.RewardImg,
QQGoodsId: req.QQGoodsId,
QQGoodsIdStr: req.QQGoodsIdStr,
Status: req.Status,
OperatorId: operatorId,
OperatorRole: operatorRole,
ExpireType: req.ExpireType,
ExpireDays: req.ExpireDays,
ValidFrom: req.ValidFrom,
ValidTo: req.ValidTo,
DailyTotalLimit: int64(req.DailyTotalLimit),
TotalLimit: int64(req.TotalLimit),
UserDailyLimit: int64(req.UserDailyLimit),
UserTotalLimit: int64(req.UserTotalLimit),
GrantQuantity: int64(req.GrantQuantify),
Source: req.Source,
})
if err != nil {
return nil, err
}
return &v1.CreateRes{Id: out.Id}, nil
return &v1.CreateRes{Success: out.Success}, nil
}

View File

@ -13,7 +13,7 @@ func (c *ControllerV1) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.D
fromCtx := g.RequestFromCtx(ctx)
operatorId := fromCtx.GetCtxVar("id").Int64()
operatorRole := fromCtx.GetCtxVar("role").String()
out, err := service.Reward().Delete(ctx, &model.RewardDeleteIn{Id: req.Id, OperatorId: operatorId, OperatorRole: operatorRole})
out, err := service.Reward().Delete(ctx, &model.RewardDeleteIn{Id: req.Id, OperatorId: operatorId, OperatorRole: operatorRole, Source: req.Source})
if err != nil {
return nil, err
}

View File

@ -14,18 +14,26 @@ func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.U
operatorId := fromCtx.GetCtxVar("id").Int64()
operatorRole := fromCtx.GetCtxVar("role").String()
out, err := service.Reward().Update(ctx, &model.RewardUpdateIn{
Id: req.Id,
Name: req.Name,
Description: req.Description,
Value: req.Value,
OperatorId: operatorId,
OperatorRole: operatorRole,
StoreId: req.StoreId,
Status: req.Status,
ExpireType: req.ExpireType,
ExpireDays: req.ExpireDays,
ValidFrom: req.ValidFrom,
ValidTo: req.ValidTo,
Id: req.Id,
Name: req.Name,
RewardTypeId: int64(req.RewardType),
GameId: req.GameId,
Img: req.Img,
QQGoodsId: req.QQGoodsId,
QQGoodsIdStr: req.QQGoodsIdStr,
OperatorId: operatorId,
OperatorRole: operatorRole,
Status: req.Status,
ExpireType: req.ExpireType,
ExpireDays: req.ExpireDays,
ValidFrom: req.ValidFrom,
ValidTo: req.ValidTo,
DailyTotalLimit: int64(req.DailyTotalLimit),
TotalLimit: int64(req.TotalLimit),
UserDailyLimit: int64(req.UserDailyLimit),
UserTotalLimit: int64(req.UserTotalLimit),
GrantQuantity: int64(req.GrantQuantify),
Source: req.Source,
})
if err != nil {
return nil, err

View File

@ -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.

View File

@ -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.

View File

@ -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.
@ -45,11 +46,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,
}
}
@ -75,7 +77,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.

View File

@ -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.

View File

@ -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.

View File

@ -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.
@ -43,11 +44,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,
}
}
@ -73,7 +75,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.

View File

@ -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.
@ -71,11 +72,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,
}
}
@ -101,7 +103,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.

View File

@ -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.

View File

@ -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.

View File

@ -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.
@ -33,11 +34,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,
}
}
@ -63,7 +65,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.

View File

@ -13,9 +13,10 @@ import (
// StoreIpsDao is the data access object for the table store_ips.
type StoreIpsDao 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 StoreIpsColumns // 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 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.
@ -41,11 +42,12 @@ var storeIpsColumns = StoreIpsColumns{
}
// NewStoreIpsDao creates and returns a new DAO object for table data access.
func NewStoreIpsDao() *StoreIpsDao {
func NewStoreIpsDao(handlers ...gdb.ModelHandler) *StoreIpsDao {
return &StoreIpsDao{
group: "default",
table: "store_ips",
columns: storeIpsColumns,
group: "default",
table: "store_ips",
columns: storeIpsColumns,
handlers: handlers,
}
}
@ -71,7 +73,11 @@ func (dao *StoreIpsDao) Group() string {
// 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 {
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.

View File

@ -13,9 +13,10 @@ import (
// StoreNetfeeAreaLevelDao is the data access object for the table store_netfee_area_level.
type StoreNetfeeAreaLevelDao 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 StoreNetfeeAreaLevelColumns // 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 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.
@ -49,11 +50,12 @@ var storeNetfeeAreaLevelColumns = StoreNetfeeAreaLevelColumns{
}
// NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access.
func NewStoreNetfeeAreaLevelDao() *StoreNetfeeAreaLevelDao {
func NewStoreNetfeeAreaLevelDao(handlers ...gdb.ModelHandler) *StoreNetfeeAreaLevelDao {
return &StoreNetfeeAreaLevelDao{
group: "default",
table: "store_netfee_area_level",
columns: storeNetfeeAreaLevelColumns,
group: "default",
table: "store_netfee_area_level",
columns: storeNetfeeAreaLevelColumns,
handlers: handlers,
}
}
@ -79,7 +81,11 @@ func (dao *StoreNetfeeAreaLevelDao) Group() string {
// 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 {
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.

View File

@ -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.

View File

@ -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.

View File

@ -13,9 +13,10 @@ 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.
@ -57,11 +58,12 @@ var tasksColumns = TasksColumns{
}
// 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,
}
}
@ -87,7 +89,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.

View File

@ -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.
@ -51,11 +52,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,
}
}
@ -81,7 +83,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.

View File

@ -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.

View File

@ -17,7 +17,6 @@ type sReward struct{}
func init() {
service.RegisterReward(New())
service.RegisterReward(New())
}
func New() service.IReward {
@ -75,21 +74,26 @@ func (s *sReward) Create(ctx context.Context, in *model.RewardCreateIn) (out *mo
}
// 创建奖励
id, err := dao.Rewards.Ctx(ctx).Data(do.Rewards{
RewardTypeId: in.RewardTypeId,
Name: in.Name,
StoreId: in.StoreId,
Status: in.Status,
ValidFrom: in.ValidFrom,
ValidTo: in.ValidTo,
ExpireType: in.ExpireType,
ExpireDays: in.ExpireDays,
}).OmitEmptyData().InsertAndGetId()
_, err = dao.Rewards.Ctx(ctx).Data(do.Rewards{
StoreId: in.StoreId,
Name: in.Name,
RewardTypeId: in.RewardTypeId,
ImageUrl: in.Img,
QqGoodsId: in.QQGoodsId,
QqGoodsIdStr: in.QQGoodsIdStr,
Status: in.Status,
ValidFrom: in.ValidFrom,
ValidTo: in.ValidTo,
ExpireType: in.ExpireType,
ExpireDays: in.ExpireDays,
DailyTotalLimit: in.DailyTotalLimit,
}).OmitEmptyData().Insert()
if err != nil {
return nil, err
}
return &model.RewardCreateOut{Id: id}, nil
return &model.RewardCreateOut{Success: true}, nil
}
// Update 更新奖励
@ -105,6 +109,11 @@ func (s *sReward) Update(ctx context.Context, in *model.RewardUpdateIn) (out *mo
return nil, ecode.Params.Sub("奖励不存在")
}
// 系统奖励source=1只能由管理员修改
if in.Source == 1 && in.OperatorRole != consts.AdminRoleCode {
return nil, ecode.Params.Sub("只有管理员可以修改系统奖励")
}
storeId := data[dao.Rewards.Columns().StoreId].Int64()
// 权限校验(管理员跳过)
@ -154,12 +163,22 @@ func (s *sReward) Update(ctx context.Context, in *model.RewardUpdateIn) (out *mo
_, err = dao.Rewards.Ctx(ctx).
Where(do.Rewards{Id: in.Id}).
Data(do.Rewards{
Name: in.Name,
Status: in.Status,
ValidFrom: in.ValidFrom,
ValidTo: in.ValidTo,
ExpireType: in.ExpireType,
ExpireDays: in.ExpireDays,
Name: in.Name,
RewardTypeId: in.RewardTypeId,
GameId: in.GameId,
ImageUrl: in.Img,
QqGoodsId: in.QQGoodsId,
QqGoodsIdStr: in.QQGoodsIdStr,
Status: in.Status,
ValidFrom: in.ValidFrom,
ValidTo: in.ValidTo,
ExpireType: in.ExpireType,
ExpireDays: in.ExpireDays,
DailyTotalLimit: in.DailyTotalLimit,
TotalLimit: in.TotalLimit,
UserDailyLimit: in.UserDailyLimit,
UserTotalLimit: in.UserTotalLimit,
GrantQuantity: in.GrantQuantity,
}).OmitEmptyData().Update()
if err != nil {
@ -186,7 +205,7 @@ func (s *sReward) Update(ctx context.Context, in *model.RewardUpdateIn) (out *mo
// Delete 删除奖励
func (s *sReward) Delete(ctx context.Context, in *model.RewardDeleteIn) (out *model.RewardDeleteOut, err error) {
data, err := dao.Rewards.Ctx(ctx).
Fields("id", "source", "store_id").
Fields("id", "store_id").
Where(do.Rewards{Id: in.Id}).One()
if err != nil {
return nil, ecode.Fail.Sub("查询奖励失败")
@ -195,7 +214,7 @@ func (s *sReward) Delete(ctx context.Context, in *model.RewardDeleteIn) (out *mo
return nil, ecode.Params.Sub("奖励不存在")
}
if data["source"].Int() == 1 && in.OperatorRole != consts.AdminRoleCode {
if in.Source == 1 && in.OperatorRole != consts.AdminRoleCode {
return nil, ecode.Params.Sub("只有管理员可以删除系统奖励")
}
@ -234,15 +253,111 @@ func (s *sReward) Delete(ctx context.Context, in *model.RewardDeleteIn) (out *mo
}
// List 奖励列表
func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.RewardListOut, err error) {
return nil, nil
rewardCols := dao.Rewards.Columns()
rewardTypeCols := dao.RewardTypes.Columns()
rewardTypeIds := make([]int64, 0)
// ==== 权限校验 ====
switch in.OperatorRole {
case consts.AdminRoleCode:
// 系统管理员只能查询 source = 1 的奖励
array, err := dao.RewardTypes.Ctx(ctx).Where(do.RewardTypes{Source: 1}).Fields(rewardTypeCols.Id).Array()
if err != nil {
return nil, ecode.Fail.Sub("获取奖励类型列表失败")
}
for _, value := range array {
rewardTypeIds = append(rewardTypeIds, value.Int64())
}
case consts.MerchantRoleCode, consts.StoreRoleCode:
// 合并商户和门店角色权限校验
var exist bool
if in.OperatorRole == consts.MerchantRoleCode {
exist, err = dao.MerchantAdmins.Ctx(ctx).
Where(do.MerchantAdmins{Id: in.OperatorId}).
LeftJoin(
dao.Stores.Table(),
fmt.Sprintf("%s.%s = %s.%s",
dao.MerchantAdmins.Table(), dao.MerchantAdmins.Columns().MerchantId,
dao.Stores.Table(), dao.Stores.Columns().MerchantId,
),
).
Where(fmt.Sprintf("%s.%s = ?", dao.Stores.Table(), dao.Stores.Columns().Id), in.StoreId).
Exist()
} else {
exist, err = dao.StoreAdmins.Ctx(ctx).
Where(do.StoreAdmins{Id: in.OperatorId}).
LeftJoin(
dao.Stores.Table(),
fmt.Sprintf("%s.%s = %s.%s",
dao.StoreAdmins.Table(), dao.StoreAdmins.Columns().StoreId,
dao.Stores.Table(), dao.Stores.Columns().Id,
),
).
Where(fmt.Sprintf("%s.%s = ?", dao.Stores.Table(), dao.Stores.Columns().Id), in.StoreId).
Exist()
}
if err != nil {
return nil, ecode.Fail.Sub("检查操作者权限异常")
}
if !exist {
return nil, ecode.Params.Sub("无门店权限")
}
//
array, err := dao.RewardTypes.Ctx(ctx).Where(do.RewardTypes{Source: 1}).Fields(rewardTypeCols.Id).Array()
if err != nil {
return nil, ecode.Fail.Sub("获取奖励类型列表失败")
}
for _, value := range array {
rewardTypeIds = append(rewardTypeIds, value.Int64())
}
default:
return nil, ecode.Params.Sub("无效的角色")
}
orm := dao.Rewards.Ctx(ctx).WhereIn(dao.Rewards.Columns().RewardTypeId, rewardTypeIds)
// ==== 其他查询条件 ====
if in.Status != 0 {
orm = orm.Where(fmt.Sprintf("%s.%s = ?", dao.Rewards.Table(), rewardCols.Status), in.Status)
}
if in.RewardTypeId != 0 {
// 确保 reward_type_id 过滤独立应用
orm = orm.Where(fmt.Sprintf("%s.%s = ?", dao.Rewards.Table(), rewardCols.RewardTypeId), in.RewardTypeId)
}
if in.Name != "" {
orm = orm.WhereLike(rewardCols.Name, "%"+in.Name+"%")
}
// ==== 总数统计 ====
list := make([]model.Reward, 0)
var total int
err = orm.ScanAndCount(&list, &total, false)
if err != nil {
return nil, err
}
return &model.RewardListOut{
List: list,
Total: total,
}, nil
}
// GetLift 领取奖励
func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
// 遍历奖励类型列表
//for _, v := range in.RewradTypeId {
// if v > 0 {
// // 发背包+兑换
//
// }
// if v > 0 {
// // 直接发背包
// }
//}
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: model.GiftParam{
TaskId: in.TaskId,
AreaId: in.AreaId,

View File

@ -1,70 +1,86 @@
package model
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// Reward 奖励表
type Reward struct {
g.Meta `orm:"table:reward"`
Id int64 `json:"id" dc:"奖励ID" orm:"id,primary"`
RewardTypeId int64 `json:"rewardTypeId" dc:"奖励类型ID" orm:"reward_type_id"`
RewardTypeName string `json:"rewardTypeName" dc:"奖励类型名称" orm:"reward_type_name"`
Name string `json:"name" dc:"奖励名称如100积分、5元优惠券" orm:"name"`
Description string `json:"description" dc:"奖励描述" orm:"description"`
Source int `json:"source" dc:"来源1=系统内置2=门店自定义" orm:"source"`
StoreId int64 `json:"storeId" dc:"门店ID系统内置奖励为NULL" orm:"store_id"`
Value int64 `json:"value" dc:"奖励值(如积分数额、优惠金额)" orm:"value"`
Status int `json:"status" dc:"状态1=正常0=禁用" orm:"status"`
TotalNum int64 `json:"totalNum" dc:"奖励数量" orm:"total_num"`
UseNum int64 `json:"useNum" dc:"已使用数量" orm:"use_num"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间" orm:"created_at"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间" orm:"updated_at"`
DeletedAt *gtime.Time `json:"deletedAt" dc:"软删除时间戳" orm:"deleted_at"`
ExpireType int `json:"expireType"` // 过期类型1=时间段过期2=领取后多少天过期
ValidFrom *gtime.Time `json:"validFrom"` // 有效开始时间expire_type=1 时使用
ValidTo *gtime.Time `json:"validTo"` // 有效结束时间expire_type=1 时使用)
ExpireDays int `json:"expireDays"` // 领取后多少天过期expire_type=2 时使用)
Id int64 `json:"id" orm:"id" description:"奖励ID"` // 奖励ID
StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID系统奖励为NULL"` // 门店ID系统奖励为NULL
Name string `json:"name" orm:"name" description:"奖励名称"` // 奖励名称
RewardTypeId int64 `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID关联 reward_types 表"` // 奖励类型ID关联 reward_types 表
GameId int64 `json:"gameId" orm:"game_id" description:"游戏ID"` // 游戏ID
ImageUrl string `json:"imageUrl" orm:"image_url" description:"奖励图片链接"` // 奖励图片链接
QqGoodsId string `json:"qqGoodsId" orm:"qq_goods_id" description:"QQ网吧物品ID"` // QQ网吧物品ID
QqGoodsIdStr string `json:"qqGoodsIdStr" orm:"qq_goods_id_str" description:"QQ网吧物品ID字符串"` // QQ网吧物品ID字符串
Status int `json:"status" orm:"status" description:"状态1=启用2=禁用"` // 状态1=启用2=禁用
ExpireType int `json:"expireType" orm:"expire_type" description:"过期方式1=时间段过期2=领取后过期"` // 过期方式1=时间段过期2=领取后过期
ValidFrom *gtime.Time `json:"validFrom" orm:"valid_from" description:"有效期开始时间expire_type=1时"` // 有效期开始时间expire_type=1时
ValidTo *gtime.Time `json:"validTo" orm:"valid_to" description:"有效期结束时间expire_type=1时"` // 有效期结束时间expire_type=1时
ExpireDays int `json:"expireDays" orm:"expire_days" description:"领取后多少天过期expire_type=2时"` // 领取后多少天过期expire_type=2时
DailyTotalLimit uint64 `json:"dailyTotalLimit" orm:"daily_total_limit" description:"每日发放总限NULL表示不限制"` // 每日发放总限NULL表示不限制
TotalLimit uint64 `json:"totalLimit" orm:"total_limit" description:"奖励总限NULL表示不限制"` // 奖励总限NULL表示不限制
UserDailyLimit uint64 `json:"userDailyLimit" orm:"user_daily_limit" description:"用户每日领取限制NULL表示不限制"` // 用户每日领取限制NULL表示不限制
UserTotalLimit uint64 `json:"userTotalLimit" orm:"user_total_limit" description:"用户领取总次数限制NULL表示不限制"` // 用户领取总次数限制NULL表示不限制
ReceivedNum uint64 `json:"receivedNum" orm:"received_num" description:"已领取数量"` // 已领取数量
GrantQuantity uint64 `json:"grantQuantity" orm:"grant_quantity" description:"每次发放个数"` // 每次发放个数
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间(软删除)"` // 删除时间(软删除)
}
// RewardCreateIn 创建奖励入参
type RewardCreateIn struct {
OperatorId int64
OperatorRole string
RewardTypeId int64
Name string
Description string
Source int
StoreId int64
Value int64
Status int
ExpireType int
ExpireDays int
ValidFrom *gtime.Time
ValidTo *gtime.Time
OperatorId int64
OperatorRole string
StoreId int64
Name string
RewardTypeId int64
GameId int64
Img string
QQGoodsId string
QQGoodsIdStr string
Status int
ExpireType int
ExpireDays int
ValidFrom *gtime.Time
ValidTo *gtime.Time
DailyTotalLimit int64
TotalLimit int64
UserDailyLimit int64
UserTotalLimit int64
GrantQuantity int64
Source int
}
// RewardCreateOut 创建奖励出参
type RewardCreateOut struct {
Id int64
Success bool `json:"success" dc:"是否成功"`
}
// RewardUpdateIn 更新奖励入参
type RewardUpdateIn struct {
OperatorId int64
OperatorRole string
Id int64
RewardTypeId int64
Name string
Description string
StoreId int64
Value int64
Status int
ExpireType int
ExpireDays int
ValidFrom *gtime.Time
ValidTo *gtime.Time
Id int64
OperatorId int64
OperatorRole string
Name string
RewardTypeId int64
GameId int64
Img string
QQGoodsId string
QQGoodsIdStr string
Status int
ExpireType int
ExpireDays int
ValidFrom *gtime.Time
ValidTo *gtime.Time
DailyTotalLimit int64
TotalLimit int64
UserDailyLimit int64
UserTotalLimit int64
GrantQuantity int64
Source int
}
// RewardUpdateOut 更新奖励出参
@ -77,6 +93,7 @@ type RewardDeleteIn struct {
Id int64
OperatorId int64
OperatorRole string
Source int
}
// RewardDeleteOut 删除奖励出参
@ -94,7 +111,6 @@ type RewardListIn struct {
StoreId int64
RewardTypeId int64
Status int
Source int
}
// RewardListOut 奖励列表查询出参