- StoreBoss
This commit is contained in:
@@ -82,6 +82,10 @@ func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.A
|
|||||||
if !mobileAuth.IsUserEmpty() {
|
if !mobileAuth.IsUserEmpty() {
|
||||||
return nil, model.ErrCodeUserAlreadyExist, auth2.ErrUserMobileAlreadyExist
|
return nil, model.ErrCodeUserAlreadyExist, auth2.ErrUserMobileAlreadyExist
|
||||||
}
|
}
|
||||||
|
user.Type = model.UserTypeConsumer
|
||||||
|
if inAuthInfo.AuthBindInfo.Type == dingding.AuthTypeStaff {
|
||||||
|
user.Type |= model.UserTypeOperator
|
||||||
|
}
|
||||||
if err = CreateUser(user); err == nil {
|
if err = CreateUser(user); err == nil {
|
||||||
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
||||||
err = auth2.AddAuthBind(outAuthInfo, inAuthInfo)
|
err = auth2.AddAuthBind(outAuthInfo, inAuthInfo)
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ const (
|
|||||||
UserStatusDisabled = 2
|
UserStatusDisabled = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
UserTypeConsumer = 1
|
||||||
|
UserTypeStoreBoss = 2
|
||||||
|
UserTypeOperator = 4
|
||||||
|
UserTypeBoss = 8
|
||||||
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
||||||
@@ -13,15 +20,16 @@ type User struct {
|
|||||||
Mobile string `orm:"size(32)" json:"mobile"`
|
Mobile string `orm:"size(32)" json:"mobile"`
|
||||||
Email string `orm:"size(32);index" json:"email"`
|
Email string `orm:"size(32);index" json:"email"`
|
||||||
Status int8 `json:"status"`
|
Status int8 `json:"status"`
|
||||||
|
Type int8 // 用户类型
|
||||||
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*User) TableUnique() [][]string {
|
func (*User) TableUnique() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"UserID", "DeletedAt"},
|
[]string{"UserID"},
|
||||||
[]string{"UserID2", "DeletedAt"},
|
[]string{"UserID2", "DeletedAt"},
|
||||||
// []string{"Name", "DeletedAt"},
|
// []string{"Name", "DeletedAt"},
|
||||||
[]string{"Mobile", "DeletedAt"},
|
[]string{"Mobile"},
|
||||||
// []string{"Email", "DeletedAt"},
|
// []string{"Email", "DeletedAt"},
|
||||||
// []string{"IDCardNo", "DeletedAt"},
|
// []string{"IDCardNo", "DeletedAt"},
|
||||||
}
|
}
|
||||||
@@ -46,3 +54,31 @@ func (user *User) GetEmail() string {
|
|||||||
func (user *User) GetName() string {
|
func (user *User) GetName() string {
|
||||||
return user.Name
|
return user.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StoreBoss struct {
|
||||||
|
ModelIDCULD
|
||||||
|
UserID string `orm:"size(48);column(user_id);unique" json:"userID"` // 内部唯一标识
|
||||||
|
BossName string `orm:"size(48);index" json:"bossName"` // 门店老板真实姓名
|
||||||
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||||
|
ParentUserID string `orm:"size(48);column(parent_user_id)" json:"-"`
|
||||||
|
|
||||||
|
ReferrerID string `orm:"size(48);index" json:"referrerID"` // 推荐人ID
|
||||||
|
ReferrerName string `orm:"size(48);index" json:"referrerName"` // 推荐人姓名
|
||||||
|
|
||||||
|
CityCode int `json:"cityCode"` // 期望开店所在的城市
|
||||||
|
IDCardFront string `orm:"size(255);column(id_card_front)" json:"idCardFront"`
|
||||||
|
IDCardBack string `orm:"size(255);column(id_card_back)" json:"idCardBack"`
|
||||||
|
IDCardHand string `orm:"size(255);column(id_card_hand)" json:"idCardHand"`
|
||||||
|
Licence string `orm:"size(255)" json:"licence"`
|
||||||
|
LicenceCode string `orm:"size(32);index" json:"licenceCode"`
|
||||||
|
Remark string `orm:"type(text)" json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// const (
|
||||||
|
// PaymentType
|
||||||
|
// )
|
||||||
|
type UserPayment struct {
|
||||||
|
ModelIDCULD
|
||||||
|
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
||||||
|
Type int8 //
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user