修改PC任务领取
This commit is contained in:
@ -13,9 +13,10 @@ 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.
|
||||||
@ -49,11 +50,12 @@ 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() *AdminsDao {
|
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
|
||||||
return &AdminsDao{
|
return &AdminsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "admins",
|
table: "admins",
|
||||||
columns: adminsColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -51,11 +52,12 @@ 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() *FeedbacksDao {
|
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
|
||||||
return &FeedbacksDao{
|
return &FeedbacksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "feedbacks",
|
table: "feedbacks",
|
||||||
columns: feedbacksColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -45,11 +46,12 @@ 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() *GamesDao {
|
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
|
||||||
return &GamesDao{
|
return &GamesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "games",
|
table: "games",
|
||||||
columns: gamesColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -57,11 +58,12 @@ 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() *MerchantAdminsDao {
|
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
|
||||||
return &MerchantAdminsDao{
|
return &MerchantAdminsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "merchant_admins",
|
table: "merchant_admins",
|
||||||
columns: merchantAdminsColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -71,11 +72,12 @@ 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() *MerchantsDao {
|
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
|
||||||
return &MerchantsDao{
|
return &MerchantsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "merchants",
|
table: "merchants",
|
||||||
columns: merchantsColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -49,11 +50,12 @@ 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() *NoticesDao {
|
func NewNoticesDao(handlers ...gdb.ModelHandler) *NoticesDao {
|
||||||
return &NoticesDao{
|
return &NoticesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "notices",
|
table: "notices",
|
||||||
columns: noticesColumns,
|
columns: noticesColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +81,11 @@ 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ import (
|
|||||||
|
|
||||||
// RewardCallbackDao is the data access object for the table reward_callback.
|
// RewardCallbackDao is the data access object for the table reward_callback.
|
||||||
type RewardCallbackDao struct {
|
type RewardCallbackDao 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 RewardCallbackColumns // columns contains all the column names of Table for convenient usage.
|
columns RewardCallbackColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// RewardCallbackColumns defines and stores column names for the table reward_callback.
|
// RewardCallbackColumns defines and stores column names for the table reward_callback.
|
||||||
@ -49,11 +50,12 @@ var rewardCallbackColumns = RewardCallbackColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRewardCallbackDao creates and returns a new DAO object for table data access.
|
// NewRewardCallbackDao creates and returns a new DAO object for table data access.
|
||||||
func NewRewardCallbackDao() *RewardCallbackDao {
|
func NewRewardCallbackDao(handlers ...gdb.ModelHandler) *RewardCallbackDao {
|
||||||
return &RewardCallbackDao{
|
return &RewardCallbackDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "reward_callback",
|
table: "reward_callback",
|
||||||
columns: rewardCallbackColumns,
|
columns: rewardCallbackColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +81,11 @@ func (dao *RewardCallbackDao) 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 *RewardCallbackDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *RewardCallbackDao) 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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -45,11 +46,12 @@ 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() *RewardTypesDao {
|
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
|
||||||
return &RewardTypesDao{
|
return &RewardTypesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "reward_types",
|
table: "reward_types",
|
||||||
columns: rewardTypesColumns,
|
columns: rewardTypesColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +77,11 @@ func (dao *RewardTypesDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -47,11 +48,12 @@ 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() *RewardWatersDao {
|
func NewRewardWatersDao(handlers ...gdb.ModelHandler) *RewardWatersDao {
|
||||||
return &RewardWatersDao{
|
return &RewardWatersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "reward_waters",
|
table: "reward_waters",
|
||||||
columns: rewardWatersColumns,
|
columns: rewardWatersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +79,11 @@ 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -75,11 +76,12 @@ 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() *RewardsDao {
|
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
|
||||||
return &RewardsDao{
|
return &RewardsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "rewards",
|
table: "rewards",
|
||||||
columns: rewardsColumns,
|
columns: rewardsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +107,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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -47,11 +48,12 @@ 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() *RolesDao {
|
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
|
||||||
return &RolesDao{
|
return &RolesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "roles",
|
table: "roles",
|
||||||
columns: rolesColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -57,11 +58,12 @@ 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() *StoreAdminsDao {
|
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
|
||||||
return &StoreAdminsDao{
|
return &StoreAdminsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_admins",
|
table: "store_admins",
|
||||||
columns: storeAdminsColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ import (
|
|||||||
|
|
||||||
// StoreAreasDao is the data access object for the table store_areas.
|
// StoreAreasDao is the data access object for the table store_areas.
|
||||||
type StoreAreasDao struct {
|
type StoreAreasDao 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 StoreAreasColumns // columns contains all the column names of Table for convenient usage.
|
columns StoreAreasColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreAreasColumns defines and stores column names for the table store_areas.
|
// StoreAreasColumns defines and stores column names for the table store_areas.
|
||||||
@ -39,11 +40,12 @@ var storeAreasColumns = StoreAreasColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreAreasDao creates and returns a new DAO object for table data access.
|
// NewStoreAreasDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreAreasDao() *StoreAreasDao {
|
func NewStoreAreasDao(handlers ...gdb.ModelHandler) *StoreAreasDao {
|
||||||
return &StoreAreasDao{
|
return &StoreAreasDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_areas",
|
table: "store_areas",
|
||||||
columns: storeAreasColumns,
|
columns: storeAreasColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +71,11 @@ func (dao *StoreAreasDao) 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 *StoreAreasDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *StoreAreasDao) 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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ import (
|
|||||||
|
|
||||||
// StoreClientsDao is the data access object for the table store_clients.
|
// StoreClientsDao is the data access object for the table store_clients.
|
||||||
type StoreClientsDao struct {
|
type StoreClientsDao 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 StoreClientsColumns // columns contains all the column names of Table for convenient usage.
|
columns StoreClientsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreClientsColumns defines and stores column names for the table store_clients.
|
// StoreClientsColumns defines and stores column names for the table store_clients.
|
||||||
@ -43,11 +44,12 @@ var storeClientsColumns = StoreClientsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreClientsDao creates and returns a new DAO object for table data access.
|
// NewStoreClientsDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreClientsDao() *StoreClientsDao {
|
func NewStoreClientsDao(handlers ...gdb.ModelHandler) *StoreClientsDao {
|
||||||
return &StoreClientsDao{
|
return &StoreClientsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_clients",
|
table: "store_clients",
|
||||||
columns: storeClientsColumns,
|
columns: storeClientsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +75,11 @@ func (dao *StoreClientsDao) 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 *StoreClientsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *StoreClientsDao) 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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -33,11 +34,12 @@ 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() *StoreDesktopSettingsDao {
|
func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao {
|
||||||
return &StoreDesktopSettingsDao{
|
return &StoreDesktopSettingsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_desktop_settings",
|
table: "store_desktop_settings",
|
||||||
columns: storeDesktopSettingsColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -41,11 +42,12 @@ 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() *StoreIpsDao {
|
func NewStoreIpsDao(handlers ...gdb.ModelHandler) *StoreIpsDao {
|
||||||
return &StoreIpsDao{
|
return &StoreIpsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_ips",
|
table: "store_ips",
|
||||||
columns: storeIpsColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ import (
|
|||||||
|
|
||||||
// StoreMemberLevelsDao is the data access object for the table store_member_levels.
|
// StoreMemberLevelsDao is the data access object for the table store_member_levels.
|
||||||
type StoreMemberLevelsDao struct {
|
type StoreMemberLevelsDao 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 StoreMemberLevelsColumns // columns contains all the column names of Table for convenient usage.
|
columns StoreMemberLevelsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreMemberLevelsColumns defines and stores column names for the table store_member_levels.
|
// StoreMemberLevelsColumns defines and stores column names for the table store_member_levels.
|
||||||
@ -47,11 +48,12 @@ var storeMemberLevelsColumns = StoreMemberLevelsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreMemberLevelsDao creates and returns a new DAO object for table data access.
|
// NewStoreMemberLevelsDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreMemberLevelsDao() *StoreMemberLevelsDao {
|
func NewStoreMemberLevelsDao(handlers ...gdb.ModelHandler) *StoreMemberLevelsDao {
|
||||||
return &StoreMemberLevelsDao{
|
return &StoreMemberLevelsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_member_levels",
|
table: "store_member_levels",
|
||||||
columns: storeMemberLevelsColumns,
|
columns: storeMemberLevelsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +79,11 @@ func (dao *StoreMemberLevelsDao) 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 *StoreMemberLevelsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *StoreMemberLevelsDao) 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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -45,11 +46,12 @@ 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() *StoreNetfeeAreaLevelDao {
|
func NewStoreNetfeeAreaLevelDao(handlers ...gdb.ModelHandler) *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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +77,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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -39,11 +40,12 @@ 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() *StoreRolesDao {
|
func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao {
|
||||||
return &StoreRolesDao{
|
return &StoreRolesDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_roles",
|
table: "store_roles",
|
||||||
columns: storeRolesColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -51,11 +52,12 @@ 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() *StoresDao {
|
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
|
||||||
return &StoresDao{
|
return &StoresDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "stores",
|
table: "stores",
|
||||||
columns: storesColumns,
|
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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -35,11 +36,12 @@ 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() *TaskRewardsDao {
|
func NewTaskRewardsDao(handlers ...gdb.ModelHandler) *TaskRewardsDao {
|
||||||
return &TaskRewardsDao{
|
return &TaskRewardsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "task_rewards",
|
table: "task_rewards",
|
||||||
columns: taskRewardsColumns,
|
columns: taskRewardsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +67,11 @@ 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -45,11 +46,12 @@ 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() *TasksDao {
|
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
|
||||||
return &TasksDao{
|
return &TasksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "tasks",
|
table: "tasks",
|
||||||
columns: tasksColumns,
|
columns: tasksColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +77,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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ import (
|
|||||||
|
|
||||||
// UserTaskRewardsDao is the data access object for the table user_task_rewards.
|
// UserTaskRewardsDao is the data access object for the table user_task_rewards.
|
||||||
type UserTaskRewardsDao struct {
|
type UserTaskRewardsDao 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 UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
columns UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserTaskRewardsColumns defines and stores column names for the table user_task_rewards.
|
// UserTaskRewardsColumns defines and stores column names for the table user_task_rewards.
|
||||||
@ -57,11 +58,12 @@ var userTaskRewardsColumns = UserTaskRewardsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewUserTaskRewardsDao creates and returns a new DAO object for table data access.
|
// NewUserTaskRewardsDao creates and returns a new DAO object for table data access.
|
||||||
func NewUserTaskRewardsDao() *UserTaskRewardsDao {
|
func NewUserTaskRewardsDao(handlers ...gdb.ModelHandler) *UserTaskRewardsDao {
|
||||||
return &UserTaskRewardsDao{
|
return &UserTaskRewardsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "user_task_rewards",
|
table: "user_task_rewards",
|
||||||
columns: userTaskRewardsColumns,
|
columns: userTaskRewardsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +89,11 @@ func (dao *UserTaskRewardsDao) 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 *UserTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *UserTaskRewardsDao) 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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -33,6 +34,7 @@ type UserTasksColumns struct {
|
|||||||
TaskName string // 任务名称
|
TaskName string // 任务名称
|
||||||
GameId string // 游戏 id
|
GameId string // 游戏 id
|
||||||
TaskType string // 1: 每日任务 3: 周期任务
|
TaskType string // 1: 每日任务 3: 周期任务
|
||||||
|
UserTimes string // 用户完成次数
|
||||||
}
|
}
|
||||||
|
|
||||||
// userTasksColumns holds the columns for the table user_tasks.
|
// userTasksColumns holds the columns for the table user_tasks.
|
||||||
@ -50,14 +52,16 @@ var userTasksColumns = UserTasksColumns{
|
|||||||
TaskName: "task_name",
|
TaskName: "task_name",
|
||||||
GameId: "game_id",
|
GameId: "game_id",
|
||||||
TaskType: "task_type",
|
TaskType: "task_type",
|
||||||
|
UserTimes: "user_times",
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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() *UserTasksDao {
|
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
|
||||||
return &UserTasksDao{
|
return &UserTasksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "user_tasks",
|
table: "user_tasks",
|
||||||
columns: userTasksColumns,
|
columns: userTasksColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +87,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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -13,9 +13,10 @@ 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.
|
||||||
@ -36,8 +37,6 @@ type UsersColumns struct {
|
|||||||
DeletedAt string // 软删除时间
|
DeletedAt string // 软删除时间
|
||||||
RoleId string // 角色ID
|
RoleId string // 角色ID
|
||||||
LastLoginStoreId string // 上次登录门店ID
|
LastLoginStoreId string // 上次登录门店ID
|
||||||
Quan8Uuid string // 8圈使用的 uuid
|
|
||||||
XyUserId string // 系统唯一用户ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// usersColumns holds the columns for the table users.
|
// usersColumns holds the columns for the table users.
|
||||||
@ -58,16 +57,15 @@ var usersColumns = UsersColumns{
|
|||||||
DeletedAt: "deleted_at",
|
DeletedAt: "deleted_at",
|
||||||
RoleId: "role_id",
|
RoleId: "role_id",
|
||||||
LastLoginStoreId: "last_login_store_id",
|
LastLoginStoreId: "last_login_store_id",
|
||||||
Quan8Uuid: "quan8_uuid",
|
|
||||||
XyUserId: "xy_user_id",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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() *UsersDao {
|
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
|
||||||
return &UsersDao{
|
return &UsersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "users",
|
table: "users",
|
||||||
columns: usersColumns,
|
columns: usersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,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.
|
// 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 {
|
||||||
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.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/gogf/gf/v2/os/glog"
|
"github.com/gogf/gf/v2/os/glog"
|
||||||
"github.com/gogf/gf/v2/os/gtime"
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
"github.com/gogf/gf/v2/util/gconv"
|
"github.com/gogf/gf/v2/util/gconv"
|
||||||
"github.com/gogf/gf/v2/util/guid"
|
|
||||||
"server/internal/consts"
|
"server/internal/consts"
|
||||||
"server/internal/dao"
|
"server/internal/dao"
|
||||||
"server/internal/model"
|
"server/internal/model"
|
||||||
@ -343,7 +342,7 @@ func (s *sTask) GetSelectorList(ctx context.Context, in *model.SelectorIn) (out
|
|||||||
return &data, nil
|
return &data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTask 完成任务
|
// GetTask 领取任务
|
||||||
func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.GetTaskOut, err error) {
|
func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.GetTaskOut, err error) {
|
||||||
var storeId int
|
var storeId int
|
||||||
if in.StoreId > 0 {
|
if in.StoreId > 0 {
|
||||||
@ -377,53 +376,56 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
return nil, ecode.Fail.Sub("查询用户该任务记录失败")
|
return nil, ecode.Fail.Sub("查询用户该任务记录失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
if userTask != nil {
|
//if userTask != nil {
|
||||||
return nil, ecode.Fail.Sub("该任务记录已存在")
|
// return nil, ecode.Fail.Sub("该任务记录已存在")
|
||||||
}
|
//}
|
||||||
|
|
||||||
// TODO 流水号未知
|
if userTask == nil {
|
||||||
serialNumber, err := snowid.GetSnowClient().GenerateSerialNumber()
|
// TODO 流水号未知
|
||||||
if err != nil {
|
serialNumber, err := snowid.GetSnowClient().GenerateSerialNumber()
|
||||||
return nil, ecode.Fail.Sub("生成流水号异常")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
|
||||||
// 创建任务记录
|
|
||||||
id, err := dao.UserTasks.Ctx(ctx).InsertAndGetId(do.UserTasks{
|
|
||||||
UserId: in.UserId,
|
|
||||||
TaskId: in.TaskId,
|
|
||||||
StoreId: storeId,
|
|
||||||
Status: 1,
|
|
||||||
SerialNumber: serialNumber,
|
|
||||||
TaskName: in.TaskName,
|
|
||||||
GameId: in.GameId,
|
|
||||||
TaskType: in.TaskType,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ecode.Fail.Sub("创建用户任务记录失败")
|
return nil, ecode.Fail.Sub("生成流水号异常")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询该任务相关联的奖励, 创建对应奖励下发记录id
|
if err = dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||||
array, err := dao.TaskRewards.Ctx(ctx).LeftJoin(dao.Rewards.Table(), "rewards.id = task_rewards.reward_id").Where(do.TaskRewards{TaskId: in.TaskId}).Fields(dao.TaskRewards.Columns().RewardId).Fields(dao.Rewards.Columns().Name).All()
|
// 创建任务记录
|
||||||
if err != nil {
|
_, err = dao.UserTasks.Ctx(ctx).InsertAndGetId(do.UserTasks{
|
||||||
return ecode.Fail.Sub("获取任务关联奖励列表失败")
|
UserId: in.UserId,
|
||||||
}
|
TaskId: in.TaskId,
|
||||||
for _, v := range array {
|
StoreId: storeId,
|
||||||
_, err = dao.UserTaskRewards.Ctx(ctx).Data(do.UserTaskRewards{
|
Status: 1,
|
||||||
UserTaskId: id,
|
SerialNumber: serialNumber,
|
||||||
RewardId: v["reward_id"].Int64(),
|
TaskName: in.TaskName,
|
||||||
RewardName: v["name"].String(),
|
GameId: in.GameId,
|
||||||
Status: consts.RewardInitStatus,
|
TaskType: in.TaskType,
|
||||||
InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
})
|
||||||
}).Insert()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
return ecode.Fail.Sub("创建用户任务记录失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询该任务相关联的奖励, 创建对应奖励下发记录id
|
||||||
|
//array, err := dao.TaskRewards.Ctx(ctx).LeftJoin(dao.Rewards.Table(), "rewards.id = task_rewards.reward_id").Where(do.TaskRewards{TaskId: in.TaskId}).Fields(dao.TaskRewards.Columns().RewardId).Fields(dao.Rewards.Columns().Name).All()
|
||||||
|
//if err != nil {
|
||||||
|
// return ecode.Fail.Sub("获取任务关联奖励列表失败")
|
||||||
|
//}
|
||||||
|
//for _, v := range array {
|
||||||
|
// _, err = dao.UserTaskRewards.Ctx(ctx).Data(do.UserTaskRewards{
|
||||||
|
// UserTaskId: id,
|
||||||
|
// RewardId: v["reward_id"].Int64(),
|
||||||
|
// RewardName: v["name"].String(),
|
||||||
|
// Status: consts.RewardInitStatus,
|
||||||
|
// InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
||||||
|
// }).Insert()
|
||||||
|
// if err != nil {
|
||||||
|
// return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
return
|
||||||
|
}); err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &model.GetTaskOut{
|
return &model.GetTaskOut{
|
||||||
Success: true,
|
Success: true,
|
||||||
}, nil
|
}, nil
|
||||||
@ -682,7 +684,7 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
return nil, ecode.Fail.Sub("获取任务奖励列表失败")
|
return nil, ecode.Fail.Sub("获取任务奖励列表失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
if int(v.UserTimes) >= v.TargetTimes {
|
if int(v.UserTimes) >= v.TargetTimes && v.Status == 1 {
|
||||||
completedTime := gtime.Now()
|
completedTime := gtime.Now()
|
||||||
// 判断当前用户完成情况,已完成根据任务、用户,任务类型检查是否存在用户任务记录
|
// 判断当前用户完成情况,已完成根据任务、用户,任务类型检查是否存在用户任务记录
|
||||||
orm := dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: v.TaskID})
|
orm := dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: v.TaskID})
|
||||||
|
|||||||
@ -25,4 +25,5 @@ type UserTasks struct {
|
|||||||
TaskName interface{} // 任务名称
|
TaskName interface{} // 任务名称
|
||||||
GameId interface{} // 游戏 id
|
GameId interface{} // 游戏 id
|
||||||
TaskType interface{} // 1: 每日任务 3: 周期任务
|
TaskType interface{} // 1: 每日任务 3: 周期任务
|
||||||
|
UserTimes interface{} // 用户完成次数
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,4 @@ type Users struct {
|
|||||||
DeletedAt *gtime.Time // 软删除时间
|
DeletedAt *gtime.Time // 软删除时间
|
||||||
RoleId interface{} // 角色ID
|
RoleId interface{} // 角色ID
|
||||||
LastLoginStoreId interface{} // 上次登录门店ID
|
LastLoginStoreId interface{} // 上次登录门店ID
|
||||||
Quan8Uuid interface{} // 8圈使用的 uuid
|
|
||||||
XyUserId interface{} // 系统唯一用户ID
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,4 +23,5 @@ type UserTasks struct {
|
|||||||
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
|
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
|
||||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
||||||
TaskType int64 `json:"taskType" orm:"task_type" description:"1: 每日任务 3: 周期任务"` // 1: 每日任务 3: 周期任务
|
TaskType int64 `json:"taskType" orm:"task_type" description:"1: 每日任务 3: 周期任务"` // 1: 每日任务 3: 周期任务
|
||||||
|
UserTimes int64 `json:"userTimes" orm:"user_times" description:"用户完成次数"` // 用户完成次数
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,4 @@ type Users struct {
|
|||||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||||
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
|
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
|
||||||
LastLoginStoreId int64 `json:"lastLoginStoreId" orm:"last_login_store_id" description:"上次登录门店ID"` // 上次登录门店ID
|
LastLoginStoreId int64 `json:"lastLoginStoreId" orm:"last_login_store_id" description:"上次登录门店ID"` // 上次登录门店ID
|
||||||
Quan8Uuid string `json:"quan8Uuid" orm:"quan8_uuid" description:"8圈使用的 uuid"` // 8圈使用的 uuid
|
|
||||||
XyUserId string `json:"xyUserId" orm:"xy_user_id" description:"系统唯一用户ID"` // 系统唯一用户ID
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,6 +62,7 @@ type UserTaskRecord struct {
|
|||||||
CompletedAt *gtime.Time `json:"completedAt" orm:"completed_at" description:"任务完成时间"` // 任务完成时间
|
CompletedAt *gtime.Time `json:"completedAt" orm:"completed_at" description:"任务完成时间"` // 任务完成时间
|
||||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||||
// Store Store `json:"store" orm:"with:id=store_id"`
|
// Store Store `json:"store" orm:"with:id=store_id"`
|
||||||
|
UserTimes int64 `json:"userTimes" orm:"user_times" description:"用户完成次数"` // 用户完成次数
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserInfo struct {
|
type UserInfo struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user