Merge remote-tracking branch 'origin/master'
# Conflicts: # internal/dao/internal/store_client_sessions.go # internal/dao/store_client_sessions.go # internal/model/do/store_client_sessions.go # internal/model/entity/store_client_sessions.go
This commit is contained in:
@ -21,4 +21,7 @@ type IStoreV1 interface {
|
|||||||
GetIpList(ctx context.Context, req *v1.GetIpListReq) (res *v1.GetIpListRes, err error)
|
GetIpList(ctx context.Context, req *v1.GetIpListReq) (res *v1.GetIpListRes, err error)
|
||||||
Detail(ctx context.Context, req *v1.DetailReq) (res *v1.DetailRes, err error)
|
Detail(ctx context.Context, req *v1.DetailReq) (res *v1.DetailRes, err error)
|
||||||
StoreMemberLevel(ctx context.Context, req *v1.StoreMemberLevelReq) (res *v1.StoreMemberLevelRes, err error)
|
StoreMemberLevel(ctx context.Context, req *v1.StoreMemberLevelReq) (res *v1.StoreMemberLevelRes, err error)
|
||||||
|
GetStoreAreaList(ctx context.Context, req *v1.GetStoreAreaListReq) (res *v1.GetStoreAreaListRes, err error)
|
||||||
|
GetNetfeeSetting(ctx context.Context, req *v1.GetNetfeeSettingReq) (res *v1.GetNetfeeSettingRes, err error)
|
||||||
|
SaveNetfeeSetting(ctx context.Context, req *v1.SaveNetfeeSettingReq) (res *v1.SaveNetfeeSettingRes, err error)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,3 +105,41 @@ type StoreMemberLevelRes struct {
|
|||||||
List interface{} `json:"list"`
|
List interface{} `json:"list"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
type GetStoreAreaListReq struct {
|
||||||
|
g.Meta `path:"/store/area" method:"get" tags:"Backend/Store" summary:"(系统、商户门店后台)获取门店区域列表"`
|
||||||
|
StoreId int64 `json:"storeId" v:"required#门店ID不能为空" dc:"门店ID"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetStoreAreaListRes struct {
|
||||||
|
List interface{} `json:"list"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetNetfeeSettingReq struct {
|
||||||
|
g.Meta `path:"/store/netfeeSetting" method:"get" tags:"Backend/Store" summary:"(系统、商户门店后台)获取门店网络费设置"`
|
||||||
|
StoreId int64 `json:"storeId" v:"required#门店ID不能为空" dc:"门店ID"`
|
||||||
|
LevelId int64 `json:"levelId" v:"required#会员等级ID不能为空" dc:"会员等级ID"`
|
||||||
|
AreaId int64 `json:"areaId" v:"required#区域ID不能为空" dc:"区域ID"`
|
||||||
|
RewardId int64 `json:"rewardId" v:"required#奖励ID不能为空" dc:"奖励ID"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetNetfeeSettingRes struct {
|
||||||
|
Id int64 `json:"id" dc:"主键ID"` // 主键ID
|
||||||
|
StoreId int64 `json:"storeId" dc:"门店ID"` // 门店ID
|
||||||
|
RewardId int64 `json:"rewardId" dc:"奖励ID(rewards表主键)"` // 奖励ID(rewards表主键)
|
||||||
|
AreaId int64 `json:"areaId" dc:"区域ID(外部系统)"` // 区域ID(外部系统)
|
||||||
|
MemberLevelId int64 `json:"memberLevelId" dc:"会员等级ID(外部系统)"` // 会员等级ID(外部系统)
|
||||||
|
PriceData string `json:"priceData" dc:"7x24价格矩阵"` // 7x24价格矩阵
|
||||||
|
}
|
||||||
|
type SaveNetfeeSettingReq struct {
|
||||||
|
g.Meta `path:"/store/netfeeSetting" method:"post" tags:"Backend/Store" summary:"(系统、商户门店后台)保存门店网络费设置"`
|
||||||
|
StoreId int64 `json:"storeId" v:"required#门店ID不能为空" dc:"门店ID"`
|
||||||
|
LevelId int64 `json:"levelId" v:"required#会员等级ID不能为空" dc:"会员等级ID"`
|
||||||
|
AreaId int64 `json:"areaId" v:"required#区域ID不能为空" dc:"区域ID"`
|
||||||
|
RewardId int64 `json:"rewardId" v:"required#奖励ID不能为空" dc:"奖励ID"`
|
||||||
|
PriceData string `json:"priceData" v:"required#价格矩阵不能为空" dc:"价格矩阵"`
|
||||||
|
Id int64 `json:"id" dc:"id"`
|
||||||
|
}
|
||||||
|
type SaveNetfeeSettingRes struct {
|
||||||
|
Success bool `json:"success" dc:"是否成功"`
|
||||||
|
}
|
||||||
|
|||||||
29
internal/controller/store/store_v1_get_netfee_setting.go
Normal file
29
internal/controller/store/store_v1_get_netfee_setting.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package store
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"server/internal/model"
|
||||||
|
"server/internal/service"
|
||||||
|
|
||||||
|
"server/api/store/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *ControllerV1) GetNetfeeSetting(ctx context.Context, req *v1.GetNetfeeSettingReq) (res *v1.GetNetfeeSettingRes, err error) {
|
||||||
|
out, err := service.Store().GetNetfeeSetting(ctx, &model.GetNetfeeSettingIn{
|
||||||
|
StoreId: req.StoreId,
|
||||||
|
RewardId: req.RewardId,
|
||||||
|
AreaId: req.AreaId,
|
||||||
|
MemberLevelId: req.LevelId,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return &v1.GetNetfeeSettingRes{
|
||||||
|
AreaId: out.AreaId,
|
||||||
|
Id: out.Id,
|
||||||
|
MemberLevelId: out.MemberLevelId,
|
||||||
|
PriceData: out.PriceData,
|
||||||
|
RewardId: out.RewardId,
|
||||||
|
StoreId: out.StoreId,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
26
internal/controller/store/store_v1_get_store_area_list.go
Normal file
26
internal/controller/store/store_v1_get_store_area_list.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package store
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"server/internal/model"
|
||||||
|
"server/internal/service"
|
||||||
|
|
||||||
|
"server/api/store/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *ControllerV1) GetStoreAreaList(ctx context.Context, req *v1.GetStoreAreaListReq) (res *v1.GetStoreAreaListRes, err error) {
|
||||||
|
fromCtx := g.RequestFromCtx(ctx)
|
||||||
|
operatorId := fromCtx.GetCtxVar("id").Int64()
|
||||||
|
operatorRole := fromCtx.GetCtxVar("role").String()
|
||||||
|
|
||||||
|
out, err := service.Store().GetStoreAreaList(ctx, &model.StoreAreaListIn{StoreId: req.StoreId, OperatorRole: operatorRole, OperatorId: operatorId})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &v1.GetStoreAreaListRes{
|
||||||
|
List: out.List,
|
||||||
|
Total: out.Total,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
26
internal/controller/store/store_v1_save_netfee_setting.go
Normal file
26
internal/controller/store/store_v1_save_netfee_setting.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package store
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"server/internal/model"
|
||||||
|
"server/internal/service"
|
||||||
|
|
||||||
|
"server/api/store/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *ControllerV1) SaveNetfeeSetting(ctx context.Context, req *v1.SaveNetfeeSettingReq) (res *v1.SaveNetfeeSettingRes, err error) {
|
||||||
|
out, err := service.Store().SaveNetfeeSetting(ctx, &model.SaveNetfeeSettingIn{
|
||||||
|
AreaId: req.AreaId,
|
||||||
|
MemberLevelId: req.LevelId,
|
||||||
|
PriceData: req.PriceData,
|
||||||
|
RewardId: req.RewardId,
|
||||||
|
StoreId: req.StoreId,
|
||||||
|
Id: req.Id,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &v1.SaveNetfeeSettingRes{
|
||||||
|
Success: out.Success,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@ -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 (
|
|||||||
|
|
||||||
// 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.
|
||||||
@ -54,12 +53,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,11 +83,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.
|
||||||
@ -62,12 +61,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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,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.
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package store
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"github.com/gogf/gf/v2/database/gdb"
|
"github.com/gogf/gf/v2/database/gdb"
|
||||||
"github.com/gogf/gf/v2/errors/gerror"
|
"github.com/gogf/gf/v2/errors/gerror"
|
||||||
"server/internal/consts"
|
"server/internal/consts"
|
||||||
@ -299,3 +300,77 @@ func (s *sStore) GetStoreMemberList(ctx context.Context, in *model.StoreMemberLe
|
|||||||
Total: total,
|
Total: total,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
func (s *sStore) GetStoreAreaList(ctx context.Context, in *model.StoreAreaListIn) (out *model.StoreAreaListOut, err error) {
|
||||||
|
|
||||||
|
// 根据角色权限获取门店ID
|
||||||
|
switch in.OperatorRole {
|
||||||
|
case consts.MerchantRoleCode:
|
||||||
|
exist, err := dao.MerchantAdmins.Ctx(ctx).Where(do.MerchantAdmins{
|
||||||
|
MerchantId: in.OperatorId,
|
||||||
|
}).LeftJoin(dao.Stores.Table(), fmt.Sprintf("%s.%s = %s.%s", dao.Stores.Table(), dao.Stores.Columns().MerchantId, dao.MerchantAdmins.Table(), dao.MerchantAdmins.Columns().MerchantId)).Where("stores.id = ?", in.StoreId).Exist()
|
||||||
|
if err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("检查商户权限失败")
|
||||||
|
}
|
||||||
|
if !exist {
|
||||||
|
return nil, ecode.Params.Sub("无门店权限")
|
||||||
|
}
|
||||||
|
case consts.StoreRoleCode:
|
||||||
|
// 检查门店管理员是否有该门店权限
|
||||||
|
value, err := dao.StoreAdmins.Ctx(ctx).WherePri(in.OperatorId).Fields(dao.StoreAdmins.Columns().StoreId).Value()
|
||||||
|
if err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("检查门店权限失败")
|
||||||
|
}
|
||||||
|
if value.IsEmpty() || value.Int64() != in.StoreId {
|
||||||
|
return nil, ecode.Params.Sub("无门店权限")
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return nil, ecode.Params.Sub("无操作权限")
|
||||||
|
}
|
||||||
|
out = &model.StoreAreaListOut{}
|
||||||
|
if err = dao.StoreAreas.Ctx(ctx).Where(do.StoreAreas{StoreId: in.StoreId}).ScanAndCount(&out.List, &out.Total, false); err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("门店区域列表获取失败")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *sStore) GetNetfeeSetting(ctx context.Context, in *model.GetNetfeeSettingIn) (out *model.StoreNetfeeAreaLevel, err error) {
|
||||||
|
out = &model.StoreNetfeeAreaLevel{}
|
||||||
|
one, err := dao.StoreNetfeeAreaLevel.Ctx(ctx).Where(do.StoreNetfeeAreaLevel{StoreId: in.StoreId, RewardId: in.RewardId, AreaId: in.AreaId, MemberLevelId: in.MemberLevelId}).One()
|
||||||
|
if err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("门店区域价格获取失败")
|
||||||
|
}
|
||||||
|
if one.IsEmpty() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = one.Struct(out); err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("门店区域价格获取失败")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (s *sStore) SaveNetfeeSetting(ctx context.Context, in *model.SaveNetfeeSettingIn) (out *model.SaveNetfeeSettingOut, err error) {
|
||||||
|
exist, err := dao.StoreNetfeeAreaLevel.Ctx(ctx).Where(do.StoreNetfeeAreaLevel{StoreId: in.StoreId, RewardId: in.RewardId, AreaId: in.AreaId, MemberLevelId: in.MemberLevelId}).Exist()
|
||||||
|
if err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("门店区域价格保存失败")
|
||||||
|
}
|
||||||
|
if exist {
|
||||||
|
_, err = dao.StoreNetfeeAreaLevel.Ctx(ctx).Where(do.StoreNetfeeAreaLevel{StoreId: in.StoreId, RewardId: in.RewardId, AreaId: in.AreaId, MemberLevelId: in.MemberLevelId}).
|
||||||
|
Update(do.StoreNetfeeAreaLevel{PriceData: in.PriceData})
|
||||||
|
if err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("门店区域价格保存失败")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_, err = dao.StoreNetfeeAreaLevel.Ctx(ctx).Insert(do.StoreNetfeeAreaLevel{
|
||||||
|
AreaId: in.AreaId,
|
||||||
|
MemberLevelId: in.MemberLevelId,
|
||||||
|
PriceData: in.PriceData,
|
||||||
|
RewardId: in.RewardId,
|
||||||
|
StoreId: in.StoreId,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("门店区域价格保存失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &model.SaveNetfeeSettingOut{
|
||||||
|
Success: true,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|||||||
29
internal/model/netfeeAreaLevel.go
Normal file
29
internal/model/netfeeAreaLevel.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type StoreNetfeeAreaLevel struct {
|
||||||
|
Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID
|
||||||
|
StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID"` // 门店ID
|
||||||
|
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID(rewards表主键)"` // 奖励ID(rewards表主键)
|
||||||
|
AreaId int64 `json:"areaId" orm:"area_id" description:"区域ID(外部系统)"` // 区域ID(外部系统)
|
||||||
|
MemberLevelId int64 `json:"memberLevelId" orm:"member_level_id" description:"会员等级ID(外部系统)"` // 会员等级ID(外部系统)
|
||||||
|
PriceData string `json:"priceData" orm:"price_data" description:"7x24价格矩阵"` // 7x24价格矩阵
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetNetfeeSettingIn struct {
|
||||||
|
StoreId int64
|
||||||
|
AreaId int64
|
||||||
|
MemberLevelId int64
|
||||||
|
RewardId int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type SaveNetfeeSettingIn struct {
|
||||||
|
StoreId int64
|
||||||
|
RewardId int64
|
||||||
|
AreaId int64
|
||||||
|
MemberLevelId int64
|
||||||
|
PriceData string
|
||||||
|
Id int64
|
||||||
|
}
|
||||||
|
type SaveNetfeeSettingOut struct {
|
||||||
|
Success bool
|
||||||
|
}
|
||||||
17
internal/model/storeArea.go
Normal file
17
internal/model/storeArea.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type StoreArea struct {
|
||||||
|
Id int64 `json:"id" orm:"id" description:"区域ID"` // 区域ID
|
||||||
|
StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID
|
||||||
|
AreaName string `json:"areaName" orm:"area_name" description:"区域名称"` // 区域名称
|
||||||
|
}
|
||||||
|
|
||||||
|
type StoreAreaListIn struct {
|
||||||
|
OperatorId int64
|
||||||
|
OperatorRole string
|
||||||
|
StoreId int64 `json:"storeId"`
|
||||||
|
}
|
||||||
|
type StoreAreaListOut struct {
|
||||||
|
List []StoreArea
|
||||||
|
Total int
|
||||||
|
}
|
||||||
@ -24,6 +24,9 @@ type (
|
|||||||
DeleteIP(ctx context.Context, in *model.IPDeleteIn) (*model.IPDeleteOut, error)
|
DeleteIP(ctx context.Context, in *model.IPDeleteIn) (*model.IPDeleteOut, error)
|
||||||
Detail(ctx context.Context, in *model.StoreDetailIn) (out *model.StoreDetailOut, err error)
|
Detail(ctx context.Context, in *model.StoreDetailIn) (out *model.StoreDetailOut, err error)
|
||||||
GetStoreMemberList(ctx context.Context, in *model.StoreMemberLevelsListIn) (out *model.StoreMemberLevelsListOut, err error)
|
GetStoreMemberList(ctx context.Context, in *model.StoreMemberLevelsListIn) (out *model.StoreMemberLevelsListOut, err error)
|
||||||
|
GetStoreAreaList(ctx context.Context, in *model.StoreAreaListIn) (out *model.StoreAreaListOut, err error)
|
||||||
|
GetNetfeeSetting(ctx context.Context, in *model.GetNetfeeSettingIn) (out *model.StoreNetfeeAreaLevel, err error)
|
||||||
|
SaveNetfeeSetting(ctx context.Context, in *model.SaveNetfeeSettingIn) (out *model.SaveNetfeeSettingOut, err error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -95,6 +95,9 @@ func init() {
|
|||||||
{
|
{
|
||||||
// 获取会员
|
// 获取会员
|
||||||
enforcer.AddPolicy("store", "/x/store/memberLevel", "GET", "获取用户会员信息")
|
enforcer.AddPolicy("store", "/x/store/memberLevel", "GET", "获取用户会员信息")
|
||||||
|
enforcer.AddPolicy("store", "/x/store/area", "GET", "获取门店区域列表")
|
||||||
|
enforcer.AddPolicy("store", "/x/store/netfeeSetting", "GET", "获取门店网费设置")
|
||||||
|
enforcer.AddPolicy("store", "/x/store/netfeeSetting", "POST", "修改门店网费设置")
|
||||||
// 门店:修改
|
// 门店:修改
|
||||||
enforcer.AddPolicy("store", "/x/task/sync", "POST", "同步任务")
|
enforcer.AddPolicy("store", "/x/task/sync", "POST", "同步任务")
|
||||||
// 奖励类型
|
// 奖励类型
|
||||||
|
|||||||
Reference in New Issue
Block a user