创建用户任务奖励记录表

This commit is contained in:
2025-06-26 09:37:33 +08:00
parent ecee39efff
commit 3ae9f96045
31 changed files with 386 additions and 304 deletions

View File

@ -211,14 +211,15 @@ type CallbackRes struct {
} }
type GetLiftReq struct { type GetLiftReq struct {
g.Meta `path:"/reward/getLift" method:"post" tags:"Reward" summary:"(tencent)奖励领取"` g.Meta `path:"/reward/getLift" method:"post" tags:"Reward" summary:"(PC)奖励领取"`
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"` RewradType int `json:"rewardType" v:"required#奖励类型不能为空" dc:"奖励类型"`
AreaId int64 `json:"areaId" dc:"大区Id"` PopenId string `json:"popenid" v:"required#popenId不能为空" dc:"popenId不能为空"`
GameId int64 `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"`
RoleIdx string `json:"roleIdx" dc:"角色索引"`
RewradType int64 `json:"rewardType" v:"required#奖励类型不能为空" dc:"奖励类型"`
PopenId string `json:"popenid" dc:""`
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1:系统 2:门店"` Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1:系统 2:门店"`
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
GameId int `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"`
BindType int `json:"bindType" v:"required#绑定类型不能为空" dc:"绑定类型"`
AreaId int `json:"areaId" dc:"大区Id"`
RoleIdx string `json:"roleIdx" dc:"角色索引"`
} }
type GetLiftRes struct { type GetLiftRes struct {

View File

@ -4,6 +4,6 @@
gfcli: gfcli:
gen: gen:
dao: dao:
- link: "mysql:root:MSms0427@tcp(localhost:3306)/arenax" - link: "mysql:root:123456@tcp(192.168.3.92:3306)/arenax"
descriptionTag: true descriptionTag: true
tablesEx: "casbin_rule" tablesEx: "casbin_rule"

View File

@ -0,0 +1,12 @@
package consts
// 用户任务奖励状态
const (
RewardInitStatus = iota + 1
RewardPendingStatus
RewardClaimedStatus
RewardExchangeStatus
RewardSuccessStatus
RewardExpiredStatus
RewardFailedStatus
)

View File

@ -9,13 +9,14 @@ import (
func (c *ControllerV1) GetLift(ctx context.Context, req *v1.GetLiftReq) (res *v1.GetLiftRes, err error) { func (c *ControllerV1) GetLift(ctx context.Context, req *v1.GetLiftReq) (res *v1.GetLiftRes, err error) {
out, err := service.Reward().GetLift(ctx, &model.GetRewardIn{ out, err := service.Reward().GetLift(ctx, &model.GetRewardIn{
GameId: int(req.GameId), GameId: req.GameId,
TaskId: req.TaskId, TaskId: req.TaskId,
PopenId: req.PopenId, PopenId: req.PopenId,
RewradTypeId: int(req.RewradType), RewradTypeId: req.RewradType,
RoleIdx: req.RoleIdx, RoleIdx: req.RoleIdx,
AreaId: int(req.AreaId), AreaId: req.AreaId,
Source: req.Source, Source: req.Source,
BindType: req.BindType,
}) })
if err != nil { if err != nil {

View File

@ -13,10 +13,9 @@ import (
// AdminsDao is the data access object for the table admins. // AdminsDao is the data access object for the table admins.
type AdminsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// FeedbacksDao is the data access object for the table feedbacks. // FeedbacksDao is the data access object for the table feedbacks.
type FeedbacksDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// GamesDao is the data access object for the table games. // GamesDao is the data access object for the table games.
type GamesDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// MerchantAdminsDao is the data access object for the table merchant_admins. // MerchantAdminsDao is the data access object for the table merchant_admins.
type MerchantAdminsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// MerchantsDao is the data access object for the table merchants. // MerchantsDao is the data access object for the table merchants.
type MerchantsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// NoticesDao is the data access object for the table notices. // NoticesDao is the data access object for the table notices.
type NoticesDao struct { type NoticesDao 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 NoticesColumns // columns contains all the column names of Table for convenient usage. columns NoticesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// NoticesColumns defines and stores column names for the table notices. // NoticesColumns defines and stores column names for the table notices.
@ -50,12 +49,11 @@ var noticesColumns = NoticesColumns{
} }
// NewNoticesDao creates and returns a new DAO object for table data access. // NewNoticesDao creates and returns a new DAO object for table data access.
func NewNoticesDao(handlers ...gdb.ModelHandler) *NoticesDao { func NewNoticesDao() *NoticesDao {
return &NoticesDao{ return &NoticesDao{
group: "default", group: "default",
table: "notices", table: "notices",
columns: noticesColumns, columns: noticesColumns,
handlers: handlers,
} }
} }
@ -81,11 +79,7 @@ func (dao *NoticesDao) 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 *NoticesDao) Ctx(ctx context.Context) *gdb.Model { func (dao *NoticesDao) 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.

View File

@ -13,10 +13,9 @@ import (
// RewardTypesDao is the data access object for the table reward_types. // RewardTypesDao is the data access object for the table reward_types.
type RewardTypesDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// RewardWatersDao is the data access object for the table reward_waters. // RewardWatersDao is the data access object for the table reward_waters.
type RewardWatersDao struct { type RewardWatersDao 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 RewardWatersColumns // columns contains all the column names of Table for convenient usage. columns RewardWatersColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// RewardWatersColumns defines and stores column names for the table reward_waters. // RewardWatersColumns defines and stores column names for the table reward_waters.
@ -46,12 +45,11 @@ var rewardWatersColumns = RewardWatersColumns{
} }
// NewRewardWatersDao creates and returns a new DAO object for table data access. // NewRewardWatersDao creates and returns a new DAO object for table data access.
func NewRewardWatersDao(handlers ...gdb.ModelHandler) *RewardWatersDao { func NewRewardWatersDao() *RewardWatersDao {
return &RewardWatersDao{ return &RewardWatersDao{
group: "default", group: "default",
table: "reward_waters", table: "reward_waters",
columns: rewardWatersColumns, columns: rewardWatersColumns,
handlers: handlers,
} }
} }
@ -77,11 +75,7 @@ func (dao *RewardWatersDao) 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 *RewardWatersDao) Ctx(ctx context.Context) *gdb.Model { func (dao *RewardWatersDao) 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.

View File

@ -13,10 +13,9 @@ import (
// RewardsDao is the data access object for the table rewards. // RewardsDao is the data access object for the table rewards.
type RewardsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// RolesDao is the data access object for the table roles. // RolesDao is the data access object for the table roles.
type RolesDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// StoreAdminsDao is the data access object for the table store_admins. // StoreAdminsDao is the data access object for the table store_admins.
type StoreAdminsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// StoreDesktopSettingsDao is the data access object for the table store_desktop_settings. // StoreDesktopSettingsDao is the data access object for the table store_desktop_settings.
type StoreDesktopSettingsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// StoreIpsDao is the data access object for the table store_ips. // StoreIpsDao is the data access object for the table store_ips.
type StoreIpsDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// StoreNetfeeAreaLevelDao is the data access object for the table store_netfee_area_level. // StoreNetfeeAreaLevelDao is the data access object for the table store_netfee_area_level.
type StoreNetfeeAreaLevelDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// StoreRolesDao is the data access object for the table store_roles. // StoreRolesDao is the data access object for the table store_roles.
type StoreRolesDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// StoresDao is the data access object for the table stores. // StoresDao is the data access object for the table stores.
type StoresDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// TaskRewardsDao is the data access object for the table task_rewards. // TaskRewardsDao is the data access object for the table task_rewards.
type TaskRewardsDao struct { type TaskRewardsDao 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 TaskRewardsColumns // columns contains all the column names of Table for convenient usage. columns TaskRewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// TaskRewardsColumns defines and stores column names for the table task_rewards. // TaskRewardsColumns defines and stores column names for the table task_rewards.
@ -32,12 +31,11 @@ var taskRewardsColumns = TaskRewardsColumns{
} }
// NewTaskRewardsDao creates and returns a new DAO object for table data access. // NewTaskRewardsDao creates and returns a new DAO object for table data access.
func NewTaskRewardsDao(handlers ...gdb.ModelHandler) *TaskRewardsDao { func NewTaskRewardsDao() *TaskRewardsDao {
return &TaskRewardsDao{ return &TaskRewardsDao{
group: "default", group: "default",
table: "task_rewards", table: "task_rewards",
columns: taskRewardsColumns, columns: taskRewardsColumns,
handlers: handlers,
} }
} }
@ -63,11 +61,7 @@ func (dao *TaskRewardsDao) 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 *TaskRewardsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *TaskRewardsDao) 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.

View File

@ -13,10 +13,9 @@ import (
// TasksDao is the data access object for the table tasks. // TasksDao is the data access object for the table tasks.
type TasksDao struct { 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.

View File

@ -0,0 +1,91 @@
// ==========================================================================
// 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"
)
// UserTaskRewardsDao is the data access object for the table user_task_rewards.
type UserTaskRewardsDao 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 UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
}
// UserTaskRewardsColumns defines and stores column names for the table user_task_rewards.
type UserTaskRewardsColumns struct {
Id string // 用户任务奖励记录唯一标识符
UserTaskId string // 关联用户任务记录ID
RewardId string // 奖励ID
RewardName string // 奖励名称冗余字段
Status string // 状态1=待完成2=待领取3=已领取4=待兑换5=已完成6=已过期7=发放失败
Remark string // 备注或失败原因
ExternalOrderId string // 第三方发放平台的订单ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间
}
// userTaskRewardsColumns holds the columns for the table user_task_rewards.
var userTaskRewardsColumns = UserTaskRewardsColumns{
Id: "id",
UserTaskId: "user_task_id",
RewardId: "reward_id",
RewardName: "reward_name",
Status: "status",
Remark: "remark",
ExternalOrderId: "external_order_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewUserTaskRewardsDao creates and returns a new DAO object for table data access.
func NewUserTaskRewardsDao() *UserTaskRewardsDao {
return &UserTaskRewardsDao{
group: "default",
table: "user_task_rewards",
columns: userTaskRewardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *UserTaskRewardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *UserTaskRewardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *UserTaskRewardsDao) Columns() UserTaskRewardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *UserTaskRewardsDao) 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 *UserTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).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 *UserTaskRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -13,10 +13,9 @@ import (
// UserTasksDao is the data access object for the table user_tasks. // UserTasksDao is the data access object for the table user_tasks.
type UserTasksDao struct { 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.

View File

@ -13,10 +13,9 @@ import (
// UsersDao is the data access object for the table users. // UsersDao is the data access object for the table users.
type UsersDao struct { 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.

View File

@ -0,0 +1,27 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalUserTaskRewardsDao is an internal type for wrapping the internal DAO implementation.
type internalUserTaskRewardsDao = *internal.UserTaskRewardsDao
// userTaskRewardsDao is the data access object for the table user_task_rewards.
// You can define custom methods on it to extend its functionality as needed.
type userTaskRewardsDao struct {
internalUserTaskRewardsDao
}
var (
// UserTaskRewards is a globally accessible object for table user_task_rewards operations.
UserTaskRewards = userTaskRewardsDao{
internal.NewUserTaskRewardsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -3,6 +3,7 @@ package task
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/gogf/gf/v2/database/gdb"
"server/internal/consts" "server/internal/consts"
"server/internal/dao" "server/internal/dao"
"server/internal/model" "server/internal/model"
@ -343,19 +344,39 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
return nil, ecode.Fail.Sub("生成流水号异常") return nil, ecode.Fail.Sub("生成流水号异常")
} }
dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: in.TaskId}) if err = dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
_, err = dao.UserTasks.Ctx(ctx).Insert(do.UserTasks{ // 创建任务记录
UserId: in.UserId, id, err := dao.UserTasks.Ctx(ctx).InsertAndGetId(do.UserTasks{
TaskId: in.TaskId, UserId: in.UserId,
StoreId: storeId, TaskId: in.TaskId,
Status: 1, StoreId: storeId,
SerialNumber: serialNumber, Status: 1,
TaskName: in.TaskName, SerialNumber: serialNumber,
GameId: in.GameId, TaskName: in.TaskName,
}) GameId: in.GameId,
})
if err != nil {
return ecode.Fail.Sub("创建用户任务记录失败")
}
if err != nil { // 查询该任务相关联的奖励, 创建对应奖励下发记录id
return nil, ecode.Fail.Sub("添加任务记录异常") array, err := dao.TaskRewards.Ctx(ctx).Where(do.TaskRewards{TaskId: in.TaskId}).Fields(dao.TaskRewards.Columns().RewardId).Array()
if err != nil {
return ecode.Fail.Sub("获取任务关联奖励列表失败")
}
for _, v := range array {
_, err = dao.UserTaskRewards.Ctx(ctx).Data(do.UserTaskRewards{
UserTaskId: id,
RewardId: v.Int64(),
Status: consts.RewardInitStatus,
}).Insert()
if err != nil {
return ecode.Fail.Sub("创建用户任务奖励记录失败")
}
}
return
}); err != nil {
return nil, err
} }
return &model.GetTaskOut{ return &model.GetTaskOut{
Success: true, Success: true,

View File

@ -0,0 +1,25 @@
// =================================================================================
// 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"
)
// UserTaskRewards is the golang structure of table user_task_rewards for DAO operations like Where/Data.
type UserTaskRewards struct {
g.Meta `orm:"table:user_task_rewards, do:true"`
Id interface{} // 用户任务奖励记录唯一标识符
UserTaskId interface{} // 关联用户任务记录ID
RewardId interface{} // 奖励ID
RewardName interface{} // 奖励名称冗余字段
Status interface{} // 状态1=待完成2=待领取3=已领取4=待兑换5=已完成6=已过期7=发放失败
Remark interface{} // 备注或失败原因
ExternalOrderId interface{} // 第三方发放平台的订单ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@ -0,0 +1,23 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserTaskRewards is the golang structure for table user_task_rewards.
type UserTaskRewards struct {
Id int64 `json:"id" orm:"id" description:"用户任务奖励记录唯一标识符"` // 用户任务奖励记录唯一标识符
UserTaskId int64 `json:"userTaskId" orm:"user_task_id" description:"关联用户任务记录ID"` // 关联用户任务记录ID
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
RewardName string `json:"rewardName" orm:"reward_name" description:"奖励名称冗余字段"` // 奖励名称冗余字段
Status int `json:"status" orm:"status" description:"状态1=待完成2=待领取3=已领取4=待兑换5=已完成6=已过期7=发放失败"` // 状态1=待完成2=待领取3=已领取4=待兑换5=已完成6=已过期7=发放失败
Remark string `json:"remark" orm:"remark" description:"备注或失败原因"` // 备注或失败原因
ExternalOrderId string `json:"externalOrderId" orm:"external_order_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:"软删除时间"` // 软删除时间
}

View File

@ -154,6 +154,7 @@ type GetRewardIn struct {
TaskId string TaskId string
PopenId string PopenId string
Source int Source int
BindType int
} }
type GetRewardOut struct { type GetRewardOut struct {
List interface{} `json:"list"` List interface{} `json:"list"`

View File

@ -15,7 +15,7 @@ database:
level: "all" level: "all"
stdout: true stdout: true
default: default:
link: "mysql:root:MSms0427@tcp(localhost:3306)/arenax?loc=Local&charset=utf8mb4" link: "mysql:root:123456@tcp(192.168.3.92:3306)/arenax?loc=Local&charset=utf8mb4"
debug: true debug: true
# Redis configuration. # Redis configuration.