调整商户注册逻辑
This commit is contained in:
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user