缓存用户绑定请求参数、提供任务列表使用
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.
|
||||||
@ -44,12 +43,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,11 +73,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 (
|
|||||||
|
|
||||||
// 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 (
|
|||||||
|
|
||||||
// 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.
|
||||||
@ -56,12 +55,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,11 +85,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,49 +13,49 @@ 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.
|
||||||
type StoresColumns struct {
|
type StoresColumns struct {
|
||||||
Id string // 门店ID
|
Id string // 门店ID
|
||||||
MerchantId string // 所属商户ID
|
MerchantId string // 所属商户ID
|
||||||
Name string // 门店名称
|
Name string // 门店名称
|
||||||
StoreCode string // 门店编号
|
StoreCode string // 门店编号
|
||||||
Address string // 门店地址
|
Address string // 门店地址
|
||||||
ContactName string // 联系人姓名
|
ContactName string // 联系人姓名
|
||||||
ContactPhone string // 联系人电话
|
ContactPhone string // 联系人电话
|
||||||
Status string // 状态:1=正常营业,2=暂停营业
|
NetbarAccount string // QQ 当吧网关账号
|
||||||
CreatedAt string // 创建时间
|
Status string // 状态:1=正常营业,2=暂停营业
|
||||||
UpdatedAt string // 更新时间
|
CreatedAt string // 创建时间
|
||||||
DeletedAt string // 软删除时间戳
|
UpdatedAt string // 更新时间
|
||||||
|
DeletedAt string // 软删除时间戳
|
||||||
}
|
}
|
||||||
|
|
||||||
// storesColumns holds the columns for the table stores.
|
// storesColumns holds the columns for the table stores.
|
||||||
var storesColumns = StoresColumns{
|
var storesColumns = StoresColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
MerchantId: "merchant_id",
|
MerchantId: "merchant_id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
StoreCode: "store_code",
|
StoreCode: "store_code",
|
||||||
Address: "address",
|
Address: "address",
|
||||||
ContactName: "contact_name",
|
ContactName: "contact_name",
|
||||||
ContactPhone: "contact_phone",
|
ContactPhone: "contact_phone",
|
||||||
Status: "status",
|
NetbarAccount: "netbar_account",
|
||||||
CreatedAt: "created_at",
|
Status: "status",
|
||||||
UpdatedAt: "updated_at",
|
CreatedAt: "created_at",
|
||||||
DeletedAt: "deleted_at",
|
UpdatedAt: "updated_at",
|
||||||
|
DeletedAt: "deleted_at",
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,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 (
|
|||||||
|
|
||||||
// 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.
|
||||||
@ -38,12 +37,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,11 +67,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 (
|
|||||||
|
|
||||||
// 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.
|
||||||
@ -48,12 +47,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +77,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.
|
||||||
@ -60,12 +59,11 @@ var usersColumns = UsersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewUsersDao creates and returns a new DAO object for table data access.
|
// NewUsersDao creates and returns a new DAO object for table data access.
|
||||||
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
|
func NewUsersDao() *UsersDao {
|
||||||
return &UsersDao{
|
return &UsersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "users",
|
table: "users",
|
||||||
columns: usersColumns,
|
columns: usersColumns,
|
||||||
handlers: handlers,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,11 +89,7 @@ func (dao *UsersDao) Group() string {
|
|||||||
|
|
||||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
model := dao.DB().Model(dao.table)
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||||
for _, handler := range dao.handlers {
|
|
||||||
model = handler(model)
|
|
||||||
}
|
|
||||||
return model.Safe().Ctx(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
|
|||||||
@ -11,16 +11,17 @@ import (
|
|||||||
|
|
||||||
// Stores is the golang structure of table stores for DAO operations like Where/Data.
|
// Stores is the golang structure of table stores for DAO operations like Where/Data.
|
||||||
type Stores struct {
|
type Stores struct {
|
||||||
g.Meta `orm:"table:stores, do:true"`
|
g.Meta `orm:"table:stores, do:true"`
|
||||||
Id interface{} // 门店ID
|
Id interface{} // 门店ID
|
||||||
MerchantId interface{} // 所属商户ID
|
MerchantId interface{} // 所属商户ID
|
||||||
Name interface{} // 门店名称
|
Name interface{} // 门店名称
|
||||||
StoreCode interface{} // 门店编号
|
StoreCode interface{} // 门店编号
|
||||||
Address interface{} // 门店地址
|
Address interface{} // 门店地址
|
||||||
ContactName interface{} // 联系人姓名
|
ContactName interface{} // 联系人姓名
|
||||||
ContactPhone interface{} // 联系人电话
|
ContactPhone interface{} // 联系人电话
|
||||||
Status interface{} // 状态:1=正常营业,2=暂停营业
|
NetbarAccount interface{} // QQ 当吧网关账号
|
||||||
CreatedAt *gtime.Time // 创建时间
|
Status interface{} // 状态:1=正常营业,2=暂停营业
|
||||||
UpdatedAt *gtime.Time // 更新时间
|
CreatedAt *gtime.Time // 创建时间
|
||||||
DeletedAt *gtime.Time // 软删除时间戳
|
UpdatedAt *gtime.Time // 更新时间
|
||||||
|
DeletedAt *gtime.Time // 软删除时间戳
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,15 +10,16 @@ import (
|
|||||||
|
|
||||||
// Stores is the golang structure for table stores.
|
// Stores is the golang structure for table stores.
|
||||||
type Stores struct {
|
type Stores struct {
|
||||||
Id int64 `json:"id" orm:"id" description:"门店ID"` // 门店ID
|
Id int64 `json:"id" orm:"id" description:"门店ID"` // 门店ID
|
||||||
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
|
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
|
||||||
Name string `json:"name" orm:"name" description:"门店名称"` // 门店名称
|
Name string `json:"name" orm:"name" description:"门店名称"` // 门店名称
|
||||||
StoreCode string `json:"storeCode" orm:"store_code" description:"门店编号"` // 门店编号
|
StoreCode string `json:"storeCode" orm:"store_code" description:"门店编号"` // 门店编号
|
||||||
Address string `json:"address" orm:"address" description:"门店地址"` // 门店地址
|
Address string `json:"address" orm:"address" description:"门店地址"` // 门店地址
|
||||||
ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名
|
ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名
|
||||||
ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话
|
ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话
|
||||||
Status int `json:"status" orm:"status" description:"状态:1=正常营业,2=暂停营业"` // 状态:1=正常营业,2=暂停营业
|
NetbarAccount string `json:"netbarAccount" orm:"netbar_account" description:"QQ 当吧网关账号"` // QQ 当吧网关账号
|
||||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
Status int `json:"status" orm:"status" description:"状态:1=正常营业,2=暂停营业"` // 状态:1=正常营业,2=暂停营业
|
||||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||||
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,15 +5,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Store struct {
|
type Store struct {
|
||||||
g.Meta `orm:"table:stores"` // 绑定表名
|
g.Meta `orm:"table:stores"` // 绑定表名
|
||||||
Id int64 `json:"id" orm:"id,primary" dc:"门店ID"`
|
Id int64 `json:"id" orm:"id,primary" dc:"门店ID"`
|
||||||
MerchantId int64 `json:"merchantId" orm:"merchant_id,not null" dc:"所属商户ID"`
|
MerchantId int64 `json:"merchantId" orm:"merchant_id,not null" dc:"所属商户ID"`
|
||||||
Name string `json:"name" orm:"name,not null" dc:"门店名称"`
|
Name string `json:"name" orm:"name,not null" dc:"门店名称"`
|
||||||
StoreCode string `json:"storeCode" orm:"store_code,unique" dc:"门店编号"`
|
StoreCode string `json:"storeCode" orm:"store_code,unique" dc:"门店编号"`
|
||||||
Address string `json:"address" orm:"address" dc:"门店地址"`
|
Address string `json:"address" orm:"address" dc:"门店地址"`
|
||||||
ContactName string `json:"contactName" orm:"contact_name" dc:"联系人姓名"`
|
ContactName string `json:"contactName" orm:"contact_name" dc:"联系人姓名"`
|
||||||
ContactPhone string `json:"contactPhone" orm:"contact_phone" dc:"联系人电话"`
|
ContactPhone string `json:"contactPhone" orm:"contact_phone" dc:"联系人电话"`
|
||||||
Status int `json:"status" orm:"status,default:1" dc:"状态:1=正常营业,2=暂停营业,3=已关闭"`
|
Status int `json:"status" orm:"status,default:1" dc:"状态:1=正常营业,2=暂停营业,3=已关闭"`
|
||||||
|
NetbarAccount string `json:"netbarAccount" orm:"netbar_account" dc:"网吧网关账号"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreCreateIn struct {
|
type StoreCreateIn struct {
|
||||||
|
|||||||
@ -4,11 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-resty/resty/v2"
|
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
|
||||||
"github.com/gogf/gf/v2/os/glog"
|
|
||||||
"github.com/gogf/gf/v2/util/gconv"
|
|
||||||
"github.com/gogf/gf/v2/util/grand"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"server/internal/consts"
|
"server/internal/consts"
|
||||||
"server/internal/model"
|
"server/internal/model"
|
||||||
@ -16,6 +11,12 @@ import (
|
|||||||
"server/utility/encrypt"
|
"server/utility/encrypt"
|
||||||
"server/utility/rsa"
|
"server/utility/rsa"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/glog"
|
||||||
|
"github.com/gogf/gf/v2/util/gconv"
|
||||||
|
"github.com/gogf/gf/v2/util/grand"
|
||||||
)
|
)
|
||||||
|
|
||||||
type gamelifeClient struct {
|
type gamelifeClient struct {
|
||||||
@ -168,7 +169,8 @@ func (s *gamelifeClient) GetUrl(ctx context.Context, popenid, appname, nickname
|
|||||||
rooturl = s.unBoundUrlMap[s.Mode]
|
rooturl = s.unBoundUrlMap[s.Mode]
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheData, err := g.Redis().Get(ctx, fmt.Sprintf(consts.GameLifeUserKey, popenid))
|
gamelifeCacheKey := fmt.Sprintf(consts.GameLifeUserKey, popenid)
|
||||||
|
cacheData, err := g.Redis().Get(ctx, gamelifeCacheKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", ecode.Fail.Sub("从缓存中获取用户信息失败")
|
return "", ecode.Fail.Sub("从缓存中获取用户信息失败")
|
||||||
}
|
}
|
||||||
@ -226,7 +228,15 @@ func (s *gamelifeClient) GetUrl(ctx context.Context, popenid, appname, nickname
|
|||||||
}
|
}
|
||||||
// 将请求参数更新到缓存中
|
// 将请求参数更新到缓存中
|
||||||
gamelifeCache.Params = queryParams.Encode()
|
gamelifeCache.Params = queryParams.Encode()
|
||||||
|
// 获取原缓存值、过期时间
|
||||||
|
ttl, err := g.Redis().TTL(ctx, gamelifeCacheKey)
|
||||||
|
if err != nil {
|
||||||
|
return "", ecode.Fail.Sub("获取缓存过期时间失败")
|
||||||
|
}
|
||||||
|
// 更新数据
|
||||||
|
if err = g.Redis().SetEX(ctx, gamelifeCacheKey, gamelifeCache, ttl); err != nil {
|
||||||
|
return "", ecode.Fail.Sub("更新缓存失败")
|
||||||
|
}
|
||||||
// 拼接最终 URL
|
// 拼接最终 URL
|
||||||
url := fmt.Sprintf("%s?%s", rooturl, queryParams.Encode())
|
url := fmt.Sprintf("%s?%s", rooturl, queryParams.Encode())
|
||||||
return url, nil
|
return url, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user