Documentation ¶
Index ¶
- Constants
- Variables
- func DBInit(dbAlias, dbTablePrefix string)
- func GetUserIdByExternalId(exType, exID, exPassword string) (userId int64, err error)
- func GetUserLoginTypesByUserId(userId int64) (ret map[string]*UserLoginTypes, err error)
- func InitWechatConfig()
- func RegisterModel()
- type User
- type UserLoginTypes
- type UserSignAuth
- type VerifyCode
- type WX
Constants ¶
View Source
const ( SessionKeyUser = "user" SessionKeyWXResAccessToken = "wxResAccessToken" SessionKeyVerifyCode = "verifyCode" )
View Source
const ( HeaderUserType = "Nb-User-Type" HeaderNBSign = "Nb-Sign" )
View Source
const ( NBSignTypeMd5Sign = "md5sign" SignParamTS = "ts" SignParamUserId = "userId" SignParamSign = "sign" SignParamRequestBody = "requestbody" SignParamSecretKey = "_secretKey_" CtxInputDataKeyUser = "user" )
View Source
const ( UserTypeWX = "wechat" UserTypeEmail = "email" UserTypeUnkown = "unkown" )
View Source
const ( AuthLoginWXCallbackURI = "/api/u/login/wxcb" AuthLoginWXCallbackSuccKey = "succcb" AuthLoginWXCallbackPlaceholdOnSucc = "SUCC_REDIRECT" AuthLoginWXCallbackErrKey = "errcb" AuthLoginWXCallbackPlaceholdOnErr = "ERR_REDIRECT" )
View Source
const ( ErrCodeBadRequest = 400 ErrCodeNotLogin = 401 ErrCodeGeneralError = 507 ErrCodeUnkownError = 599 )
Variables ¶
View Source
var ( ErrGeneralServerError = errors.New("service error, please try again") ErrUnkownError = errors.New("got unkown error, please concat admin") )
Functions ¶
func GetUserIdByExternalId ¶
func GetUserLoginTypesByUserId ¶
func GetUserLoginTypesByUserId(userId int64) (ret map[string]*UserLoginTypes, err error)
func InitWechatConfig ¶
func InitWechatConfig()
func RegisterModel ¶
func RegisterModel()
Types ¶
type User ¶
type User struct { Id int64 `json:"id"` Name string `json:"name"` Sex int32 `json:"sex"` //1 男性; 2 女性; 0 未知 Province string `json:"province"` City string `json:"city"` Country string `json:"country"` HeadImgURL string `json:"headimgurl" orm:"column(headimgurl)"` Created time.Time `json:"created" orm:"auto_now_add;type(datetime)"` Updated time.Time `json:"updated" orm:"auto_now;type(datetime)"` UserTypes map[string]*UserLoginTypes `json:"userTypes" orm:"-"` }
func GetUserById ¶
type UserLoginTypes ¶
type UserSignAuth ¶
type UserSignAuth struct { Id int64 `json:"id"` UserId int64 `json:"userId" orm:"unique"` SecretKey string `json:"secretKey"` Created time.Time `json:"created" orm:"auto_now_add;type(datetime)"` Updated time.Time `json:"updated" orm:"auto_now;type(datetime)"` }
func GetUserSignByUserId ¶
func GetUserSignByUserId(userId int64) (usa *UserSignAuth, err error)
type VerifyCode ¶
func (*VerifyCode) GenerateNew ¶
func (self *VerifyCode) GenerateNew()
func (*VerifyCode) NotifyBody ¶
func (self *VerifyCode) NotifyBody() string
func (*VerifyCode) NotifyTitle ¶
func (self *VerifyCode) NotifyTitle() string
func (*VerifyCode) Verify ¶
func (self *VerifyCode) Verify(code string) bool
Click to show internal directories.
Click to hide internal directories.