调整商户注册逻辑
This commit is contained in:
@ -7,7 +7,7 @@ type ListReq struct {
|
||||
Page int `json:"page" dc:"页数"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
Status int `json:"status" dc:"状态:1=启用,2=禁用"`
|
||||
AuditStatus int `json:"auditStatus" dc:"审核状态:0=待审核,1=审核通过,2=审核拒绝"`
|
||||
AuditStatus int `json:"auditStatus" dc:"审核状态:1=待审核,2=审核通过,3=审核拒绝"`
|
||||
}
|
||||
type ListRes struct {
|
||||
List interface{} `json:"list" dc:"商户列表"`
|
||||
@ -31,7 +31,7 @@ type UpdateRes struct {
|
||||
type AuditReq struct {
|
||||
g.Meta `path:"/merchant/audit" method:"post" tags:"Merchant" summary:"(系统管理员)商户审核"`
|
||||
Id int64 `json:"id" v:"required" dc:"商户ID"`
|
||||
AuditStatus int `json:"auditStatus" v:"required" dc:"审核状态:1=审核通过,2=审核拒绝" `
|
||||
AuditStatus int `json:"auditStatus" v:"required" dc:"审核状态:2=审核通过,3=审核拒绝" `
|
||||
AuditRemark string `json:"auditRemark" dc:"审核备注"`
|
||||
RejectReason string `json:"rejectReason" dc:"拒绝原因"`
|
||||
}
|
||||
|
||||
@ -8,5 +8,7 @@ type MerchantAdminInfoReq struct {
|
||||
g.Meta `path:"/merchant/info" method:"get" tags:"MerchantAdmin" summary:"(商户管理员)获取商户管理员信息"`
|
||||
}
|
||||
type MerchantAdminInfoRes struct {
|
||||
Name string
|
||||
MerchantId int64 `json:"merchantId"`
|
||||
Username string `json:"username"`
|
||||
StoreId int64 `json:"storeId"` // 下属门店 id
|
||||
}
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
gfcli:
|
||||
gen:
|
||||
dao:
|
||||
- link: "mysql:root:MSms0427@tcp(192.168.3.132:3306)/arenax"
|
||||
- link: "mysql:root:MSms0427@tcp(localhost:3306)/arenax"
|
||||
descriptionTag: true
|
||||
tablesEx: "casbin_rule"
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"server/internal/controller/feedback"
|
||||
"server/internal/controller/game"
|
||||
"server/internal/controller/merchant"
|
||||
"server/internal/controller/merchantAdmin"
|
||||
"server/internal/controller/reward"
|
||||
"server/internal/controller/rewardType"
|
||||
"server/internal/controller/role"
|
||||
@ -38,6 +39,7 @@ var (
|
||||
group.Middleware(middleware.Auth)
|
||||
group.Middleware(middleware.Casbin)
|
||||
group.Bind(
|
||||
merchantAdmin.NewV1(),
|
||||
upload.NewV1(),
|
||||
admin.NewV1(),
|
||||
role.NewV1(),
|
||||
|
||||
@ -8,7 +8,7 @@ const (
|
||||
|
||||
// 商户审核状态
|
||||
const (
|
||||
MerchantPendingReview = iota
|
||||
MerchantPendingReview = iota + 1
|
||||
MerchantReviewPassed
|
||||
MerchantReviewRejected
|
||||
)
|
||||
|
||||
6
internal/consts/store.go
Normal file
6
internal/consts/store.go
Normal file
@ -0,0 +1,6 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
StoreEnable = iota + 1
|
||||
StoreDisable
|
||||
)
|
||||
@ -15,5 +15,5 @@ func (c *ControllerV1) MerchantAdminInfo(ctx context.Context, req *v1.MerchantAd
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MerchantAdminInfoRes{Name: info.Name}, nil
|
||||
return &v1.MerchantAdminInfoRes{Username: info.Username, MerchantId: info.MerchantId, StoreId: info.StoreId}, nil
|
||||
}
|
||||
|
||||
@ -2,13 +2,23 @@ package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
"server/api/user/v1"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
|
||||
return nil, gerror.NewCode(gcode.CodeNotImplemented)
|
||||
fromCtx := g.RequestFromCtx(ctx)
|
||||
operatorId := fromCtx.Get("operatorId").Int64()
|
||||
operatorRole := fromCtx.Get("role").String()
|
||||
out, err := service.User().List(ctx, &model.UserListIn{Page: req.Page, Size: req.Size, OperatorId: operatorId, OperatorRole: operatorRole})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.ListRes{
|
||||
List: out.List,
|
||||
Total: out.Total,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// AdminsDao is the data access object for the table admins.
|
||||
type AdminsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns AdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns AdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
|
||||
func NewAdminsDao() *AdminsDao {
|
||||
return &AdminsDao{
|
||||
group: "default",
|
||||
table: "admins",
|
||||
columns: adminsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "admins",
|
||||
columns: adminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// FeedbacksDao is the data access object for the table feedbacks.
|
||||
type FeedbacksDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns FeedbacksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns FeedbacksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
|
||||
func NewFeedbacksDao() *FeedbacksDao {
|
||||
return &FeedbacksDao{
|
||||
group: "default",
|
||||
table: "feedbacks",
|
||||
columns: feedbacksColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "feedbacks",
|
||||
columns: feedbacksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// GamesDao is the data access object for the table games.
|
||||
type GamesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns GamesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns GamesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
|
||||
func NewGamesDao() *GamesDao {
|
||||
return &GamesDao{
|
||||
group: "default",
|
||||
table: "games",
|
||||
columns: gamesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "games",
|
||||
columns: gamesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
func (dao *GamesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// MerchantAdminsDao is the data access object for the table merchant_admins.
|
||||
type MerchantAdminsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// MerchantAdminsColumns defines and stores column names for the table merchant_admins.
|
||||
@ -60,12 +59,11 @@ var merchantAdminsColumns = MerchantAdminsColumns{
|
||||
}
|
||||
|
||||
// NewMerchantAdminsDao creates and returns a new DAO object for table data access.
|
||||
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
|
||||
func NewMerchantAdminsDao() *MerchantAdminsDao {
|
||||
return &MerchantAdminsDao{
|
||||
group: "default",
|
||||
table: "merchant_admins",
|
||||
columns: merchantAdminsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "merchant_admins",
|
||||
columns: merchantAdminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,11 +89,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.
|
||||
func (dao *MerchantAdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// MerchantsDao is the data access object for the table merchants.
|
||||
type MerchantsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns MerchantsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns MerchantsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
|
||||
func NewMerchantsDao() *MerchantsDao {
|
||||
return &MerchantsDao{
|
||||
group: "default",
|
||||
table: "merchants",
|
||||
columns: merchantsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "merchants",
|
||||
columns: merchantsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// RewardTypesDao is the data access object for the table reward_types.
|
||||
type RewardTypesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// RewardTypesColumns defines and stores column names for the table reward_types.
|
||||
@ -44,12 +43,11 @@ var rewardTypesColumns = RewardTypesColumns{
|
||||
}
|
||||
|
||||
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
||||
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
|
||||
func NewRewardTypesDao() *RewardTypesDao {
|
||||
return &RewardTypesDao{
|
||||
group: "default",
|
||||
table: "reward_types",
|
||||
columns: rewardTypesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "reward_types",
|
||||
columns: rewardTypesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,11 +73,7 @@ func (dao *RewardTypesDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// RewardsDao is the data access object for the table rewards.
|
||||
type RewardsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// RewardsColumns defines and stores column names for the table rewards.
|
||||
@ -54,12 +53,11 @@ var rewardsColumns = RewardsColumns{
|
||||
}
|
||||
|
||||
// NewRewardsDao creates and returns a new DAO object for table data access.
|
||||
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
|
||||
func NewRewardsDao() *RewardsDao {
|
||||
return &RewardsDao{
|
||||
group: "default",
|
||||
table: "rewards",
|
||||
columns: rewardsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "rewards",
|
||||
columns: rewardsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,11 +83,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.
|
||||
func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// RolesDao is the data access object for the table roles.
|
||||
type RolesDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RolesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns RolesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// RolesColumns defines and stores column names for the table roles.
|
||||
@ -46,12 +45,11 @@ var rolesColumns = RolesColumns{
|
||||
}
|
||||
|
||||
// NewRolesDao creates and returns a new DAO object for table data access.
|
||||
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
|
||||
func NewRolesDao() *RolesDao {
|
||||
return &RolesDao{
|
||||
group: "default",
|
||||
table: "roles",
|
||||
columns: rolesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "roles",
|
||||
columns: rolesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,11 +75,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.
|
||||
func (dao *RolesDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoreAdminsDao is the data access object for the table store_admins.
|
||||
type StoreAdminsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoreAdminsColumns defines and stores column names for the table store_admins.
|
||||
@ -56,12 +55,11 @@ var storeAdminsColumns = StoreAdminsColumns{
|
||||
}
|
||||
|
||||
// NewStoreAdminsDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
|
||||
func NewStoreAdminsDao() *StoreAdminsDao {
|
||||
return &StoreAdminsDao{
|
||||
group: "default",
|
||||
table: "store_admins",
|
||||
columns: storeAdminsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "store_admins",
|
||||
columns: storeAdminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,11 +85,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.
|
||||
func (dao *StoreAdminsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoreRewardsDao is the data access object for the table store_rewards.
|
||||
type StoreRewardsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoreRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoreRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoreRewardsColumns defines and stores column names for the table store_rewards.
|
||||
@ -34,12 +33,11 @@ var storeRewardsColumns = StoreRewardsColumns{
|
||||
}
|
||||
|
||||
// NewStoreRewardsDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreRewardsDao(handlers ...gdb.ModelHandler) *StoreRewardsDao {
|
||||
func NewStoreRewardsDao() *StoreRewardsDao {
|
||||
return &StoreRewardsDao{
|
||||
group: "default",
|
||||
table: "store_rewards",
|
||||
columns: storeRewardsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "store_rewards",
|
||||
columns: storeRewardsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,11 +63,7 @@ func (dao *StoreRewardsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoreRewardsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoresDao is the data access object for the table stores.
|
||||
type StoresDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoresColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns StoresColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoresColumns defines and stores column names for the table stores.
|
||||
@ -50,12 +49,11 @@ var storesColumns = StoresColumns{
|
||||
}
|
||||
|
||||
// NewStoresDao creates and returns a new DAO object for table data access.
|
||||
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
|
||||
func NewStoresDao() *StoresDao {
|
||||
return &StoresDao{
|
||||
group: "default",
|
||||
table: "stores",
|
||||
columns: storesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "stores",
|
||||
columns: storesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,11 +79,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.
|
||||
func (dao *StoresDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// TasksDao is the data access object for the table tasks.
|
||||
type TasksDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns TasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns TasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
|
||||
func NewTasksDao() *TasksDao {
|
||||
return &TasksDao{
|
||||
group: "default",
|
||||
table: "tasks",
|
||||
columns: tasksColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "tasks",
|
||||
columns: tasksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
func (dao *TasksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// UserTasksDao is the data access object for the table user_tasks.
|
||||
type UserTasksDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
|
||||
func NewUserTasksDao() *UserTasksDao {
|
||||
return &UserTasksDao{
|
||||
group: "default",
|
||||
table: "user_tasks",
|
||||
columns: userTasksColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "user_tasks",
|
||||
columns: userTasksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,59 +13,59 @@ import (
|
||||
|
||||
// UsersDao is the data access object for the table users.
|
||||
type UsersDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UsersColumns defines and stores column names for the table users.
|
||||
type UsersColumns struct {
|
||||
Id string // 用户唯一标识符
|
||||
WxOpenId string // 微信 OpenID
|
||||
Username string // 用户名
|
||||
Nickname string // 昵称
|
||||
Avatar string // 用户头像URL
|
||||
PasswordHash string // 密码哈希
|
||||
Email string // 邮箱地址
|
||||
PhoneNumber string // 手机号
|
||||
WxPopenId string // 微信 PopenID
|
||||
QqPopenId string // QQ PopenID
|
||||
FirstVisitAt string // 首次访问时间
|
||||
LastLoginAt string // 最后登录时间
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间
|
||||
RoleId string // 角色ID
|
||||
Id string // 用户唯一标识符
|
||||
WxOpenId string // 微信 OpenID
|
||||
Username string // 用户名
|
||||
Nickname string // 昵称
|
||||
Avatar string // 用户头像URL
|
||||
PasswordHash string // 密码哈希
|
||||
Email string // 邮箱地址
|
||||
PhoneNumber string // 手机号
|
||||
WxPopenId string // 微信 PopenID
|
||||
QqPopenId string // QQ PopenID
|
||||
FirstVisitAt string // 首次访问时间
|
||||
LastLoginAt string // 最后登录时间
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间
|
||||
RoleId string // 角色ID
|
||||
LastLoginStoreId string // 上次登录门店ID
|
||||
}
|
||||
|
||||
// usersColumns holds the columns for the table users.
|
||||
var usersColumns = UsersColumns{
|
||||
Id: "id",
|
||||
WxOpenId: "wx_open_id",
|
||||
Username: "username",
|
||||
Nickname: "nickname",
|
||||
Avatar: "avatar",
|
||||
PasswordHash: "password_hash",
|
||||
Email: "email",
|
||||
PhoneNumber: "phone_number",
|
||||
WxPopenId: "wx_popen_id",
|
||||
QqPopenId: "qq_popen_id",
|
||||
FirstVisitAt: "first_visit_at",
|
||||
LastLoginAt: "last_login_at",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
RoleId: "role_id",
|
||||
Id: "id",
|
||||
WxOpenId: "wx_open_id",
|
||||
Username: "username",
|
||||
Nickname: "nickname",
|
||||
Avatar: "avatar",
|
||||
PasswordHash: "password_hash",
|
||||
Email: "email",
|
||||
PhoneNumber: "phone_number",
|
||||
WxPopenId: "wx_popen_id",
|
||||
QqPopenId: "qq_popen_id",
|
||||
FirstVisitAt: "first_visit_at",
|
||||
LastLoginAt: "last_login_at",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
RoleId: "role_id",
|
||||
LastLoginStoreId: "last_login_store_id",
|
||||
}
|
||||
|
||||
// NewUsersDao creates and returns a new DAO object for table data access.
|
||||
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
|
||||
func NewUsersDao() *UsersDao {
|
||||
return &UsersDao{
|
||||
group: "default",
|
||||
table: "users",
|
||||
columns: usersColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "users",
|
||||
columns: usersColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,11 +91,7 @@ func (dao *UsersDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -49,7 +49,7 @@ func (s *sMerchant) Audit(ctx context.Context, in *model.MerchantAuditIn) (out *
|
||||
if merchant.IsEmpty() {
|
||||
return nil, ecode.Params.Sub("商户不存在")
|
||||
}
|
||||
if merchant[dao.Merchants.Columns().AuditStatus].Int() != 0 {
|
||||
if merchant[dao.Merchants.Columns().AuditStatus].Int() != 1 {
|
||||
return nil, ecode.Params.Sub("商户已审核")
|
||||
}
|
||||
if err = dao.Merchants.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||
|
||||
@ -90,7 +90,11 @@ func (s *sMerchantAdmin) Login(ctx context.Context, in *model.MerchantLoginIn) (
|
||||
return
|
||||
}
|
||||
func (s *sMerchantAdmin) Info(ctx context.Context, in *model.MerchantAdminInfoIn) (out *model.MerchantAdminInfoOut, err error) {
|
||||
one, err := dao.MerchantAdmins.Ctx(ctx).WherePri(in.MerchantAdminId).One()
|
||||
one, err := dao.MerchantAdmins.Ctx(ctx).WherePri(in.MerchantAdminId).
|
||||
LeftJoin(
|
||||
dao.Stores.Table(),
|
||||
fmt.Sprintf("%s.%s = %s.%s", dao.Stores.Table(), dao.Stores.Columns().MerchantId, dao.MerchantAdmins.Table(), dao.MerchantAdmins.Columns().MerchantId)).
|
||||
Fields(fmt.Sprintf("%s.*, %s.%s %s", dao.MerchantAdmins.Table(), dao.Stores.Table(), dao.Stores.Columns().Id, "storeId")).One()
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("查询商户管理员失败")
|
||||
}
|
||||
@ -102,7 +106,9 @@ func (s *sMerchantAdmin) Info(ctx context.Context, in *model.MerchantAdminInfoIn
|
||||
return nil, ecode.Fail.Sub("查询商户管理员失败")
|
||||
}
|
||||
return &model.MerchantAdminInfoOut{
|
||||
Name: admin.Username,
|
||||
Username: admin.Username,
|
||||
MerchantId: admin.MerchantId,
|
||||
StoreId: one["storeId"].Int64(),
|
||||
}, nil
|
||||
}
|
||||
func (s *sMerchantAdmin) Code(ctx context.Context, in *model.MerchantAdminCodeIn) (out *model.MerchantAdminCodeOut, err error) {
|
||||
@ -167,7 +173,21 @@ func (s *sMerchantAdmin) Register(ctx context.Context, in *model.MerchantAdminRe
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("插入商户数据失败")
|
||||
}
|
||||
|
||||
// 查询出商户角色 id 和门店角色 id
|
||||
array, err := tx.Model(dao.Roles.Table()).WhereIn(dao.Roles.Columns().Code, []string{consts.MerchantRoleCode, consts.StoreRoleCode}).Fields(dao.Roles.Columns().Code, dao.Roles.Columns().Id).All()
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("查询角色数据失败")
|
||||
}
|
||||
var merchantRoleId, storeRoleId int64
|
||||
for _, value := range array {
|
||||
code := value[dao.Roles.Columns().Code].String()
|
||||
id := value[dao.Roles.Columns().Id].Int64()
|
||||
if code == consts.MerchantRoleCode {
|
||||
merchantRoleId = id
|
||||
} else if code == consts.StoreRoleCode {
|
||||
storeRoleId = id
|
||||
}
|
||||
}
|
||||
// 插入商户管理员数据
|
||||
if _, err = tx.Model(dao.MerchantAdmins.Table()).Data(do.MerchantAdmins{
|
||||
MerchantId: id,
|
||||
@ -175,10 +195,41 @@ func (s *sMerchantAdmin) Register(ctx context.Context, in *model.MerchantAdminRe
|
||||
Phone: in.Phone,
|
||||
IsPrimary: true,
|
||||
Username: in.Username,
|
||||
RoleId: merchantRoleId,
|
||||
Status: consts.MerchantAdministratorEnable,
|
||||
}).Insert(); err != nil {
|
||||
return ecode.Fail.Sub("插入商户管理员数据失败")
|
||||
}
|
||||
|
||||
// 初始化一个网吧
|
||||
storeCode, err := snowid.GetSnowClient().GenerateStoreCode()
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("生成网吧编号失败")
|
||||
}
|
||||
|
||||
storeId, err := tx.Model(dao.Stores.Table()).Data(do.Stores{
|
||||
MerchantId: id,
|
||||
Name: fmt.Sprintf("%s的网吧", in.Username),
|
||||
StoreCode: storeCode,
|
||||
ContactPhone: in.Phone,
|
||||
Status: consts.StoreEnable,
|
||||
}).InsertAndGetId()
|
||||
if err != nil {
|
||||
return ecode.Fail.Sub("插入网吧数据失败")
|
||||
}
|
||||
// 初始化一个网吧管理员
|
||||
if _, err = tx.Model(dao.StoreAdmins.Table()).Data(do.StoreAdmins{
|
||||
StoreId: storeId,
|
||||
Username: in.Username,
|
||||
Phone: in.Phone,
|
||||
Status: consts.StoreAdminEnable,
|
||||
PasswordHash: hashPass,
|
||||
IsPrimary: true,
|
||||
RoleId: storeRoleId,
|
||||
}).Insert(); err != nil {
|
||||
return ecode.Fail.Sub("插入网吧管理员数据失败")
|
||||
}
|
||||
|
||||
return
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -199,8 +199,22 @@ func (s *sUser) BindPhone(ctx context.Context, in *model.UserBindPhoneIn) (out *
|
||||
}
|
||||
|
||||
func (s *sUser) List(ctx context.Context, in *model.UserListIn) (out *model.UserListOut, err error) {
|
||||
// 用于系统管理员、商户、门店查看用户列表, 展示用户最近的相关信息
|
||||
return
|
||||
list := make([]model.User, 0)
|
||||
var total int
|
||||
orm := dao.Users.Ctx(ctx)
|
||||
if in.Nickname != "" {
|
||||
orm = orm.WhereLike(dao.Users.Columns().Nickname, "%"+in.Nickname+"%")
|
||||
}
|
||||
if err = orm.Page(in.Page, in.Size).LeftJoin(
|
||||
dao.Stores.Table(),
|
||||
fmt.Sprintf("%s.%s = %s.%s", dao.Users.Table(), dao.Users.Columns().LastLoginStoreId, dao.Stores.Table(), dao.Stores.Columns().Id),
|
||||
).Fields(fmt.Sprintf("%s.*, %s.%s %s", dao.Users.Table(), dao.Stores.Table(), dao.Stores.Columns().Name, "last_login_store_name")).ScanAndCount(&list, &total, false); err != nil {
|
||||
return nil, ecode.Fail.Sub("获取用户列表失败")
|
||||
}
|
||||
return &model.UserListOut{
|
||||
List: list,
|
||||
Total: total,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *sUser) BoundUrl(ctx context.Context, in *model.UserBoundUrlIn) (out *model.UserBoundUrlOut, err error) {
|
||||
|
||||
@ -11,21 +11,22 @@ import (
|
||||
|
||||
// Users is the golang structure of table users for DAO operations like Where/Data.
|
||||
type Users struct {
|
||||
g.Meta `orm:"table:users, do:true"`
|
||||
Id interface{} // 用户唯一标识符
|
||||
WxOpenId interface{} // 微信 OpenID
|
||||
Username interface{} // 用户名
|
||||
Nickname interface{} // 昵称
|
||||
Avatar interface{} // 用户头像URL
|
||||
PasswordHash interface{} // 密码哈希
|
||||
Email interface{} // 邮箱地址
|
||||
PhoneNumber interface{} // 手机号
|
||||
WxPopenId interface{} // 微信 PopenID
|
||||
QqPopenId interface{} // QQ PopenID
|
||||
FirstVisitAt *gtime.Time // 首次访问时间
|
||||
LastLoginAt *gtime.Time // 最后登录时间
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 更新时间
|
||||
DeletedAt *gtime.Time // 软删除时间
|
||||
RoleId interface{} // 角色ID
|
||||
g.Meta `orm:"table:users, do:true"`
|
||||
Id interface{} // 用户唯一标识符
|
||||
WxOpenId interface{} // 微信 OpenID
|
||||
Username interface{} // 用户名
|
||||
Nickname interface{} // 昵称
|
||||
Avatar interface{} // 用户头像URL
|
||||
PasswordHash interface{} // 密码哈希
|
||||
Email interface{} // 邮箱地址
|
||||
PhoneNumber interface{} // 手机号
|
||||
WxPopenId interface{} // 微信 PopenID
|
||||
QqPopenId interface{} // QQ PopenID
|
||||
FirstVisitAt *gtime.Time // 首次访问时间
|
||||
LastLoginAt *gtime.Time // 最后登录时间
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 更新时间
|
||||
DeletedAt *gtime.Time // 软删除时间
|
||||
RoleId interface{} // 角色ID
|
||||
LastLoginStoreId interface{} // 上次登录门店ID
|
||||
}
|
||||
|
||||
@ -10,20 +10,21 @@ import (
|
||||
|
||||
// Users is the golang structure for table users.
|
||||
type Users struct {
|
||||
Id int64 `json:"id" orm:"id" description:"用户唯一标识符"` // 用户唯一标识符
|
||||
WxOpenId string `json:"wxOpenId" orm:"wx_open_id" description:"微信 OpenID"` // 微信 OpenID
|
||||
Username string `json:"username" orm:"username" description:"用户名"` // 用户名
|
||||
Nickname string `json:"nickname" orm:"nickname" description:"昵称"` // 昵称
|
||||
Avatar string `json:"avatar" orm:"avatar" description:"用户头像URL"` // 用户头像URL
|
||||
PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希
|
||||
Email string `json:"email" orm:"email" description:"邮箱地址"` // 邮箱地址
|
||||
PhoneNumber string `json:"phoneNumber" orm:"phone_number" description:"手机号"` // 手机号
|
||||
WxPopenId string `json:"wxPopenId" orm:"wx_popen_id" description:"微信 PopenID"` // 微信 PopenID
|
||||
QqPopenId string `json:"qqPopenId" orm:"qq_popen_id" description:"QQ PopenID"` // QQ PopenID
|
||||
FirstVisitAt *gtime.Time `json:"firstVisitAt" orm:"first_visit_at" description:"首次访问时间"` // 首次访问时间
|
||||
LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at" description:"最后登录时间"` // 最后登录时间
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
|
||||
Id int64 `json:"id" orm:"id" description:"用户唯一标识符"` // 用户唯一标识符
|
||||
WxOpenId string `json:"wxOpenId" orm:"wx_open_id" description:"微信 OpenID"` // 微信 OpenID
|
||||
Username string `json:"username" orm:"username" description:"用户名"` // 用户名
|
||||
Nickname string `json:"nickname" orm:"nickname" description:"昵称"` // 昵称
|
||||
Avatar string `json:"avatar" orm:"avatar" description:"用户头像URL"` // 用户头像URL
|
||||
PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希
|
||||
Email string `json:"email" orm:"email" description:"邮箱地址"` // 邮箱地址
|
||||
PhoneNumber string `json:"phoneNumber" orm:"phone_number" description:"手机号"` // 手机号
|
||||
WxPopenId string `json:"wxPopenId" orm:"wx_popen_id" description:"微信 PopenID"` // 微信 PopenID
|
||||
QqPopenId string `json:"qqPopenId" orm:"qq_popen_id" description:"QQ PopenID"` // QQ PopenID
|
||||
FirstVisitAt *gtime.Time `json:"firstVisitAt" orm:"first_visit_at" description:"首次访问时间"` // 首次访问时间
|
||||
LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at" description:"最后登录时间"` // 最后登录时间
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
|
||||
LastLoginStoreId int64 `json:"lastLoginStoreId" orm:"last_login_store_id" description:"上次登录门店ID"` // 上次登录门店ID
|
||||
}
|
||||
|
||||
@ -19,7 +19,9 @@ type MerchantAdminInfoIn struct {
|
||||
MerchantAdminId int64
|
||||
}
|
||||
type MerchantAdminInfoOut struct {
|
||||
Name string
|
||||
Username string
|
||||
MerchantId int64
|
||||
StoreId int64
|
||||
}
|
||||
type MerchantAdminCodeIn struct {
|
||||
Phone string
|
||||
|
||||
@ -8,21 +8,19 @@ import (
|
||||
|
||||
// User 用户信息
|
||||
type User struct {
|
||||
Id int64 `json:"id" orm:"id,primary"` // 用户ID
|
||||
Username string `json:"username" orm:"username,not null"` // 用户名
|
||||
PasswordHash string `json:"passwordHash" orm:"password_hash,not null"` // 密码哈希
|
||||
Nickname string `json:"nickname" orm:"nickname"` // 昵称
|
||||
Avatar string `json:"avatar" orm:"avatar"` // 头像
|
||||
Phone string `json:"phone" orm:"phone"` // 手机号
|
||||
Email string `json:"email" orm:"email"` // 邮箱
|
||||
Gender int `json:"gender" orm:"gender,default:0"` // 性别:0=未知,1=男,2=女
|
||||
Birthday *gtime.Time `json:"birthday" orm:"birthday"` // 生日
|
||||
Status int `json:"status" orm:"status,default:1"` // 状态:1=正常,2=禁用
|
||||
LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at"` // 最后登录时间
|
||||
LastLoginIp string `json:"lastLoginIp" orm:"last_login_ip"` // 最后登录IP
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at"` // 软删除时间戳
|
||||
Id int64 `json:"id" orm:"id,primary"` // 用户ID
|
||||
Username string `json:"username" orm:"username,not null"` // 用户名
|
||||
Nickname string `json:"nickname" orm:"nickname"` // 昵称
|
||||
Avatar string `json:"avatar" orm:"avatar"` // 头像
|
||||
Phone string `json:"phone" orm:"phone"` // 手机号
|
||||
Email string `json:"email" orm:"email"` // 邮箱
|
||||
Gender int `json:"gender" orm:"gender,default:0"` // 性别:0=未知,1=男,2=女
|
||||
Birthday *gtime.Time `json:"birthday" orm:"birthday"` // 生日
|
||||
Status int `json:"status" orm:"status,default:1"` // 状态:1=正常,2=禁用
|
||||
LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at"` // 最后登录时间
|
||||
LastLoginIp string `json:"lastLoginIp" orm:"last_login_ip"` // 最后登录IP
|
||||
LastLoginStoreId int `json:"lastLoginStoreId" orm:"last_login_store_id"` // 最后登录门店ID
|
||||
LastLoginStoreName string `json:"lastLoginStoreName" orm:"last_login_store_name"` // 最后登录门店名称
|
||||
}
|
||||
|
||||
// UserCreateIn 创建用户请求
|
||||
@ -96,11 +94,11 @@ type UserBindPhoneOut struct {
|
||||
}
|
||||
|
||||
type UserListIn struct {
|
||||
OperatorId int64
|
||||
Role string
|
||||
Nickname string
|
||||
Page int
|
||||
Size int
|
||||
OperatorId int64
|
||||
OperatorRole string
|
||||
Nickname string
|
||||
Page int
|
||||
Size int
|
||||
}
|
||||
type UserListOut struct {
|
||||
List []User
|
||||
|
||||
@ -15,7 +15,7 @@ database:
|
||||
level: "all"
|
||||
stdout: true
|
||||
default:
|
||||
link: "mysql:root:MSms0427@tcp(192.168.3.132:3306)/arenax?loc=Local&charset=utf8mb4"
|
||||
link: "mysql:root:MSms0427@tcp(localhost:3306)/arenax?loc=Local&charset=utf8mb4"
|
||||
debug: true
|
||||
|
||||
# Redis configuration.
|
||||
@ -33,3 +33,7 @@ wechat:
|
||||
appSecret: "4269b5a2bb0274e805b43efb3fbd232a"
|
||||
ticketExpire: 60
|
||||
token: "arenax"
|
||||
|
||||
rsa:
|
||||
publickey: "./manifest/config/public.pem"
|
||||
privatekey: "./manifest/config/private.pem"
|
||||
@ -82,8 +82,7 @@ func init() {
|
||||
}
|
||||
// 商户
|
||||
{
|
||||
// 商户:查
|
||||
// 门店:增删查
|
||||
enforcer.AddPolicy("merchant", "/x/merchant/info", "GET", "获取商户信息")
|
||||
}
|
||||
|
||||
// 管理员
|
||||
|
||||
Reference in New Issue
Block a user