- first edition of auth2
This commit is contained in:
30
business/model/auth2.go
Normal file
30
business/model/auth2.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
AuthBindStatusNormal = 1
|
||||
AuthBindStatusDisabled = 2
|
||||
)
|
||||
|
||||
type AuthBind struct {
|
||||
ModelIDCULD
|
||||
|
||||
UserID string `orm:"size(48);column(user_id)" json:"userID"`
|
||||
Type string `orm:"size(16)" json:"type"`
|
||||
Status int8 `json:"status"`
|
||||
|
||||
AuthID string `orm:"size(48);index" json:"authID"`
|
||||
AuthID2 string `orm:"size(48);index" json:"authID2"`
|
||||
AuthSecret string `orm:"size(48)" json:"authSecret"`
|
||||
AuthSecret2 string `orm:"size(48)" json:"authSecret2"`
|
||||
Remark string `orm:"size(255)" json:"remark"`
|
||||
DetailData string `orm:"type(text)" json:"-"`
|
||||
|
||||
UserData interface{} `orm:"-" json:"-"`
|
||||
}
|
||||
|
||||
func (*AuthBind) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"UserID", "Type", "DeletedAt"},
|
||||
[]string{"AuthID", "Type", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
11
business/model/dao/dao_auth2.go
Normal file
11
business/model/dao/dao_auth2.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package dao
|
||||
|
||||
import "git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
func GetAuthBind(db *DaoDB, userID, authType, authID, authID2 string) (authBind *model.AuthBind, err error) {
|
||||
return authBind, err
|
||||
}
|
||||
|
||||
func GetAuthBindsByWXUnionID(db *DaoDB, unionID string) (authBinds []*model.AuthBind, err error) {
|
||||
return authBinds, err
|
||||
}
|
||||
43
business/model/user.go
Normal file
43
business/model/user.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package model
|
||||
|
||||
type User struct {
|
||||
ModelIDCULD
|
||||
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
||||
UserID2 string `orm:"size(48);column(user_id2)" json:"userID2"` // 外部唯一标识(一般用于登录)
|
||||
Name string `orm:"size(48)" json:"name"` // 外部唯一显示 标识(一般用于显示)
|
||||
Mobile string `orm:"size(32)" json:"mobile"`
|
||||
Email string `orm:"size(32)" json:"email"`
|
||||
Status int8 `json:"status"`
|
||||
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
||||
}
|
||||
|
||||
func (*User) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"UserID", "DeletedAt"},
|
||||
[]string{"UserID2", "DeletedAt"},
|
||||
[]string{"Name", "DeletedAt"},
|
||||
[]string{"Mobile", "DeletedAt"},
|
||||
[]string{"Email", "DeletedAt"},
|
||||
[]string{"IDCardNo", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
func (user *User) GetID() string {
|
||||
return user.UserID
|
||||
}
|
||||
|
||||
func (user *User) GetID2() string {
|
||||
return user.UserID2
|
||||
}
|
||||
|
||||
func (user *User) GetMobile() string {
|
||||
return user.Mobile
|
||||
}
|
||||
|
||||
func (user *User) GetEmail() string {
|
||||
return user.Email
|
||||
}
|
||||
|
||||
func (user *User) GetName() string {
|
||||
return user.Name
|
||||
}
|
||||
Reference in New Issue
Block a user