调整任务列表接口记录
This commit is contained in:
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -13,10 +13,9 @@ 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.
|
||||||
@ -50,12 +49,11 @@ 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(handlers ...gdb.ModelHandler) *RewardCallbackDao {
|
func NewRewardCallbackDao() *RewardCallbackDao {
|
||||||
return &RewardCallbackDao{
|
return &RewardCallbackDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "reward_callback",
|
table: "reward_callback",
|
||||||
columns: rewardCallbackColumns,
|
columns: rewardCallbackColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,11 +79,7 @@ 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 {
|
||||||
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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -46,12 +45,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +75,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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -48,12 +47,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +77,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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -76,12 +75,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,11 +105,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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -13,10 +13,9 @@ 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.
|
||||||
@ -40,12 +39,11 @@ 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(handlers ...gdb.ModelHandler) *StoreAreasDao {
|
func NewStoreAreasDao() *StoreAreasDao {
|
||||||
return &StoreAreasDao{
|
return &StoreAreasDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_areas",
|
table: "store_areas",
|
||||||
columns: storeAreasColumns,
|
columns: storeAreasColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,11 +69,7 @@ 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 {
|
||||||
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.
|
||||||
|
|||||||
@ -13,10 +13,9 @@ import (
|
|||||||
|
|
||||||
// StoreClientSessionsDao is the data access object for the table store_client_sessions.
|
// StoreClientSessionsDao is the data access object for the table store_client_sessions.
|
||||||
type StoreClientSessionsDao struct {
|
type StoreClientSessionsDao 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 StoreClientSessionsColumns // columns contains all the column names of Table for convenient usage.
|
columns StoreClientSessionsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreClientSessionsColumns defines and stores column names for the table store_client_sessions.
|
// StoreClientSessionsColumns defines and stores column names for the table store_client_sessions.
|
||||||
@ -58,12 +57,11 @@ var storeClientSessionsColumns = StoreClientSessionsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreClientSessionsDao creates and returns a new DAO object for table data access.
|
// NewStoreClientSessionsDao creates and returns a new DAO object for table data access.
|
||||||
func NewStoreClientSessionsDao(handlers ...gdb.ModelHandler) *StoreClientSessionsDao {
|
func NewStoreClientSessionsDao() *StoreClientSessionsDao {
|
||||||
return &StoreClientSessionsDao{
|
return &StoreClientSessionsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_client_sessions",
|
table: "store_client_sessions",
|
||||||
columns: storeClientSessionsColumns,
|
columns: storeClientSessionsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +87,7 @@ func (dao *StoreClientSessionsDao) 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 *StoreClientSessionsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *StoreClientSessionsDao) 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.
|
||||||
|
|||||||
@ -13,10 +13,9 @@ 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.
|
||||||
@ -44,12 +43,11 @@ 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(handlers ...gdb.ModelHandler) *StoreClientsDao {
|
func NewStoreClientsDao() *StoreClientsDao {
|
||||||
return &StoreClientsDao{
|
return &StoreClientsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_clients",
|
table: "store_clients",
|
||||||
columns: storeClientsColumns,
|
columns: storeClientsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,11 +73,7 @@ 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 {
|
||||||
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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -13,10 +13,9 @@ 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.
|
||||||
@ -48,12 +47,11 @@ 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(handlers ...gdb.ModelHandler) *StoreMemberLevelsDao {
|
func NewStoreMemberLevelsDao() *StoreMemberLevelsDao {
|
||||||
return &StoreMemberLevelsDao{
|
return &StoreMemberLevelsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "store_member_levels",
|
table: "store_member_levels",
|
||||||
columns: storeMemberLevelsColumns,
|
columns: storeMemberLevelsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +77,7 @@ 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 {
|
||||||
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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -46,12 +45,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +75,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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -36,12 +35,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,11 +65,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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -46,12 +45,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +75,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.
|
||||||
|
|||||||
@ -13,10 +13,9 @@ 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.
|
||||||
@ -58,12 +57,11 @@ 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(handlers ...gdb.ModelHandler) *UserTaskRewardsDao {
|
func NewUserTaskRewardsDao() *UserTaskRewardsDao {
|
||||||
return &UserTaskRewardsDao{
|
return &UserTaskRewardsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "user_task_rewards",
|
table: "user_task_rewards",
|
||||||
columns: userTaskRewardsColumns,
|
columns: userTaskRewardsColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +87,7 @@ 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 {
|
||||||
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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -56,12 +55,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,11 +85,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.
|
||||||
|
|||||||
@ -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.
|
||||||
@ -37,6 +36,7 @@ type UsersColumns struct {
|
|||||||
DeletedAt string // 软删除时间
|
DeletedAt string // 软删除时间
|
||||||
RoleId string // 角色ID
|
RoleId string // 角色ID
|
||||||
LastLoginStoreId string // 上次登录门店ID
|
LastLoginStoreId string // 上次登录门店ID
|
||||||
|
XyUserId string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// usersColumns holds the columns for the table users.
|
// usersColumns holds the columns for the table users.
|
||||||
@ -57,15 +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",
|
||||||
|
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(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 +91,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.
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"server/internal/dao"
|
"server/internal/dao"
|
||||||
"server/internal/model"
|
"server/internal/model"
|
||||||
"server/internal/model/do"
|
"server/internal/model/do"
|
||||||
|
"server/internal/model/entity"
|
||||||
"server/internal/service"
|
"server/internal/service"
|
||||||
"server/utility/ecode"
|
"server/utility/ecode"
|
||||||
"server/utility/gamelife"
|
"server/utility/gamelife"
|
||||||
@ -389,7 +390,7 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
|
|
||||||
if err = dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
if err = dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||||
// 创建任务记录
|
// 创建任务记录
|
||||||
_, err = dao.UserTasks.Ctx(ctx).InsertAndGetId(do.UserTasks{
|
id, err := dao.UserTasks.Ctx(ctx).InsertAndGetId(do.UserTasks{
|
||||||
UserId: in.UserId,
|
UserId: in.UserId,
|
||||||
TaskId: in.TaskId,
|
TaskId: in.TaskId,
|
||||||
StoreId: storeId,
|
StoreId: storeId,
|
||||||
@ -404,25 +405,30 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
return ecode.Fail.Sub("创建用户任务记录失败")
|
return ecode.Fail.Sub("创建用户任务记录失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
////查询该任务相关联的奖励, 创建对应奖励下发记录id
|
//查询该任务相关联的奖励, 创建对应奖励下发记录id
|
||||||
//array, err := dao.TaskRewards.Ctx(ctx).LeftJoin(dao.Rewards.Table(), "rewards.id = task_rewards.reward_id").Where(do.TaskRewards{TaskId: in.TaskId}).
|
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()
|
Fields(dao.TaskRewards.Columns().RewardId).All()
|
||||||
//if err != nil {
|
if err != nil {
|
||||||
// return ecode.Fail.Sub("获取任务关联奖励列表失败")
|
return ecode.Fail.Sub("获取任务关联奖励列表失败")
|
||||||
//}
|
}
|
||||||
//for _, v := range array {
|
for _, v := range array {
|
||||||
// _, err = dao.UserTaskRewards.Ctx(ctx).Data(do.UserTaskRewards{
|
var reward entity.Rewards
|
||||||
// UserTaskId: id,
|
if err := dao.Rewards.Ctx(ctx).WherePri(v["reward_id"].Int64()).Scan(&reward); err != nil {
|
||||||
// RewardId: v["reward_id"].Int64(),
|
return ecode.Fail.Sub("获取任务关联奖励列表失败")
|
||||||
// RewardName: v["name"].String(),
|
}
|
||||||
// Status: consts.RewardInitStatus,
|
_, err = dao.UserTaskRewards.Ctx(ctx).Data(do.UserTaskRewards{
|
||||||
// InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
UserTaskId: id,
|
||||||
// IssueQuantity: 1,
|
RewardId: v["reward_id"].Int64(),
|
||||||
// }).Insert()
|
RewardName: reward.Name,
|
||||||
// if err != nil {
|
Status: consts.RewardInitStatus,
|
||||||
// return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
IssueQuantity: reward.GrantQuantity,
|
||||||
// }
|
Source: reward.Source,
|
||||||
//}
|
RewardTypeId: reward.RewardTypeId,
|
||||||
|
}).Insert()
|
||||||
|
if err != nil {
|
||||||
|
return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -465,208 +471,6 @@ func (s *sTask) GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRe
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTaskList PC-WEB获取任务列表
|
|
||||||
//func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out *model.GetTaskListV2Out, err error) {
|
|
||||||
// var tasks []model.Task
|
|
||||||
// var pageIdx string
|
|
||||||
// var data []model.GameTask
|
|
||||||
// if in.IsBound == 0 {
|
|
||||||
// // 未绑定游戏查询自己数据库
|
|
||||||
// err := dao.Tasks.Ctx(ctx).Where(do.Tasks{GameId: in.Gid, NetbarAcconut: in.NetBarAccount}).WithAll().WithAll().Scan(&tasks)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, ecode.Fail.Sub("获取任务列表失败")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for i, v := range tasks {
|
|
||||||
// err := json.Unmarshal([]byte(v.Task), &tasks[i].GameTask)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, ecode.Fail.Sub("解析任务信息失败")
|
|
||||||
// }
|
|
||||||
// tasks[i].Task = ""
|
|
||||||
// for _, i3 := range tasks[i].TaskRewards {
|
|
||||||
// tasks[i].GameTask.Reward = append(tasks[i].GameTask.Reward, i3.Rewards)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for _, prize := range tasks[i].GameTask.PrizeList {
|
|
||||||
// for _, goods := range prize.GoodsList {
|
|
||||||
// if goods.GoodsType != 37 {
|
|
||||||
// tasks[i].GameTask.Reward = append(tasks[i].GameTask.Reward, model.SimpleReward{
|
|
||||||
// Source: 1,
|
|
||||||
// RewardTypeId: int64(goods.GoodsType),
|
|
||||||
// Name: goods.GoodsName,
|
|
||||||
// ImageUrl: goods.GoodsIcon,
|
|
||||||
// TotalLimit: uint64(v.GameTask.LimitNum),
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// data = append(data, tasks[i].GameTask)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return &model.GetTaskListV2Out{
|
|
||||||
// Data: data,
|
|
||||||
// }, nil
|
|
||||||
// } else {
|
|
||||||
// // 已绑定
|
|
||||||
// // 调用外部接口
|
|
||||||
// activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.GetTaskList, PopenId: in.PopenId, BindType: in.BindType, TaskParam: model.TaskParam{Gid: in.Gid, NetBarAccount: in.NetBarAccount, Num: in.Num, Pageidx: in.Pageidx}})
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
// result, ok := activity.(*model.GameTaskResponse)
|
|
||||||
// if !ok {
|
|
||||||
// return nil, ecode.Fail.Sub("数据类型转换失败")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pageIdx = result.PageIdx
|
|
||||||
// // 剔除不需要的任务数据
|
|
||||||
// for i, task := range result.TaskList {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // 组装门店奖励数据
|
|
||||||
// err := dao.TaskRewards.Ctx(ctx).
|
|
||||||
// LeftJoin(dao.Rewards.Table(),
|
|
||||||
// fmt.Sprintf("`%s`.`%s` = `%s`.`%s`",
|
|
||||||
// dao.Rewards.Table(), dao.Rewards.Columns().Id,
|
|
||||||
// dao.TaskRewards.Table(), dao.TaskRewards.Columns().RewardId)).
|
|
||||||
// LeftJoin(dao.RewardTypes.Table(),
|
|
||||||
// fmt.Sprintf("`%s`.`%s` = `%s`.`%s`",
|
|
||||||
// dao.RewardTypes.Table(), dao.RewardTypes.Columns().Id,
|
|
||||||
// dao.Rewards.Table(), dao.Rewards.Columns().RewardTypeId)).
|
|
||||||
// Fields(
|
|
||||||
// fmt.Sprintf("%s.*, `%s`.`%s` AS %s",
|
|
||||||
// dao.Rewards.Table(),
|
|
||||||
// dao.RewardTypes.Table(), dao.RewardTypes.Columns().Name,
|
|
||||||
// "reward_type_name",
|
|
||||||
// ),
|
|
||||||
// ).Where(dao.TaskRewards.Columns().TaskId, task.TaskID).Scan(&result.TaskList[i].Reward)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 尝试转换q 币结构体
|
|
||||||
// //for _, prize := range task.PrizeList {
|
|
||||||
// // for _, goods := range prize.GoodsList {
|
|
||||||
// // if goods.GoodsType != 37 {
|
|
||||||
// // task.Reward = append(task.Reward, model.SimpleReward{
|
|
||||||
// // Source: 1,
|
|
||||||
// // RewardTypeId: int64(goods.GoodsType),
|
|
||||||
// // Name: goods.GoodsName,
|
|
||||||
// // ImageUrl: goods.GoodsIcon,
|
|
||||||
// // TotalLimit: uint64(task.LimitNum),
|
|
||||||
// // })
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// //}
|
|
||||||
//
|
|
||||||
// //任务状态=1或者2不做操作,其他查询门店奖励是否全部领取
|
|
||||||
// if task.Status != 1 && task.Status != 2 {
|
|
||||||
// count, err := dao.UserTasks.Ctx(ctx).Where(dao.UserTasks.Columns().TaskId, task.TaskID).Where(dao.UserTasks.Columns().UserId, in.UserId).LeftJoin(dao.UserTaskRewards.Table(),
|
|
||||||
// fmt.Sprintf("%s.user_task_id = %s.id", dao.UserTaskRewards.Table(), dao.UserTasks.Table())).LeftJoin(dao.Rewards.Table(), fmt.Sprintf("%s.id = %s.reward_id",
|
|
||||||
// dao.Rewards.Table(), dao.UserTaskRewards.Table())).Where("rewards.source", 2).Where(dao.UserTaskRewards.Columns().Status, 2).Count()
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, ecode.Fail.Sub("查询用户门店任务奖励失败")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if count > 0 {
|
|
||||||
// result.TaskList[i].Status = 2
|
|
||||||
// //tasks[i].Status = 2
|
|
||||||
// } else {
|
|
||||||
// result.TaskList[i].Status = 3
|
|
||||||
// //tasks[i].Status = 3
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //else {
|
|
||||||
// // data.Status = task.Status
|
|
||||||
// //}
|
|
||||||
// //tasks = append(tasks, data)
|
|
||||||
//
|
|
||||||
// // 根据用户完成次数和任务指标次数判任务是否完成,修改任务记录状态为 3
|
|
||||||
// if int(task.UserTimes) >= task.TargetTimes {
|
|
||||||
// if err = dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
|
||||||
// orm := dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: task.TaskID})
|
|
||||||
// if task.GameTaskConfig.TimeType == 1 {
|
|
||||||
// // 每日任务
|
|
||||||
// start := gtime.Now().StartOfDay()
|
|
||||||
// end := gtime.Now().EndOfDay()
|
|
||||||
// orm = orm.WhereBetween(dao.UserTasks.Columns().CreatedAt, start, end)
|
|
||||||
// }
|
|
||||||
// value, err := orm.Fields(dao.UserTasks.Columns().Id).Value()
|
|
||||||
// if err != nil {
|
|
||||||
// return ecode.Fail.Sub("获取用户任务失败")
|
|
||||||
// }
|
|
||||||
// if value.IsEmpty() {
|
|
||||||
// glog.Info(ctx, "用户任务不存在")
|
|
||||||
// v, err := dao.Stores.Ctx(ctx).Fields(dao.Stores.Columns().Id).Where(do.Stores{NetbarAccount: in.NetBarAccount}).Value()
|
|
||||||
// if err != nil {
|
|
||||||
// return ecode.Fail.Sub("获取门店信息失败")
|
|
||||||
// }
|
|
||||||
// serialNumber, err := snowid.GetSnowClient().GenerateSerialNumber()
|
|
||||||
// if err != nil {
|
|
||||||
// return ecode.Fail.Sub("生成流水号异常")
|
|
||||||
// }
|
|
||||||
// id, err := dao.UserTasks.Ctx(ctx).InsertAndGetId(do.UserTasks{
|
|
||||||
// UserId: in.UserId,
|
|
||||||
// TaskId: task.TaskID,
|
|
||||||
// StoreId: v.Int64(),
|
|
||||||
// Status: 3,
|
|
||||||
// SerialNumber: serialNumber,
|
|
||||||
// TaskName: task.Title,
|
|
||||||
// GameId: in.Gid,
|
|
||||||
// TaskType: task.GameTaskConfig.TimeType,
|
|
||||||
// })
|
|
||||||
// if err != nil {
|
|
||||||
// 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: task.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.RewardPendingStatus,
|
|
||||||
// InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
|
||||||
// }).Insert()
|
|
||||||
// if err != nil {
|
|
||||||
// return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// glog.Info(ctx, "用户任务存在")
|
|
||||||
// _, err = dao.UserTasks.Ctx(ctx).WherePri(value.Int64()).Where(dao.UserTasks.Columns().Status).WhereNot(dao.UserTasks.Columns().Status, 2).Update(do.UserTasks{
|
|
||||||
// Status: 3,
|
|
||||||
// })
|
|
||||||
// if err != nil {
|
|
||||||
// return ecode.Fail.Sub("修改用户任务状态失败")
|
|
||||||
// }
|
|
||||||
// _, err = dao.UserTaskRewards.Ctx(ctx).Where(do.UserTaskRewards{UserTaskId: value.Int()}).Where(dao.UserTaskRewards.Columns().Status, 1).Update(do.UserTaskRewards{
|
|
||||||
// Status: 2,
|
|
||||||
// })
|
|
||||||
// if err != nil {
|
|
||||||
// return ecode.Fail.Sub("修改用户任务奖励状态失败")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return nil
|
|
||||||
// }); err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// data = result.TaskList
|
|
||||||
// return &model.GetTaskListV2Out{
|
|
||||||
// Data: data,
|
|
||||||
// PageIdx: pageIdx,
|
|
||||||
// }, nil
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out *model.GetTaskListV2Out, err error) {
|
func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out *model.GetTaskListV2Out, err error) {
|
||||||
out = &model.GetTaskListV2Out{}
|
out = &model.GetTaskListV2Out{}
|
||||||
if in.IsBound == 1 {
|
if in.IsBound == 1 {
|
||||||
@ -693,19 +497,21 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
end := gtime.Now().EndOfDay()
|
end := gtime.Now().EndOfDay()
|
||||||
orm = orm.WhereBetween(dao.UserTasks.Columns().CreatedAt, start, end)
|
orm = orm.WhereBetween(dao.UserTasks.Columns().CreatedAt, start, end)
|
||||||
}
|
}
|
||||||
one, err := orm.Fields(dao.UserTasks.Columns().Id, dao.UserTasks.Columns().UserTimes).One()
|
one, err := orm.Fields(dao.UserTasks.Columns().Id, dao.UserTasks.Columns().Status, dao.UserTasks.Columns().UserTimes).One()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("获取用户任务失败")
|
return nil, ecode.Fail.Sub("获取用户任务失败")
|
||||||
}
|
}
|
||||||
if one.IsEmpty() || one["id"].IsEmpty() {
|
if one.IsEmpty() || one["id"].IsEmpty() {
|
||||||
|
// 不存在用户任务记录,强制用户完成任务
|
||||||
result.TaskList[i].Status = 1
|
result.TaskList[i].Status = 1
|
||||||
} else {
|
} else {
|
||||||
if v.Status == 2 {
|
// 存在用户记录,自行判断用户是否完成任务
|
||||||
if v.UserTimes-one["user_times"].Int64() >= v.TargetTimes {
|
if v.UserTimes-one["user_times"].Int64() >= v.TargetTimes {
|
||||||
completeTime := gtime.Now()
|
completeTime := gtime.Now()
|
||||||
// 判断是否完成任务,修改奖励下发记录状态为 2
|
userTaskStatus := one["status"].Int64()
|
||||||
|
if userTaskStatus == 1 {
|
||||||
if err := dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
if err := dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||||
if _, err := dao.UserTasks.Ctx(ctx).WherePri(one["id"].Int64()).Where(do.UserTasks{Status: 1}).Data(do.UserTasks{Status: 3, UserTimes: v.UserTimes}).Update(); err != nil {
|
if _, err := dao.UserTasks.Ctx(ctx).WherePri(one["id"].Int64()).Where(do.UserTasks{Status: 1}).Data(do.UserTasks{Status: 3}).Update(); err != nil {
|
||||||
return ecode.Fail.Sub("修改用户任务状态失败")
|
return ecode.Fail.Sub("修改用户任务状态失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +533,7 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
return ecode.Fail.Sub("获取用户任务奖励失败")
|
return ecode.Fail.Sub("获取用户任务奖励失败")
|
||||||
}
|
}
|
||||||
if rewardTypeCode.String() == consts.NetfeeCode {
|
if rewardTypeCode.String() == consts.NetfeeCode {
|
||||||
if quantity, err := CalculateNetfeeRewardQuantity(ctx, in.UserId, in.StoreId, record["reward_id"].Int64(), completeTime); err == nil && quantity != 0 {
|
if quantity, err := CalculateNetfeeRewardQuantity(ctx, in.UserId, in.NetBarAccount, record["reward_id"].Int64(), completeTime); err == nil && quantity > 0 {
|
||||||
updateData.IssueQuantity = quantity
|
updateData.IssueQuantity = quantity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,22 +546,16 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result.TaskList[i].Status = 2
|
result.TaskList[i].Status = 2
|
||||||
} else {
|
} else if userTaskStatus == 3 {
|
||||||
result.TaskList[i].Status = 1
|
|
||||||
}
|
|
||||||
result.TaskList[i].UserTimes -= one["user_times"].Int64()
|
|
||||||
} else if v.Status == 3 {
|
|
||||||
// 查询该用户任务记录奖励都已发放
|
|
||||||
count, err := dao.UserTaskRewards.Ctx(ctx).Where(do.UserTaskRewards{UserTaskId: one["id"].Int64()}).Where(dao.UserTaskRewards.Columns().Status, []int{2, 3, 5}).Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, ecode.Fail.Sub("查询用户门店任务奖励失败")
|
|
||||||
}
|
|
||||||
|
|
||||||
if count > 0 {
|
|
||||||
result.TaskList[i].Status = 2
|
result.TaskList[i].Status = 2
|
||||||
|
} else {
|
||||||
|
result.TaskList[i].Status = 3
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
result.TaskList[i].UserTimes -= one["user_times"].Int64()
|
||||||
|
result.TaskList[i].Status = 1
|
||||||
}
|
}
|
||||||
|
result.TaskList[i].UserTaskId = one["id"].Int64()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out.PageIdx = result.PageIdx
|
out.PageIdx = result.PageIdx
|
||||||
@ -783,27 +583,9 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 遍历任务列表数据,进行处理
|
|
||||||
// 根据门店查询出当前门店追加的奖励
|
|
||||||
for i, v := range out.Data {
|
|
||||||
for _, prize := range v.PrizeList {
|
|
||||||
for _, goods := range prize.GoodsList {
|
|
||||||
if in.IsBound == 1 && goods.GoodsType == 37 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
out.Data[i].Rewards = append(out.Data[i].Rewards, model.SimpleReward{
|
|
||||||
Source: 1,
|
|
||||||
RewardTypeId: int64(goods.GoodsType),
|
|
||||||
Name: goods.GoodsName,
|
|
||||||
ImageUrl: goods.GoodsIcon,
|
|
||||||
GrantQuantity: uint64(goods.Num),
|
|
||||||
TotalLimit: uint64(v.LimitNum),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sTask) SyncTaskFromGamelife(ctx context.Context) (out *model.SyncTaskOut, err error) {
|
func (s *sTask) SyncTaskFromGamelife(ctx context.Context) (out *model.SyncTaskOut, err error) {
|
||||||
stores, err := dao.Stores.Ctx(ctx).Fields(dao.Stores.Columns().Id, dao.Stores.Columns().NetbarAccount).All()
|
stores, err := dao.Stores.Ctx(ctx).Fields(dao.Stores.Columns().Id, dao.Stores.Columns().NetbarAccount).All()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -920,7 +702,7 @@ func (s *sTask) SyncTaskFromGamelife(ctx context.Context) (out *model.SyncTaskOu
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func CalculateNetfeeRewardQuantity(ctx context.Context, userId int64, storeId, rewardId int64, completedTime *gtime.Time) (uint64, error) {
|
func CalculateNetfeeRewardQuantity(ctx context.Context, userId int64, netbarAccount string, rewardId int64, completedTime *gtime.Time) (uint64, error) {
|
||||||
|
|
||||||
// 获取当前小时 & 星期几(0=周日)
|
// 获取当前小时 & 星期几(0=周日)
|
||||||
hour := completedTime.Hour()
|
hour := completedTime.Hour()
|
||||||
@ -961,7 +743,13 @@ func CalculateNetfeeRewardQuantity(ctx context.Context, userId int64, storeId, r
|
|||||||
if areaId.IsEmpty() {
|
if areaId.IsEmpty() {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
storeId, err := dao.Stores.Ctx(ctx).Where(do.Stores{NetbarAccount: netbarAccount}).Fields("id").Value()
|
||||||
|
if err != nil {
|
||||||
|
return 0, ecode.Fail.Sub("获取门店失败")
|
||||||
|
}
|
||||||
|
if storeId.IsEmpty() {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
// 获取门店该区域、等级、奖励配置
|
// 获取门店该区域、等级、奖励配置
|
||||||
priceDataStr, err := dao.StoreNetfeeAreaLevel.Ctx(ctx).
|
priceDataStr, err := dao.StoreNetfeeAreaLevel.Ctx(ctx).
|
||||||
Where(do.StoreNetfeeAreaLevel{
|
Where(do.StoreNetfeeAreaLevel{
|
||||||
|
|||||||
@ -369,7 +369,7 @@ func (s *sUser) Quan8Autologin(ctx context.Context, in *model.Quan8AutologinIn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if user exists by Quan8 UUID
|
// Check if user exists by Quan8 UUID
|
||||||
exist, err := dao.Users.Ctx(ctx).Where(do.Users{Quan8Uuid: in.UUID}).Exist()
|
exist, err := dao.Users.Ctx(ctx).Where(do.Users{XyUserId: in.UUID}).Exist()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("查找用户失败")
|
return nil, ecode.Fail.Sub("查找用户失败")
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ func (s *sUser) Quan8Autologin(ctx context.Context, in *model.Quan8AutologinIn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
user := &entity.Users{
|
user := &entity.Users{
|
||||||
Quan8Uuid: in.UUID,
|
XyUserId: in.UUID,
|
||||||
Username: username,
|
Username: username,
|
||||||
Nickname: username,
|
Nickname: username,
|
||||||
PasswordHash: password,
|
PasswordHash: password,
|
||||||
@ -414,7 +414,7 @@ func (s *sUser) Quan8Autologin(ctx context.Context, in *model.Quan8AutologinIn)
|
|||||||
return nil, ecode.Fail.Sub("创建用户失败")
|
return nil, ecode.Fail.Sub("创建用户失败")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value, err := dao.Users.Ctx(ctx).Where(do.Users{Quan8Uuid: in.UUID}).Fields(dao.Users.Columns().Id).Value()
|
value, err := dao.Users.Ctx(ctx).Where(do.Users{XyUserId: in.UUID}).Fields(dao.Users.Columns().Id).Value()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("查找用户失败")
|
return nil, ecode.Fail.Sub("查找用户失败")
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ func (s *sUser) GenerateSceneId(ctx context.Context, in *model.GenerateSceneIdIn
|
|||||||
|
|
||||||
// Check if user exists by UUID if provided
|
// Check if user exists by UUID if provided
|
||||||
if in.UUId != "" {
|
if in.UUId != "" {
|
||||||
exist, err := dao.Users.Ctx(ctx).Where(do.Users{Quan8Uuid: in.UUId}).Exist()
|
exist, err := dao.Users.Ctx(ctx).Where(do.Users{XyUserId: in.UUId}).Exist()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("查找用户失败")
|
return nil, ecode.Fail.Sub("查找用户失败")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,4 +28,5 @@ type Users struct {
|
|||||||
DeletedAt *gtime.Time // 软删除时间
|
DeletedAt *gtime.Time // 软删除时间
|
||||||
RoleId interface{} // 角色ID
|
RoleId interface{} // 角色ID
|
||||||
LastLoginStoreId interface{} // 上次登录门店ID
|
LastLoginStoreId interface{} // 上次登录门店ID
|
||||||
|
XyUserId interface{} //
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,4 +26,5 @@ 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
|
||||||
|
XyUserId string `json:"xyUserId" orm:"xy_user_id" description:""` //
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,8 @@ database:
|
|||||||
level: "all"
|
level: "all"
|
||||||
stdout: true
|
stdout: true
|
||||||
default:
|
default:
|
||||||
link: "mysql:root:123456@tcp(192.168.3.92:3306)/arenax?loc=Local&charset=utf8mb4"
|
# link: "mysql:root:123456@tcp(192.168.3.92:3306)/arenax?loc=Local&charset=utf8mb4"
|
||||||
|
link: "mysql:root:MSms0427@tcp(127.0.0.1:3306)/arenax?loc=Local&charset=utf8mb4"
|
||||||
debug: true
|
debug: true
|
||||||
|
|
||||||
# Redis configuration.
|
# Redis configuration.
|
||||||
|
|||||||
Reference in New Issue
Block a user