feat:完善信息
This commit is contained in:
@ -8,10 +8,10 @@ import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Login struct{ local uint64 }
|
||||
type Login struct{ local string }
|
||||
|
||||
type (
|
||||
LoginHandle func(local uint64) *Login
|
||||
LoginHandle func(local string) *Login
|
||||
)
|
||||
|
||||
type (
|
||||
@ -38,12 +38,12 @@ const (
|
||||
LoginModeForQQ // QQ登陆
|
||||
)
|
||||
|
||||
var loginHandle = map[LoginMode]func(*LoginParams, uint64) (*InstanceLoginParams, error){
|
||||
var loginHandle = map[LoginMode]func(*LoginParams, string) (*InstanceLoginParams, error){
|
||||
LoginModeForSmsCaptcha: loginForSmsCaptcha, LoginModeForPassword: loginForPassword,
|
||||
}
|
||||
|
||||
// loginForSmsCaptcha 短信验证码登陆
|
||||
func loginForSmsCaptcha(params *LoginParams, local uint64) (*InstanceLoginParams, error) {
|
||||
func loginForSmsCaptcha(params *LoginParams, local string) (*InstanceLoginParams, error) {
|
||||
if !utils.ValidateMobile(params.Captcha.Mobile) {
|
||||
return nil, errors.New("手机号码格式异常")
|
||||
}
|
||||
@ -87,7 +87,7 @@ RETURNS:
|
||||
}
|
||||
|
||||
// loginForPassword 密码登陆
|
||||
func loginForPassword(params *LoginParams, local uint64) (*InstanceLoginParams, error) {
|
||||
func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams, error) {
|
||||
if !utils.ValidateMobile(params.Password.Mobile) {
|
||||
return nil, errors.New("手机号码格式异常")
|
||||
}
|
||||
@ -140,7 +140,7 @@ func (c *Login) Launch(mode LoginMode, params *LoginParams) (*InstanceLoginRetur
|
||||
}
|
||||
|
||||
func NewLogin() LoginHandle {
|
||||
return func(local uint64) *Login {
|
||||
return func(local string) *Login {
|
||||
return &Login{local: local}
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Register struct{ local uint64 }
|
||||
type Register struct{ local string }
|
||||
|
||||
type RegisterHandle func(local uint64) *Register
|
||||
type RegisterHandle func(local string) *Register
|
||||
|
||||
type (
|
||||
RegisterParams struct {
|
||||
@ -29,7 +29,7 @@ func (c *RegisterParams) checkCaptcha() (bool, error) {
|
||||
return handle.NewCaptcha().Validate(&handle.CaptchaSms{Captcha: c.Captcha, Mobile: c.Mobile})
|
||||
}
|
||||
|
||||
func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, local uint64) (bool, error) {
|
||||
func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, local string) (bool, error) {
|
||||
var count int64
|
||||
|
||||
if err := model2.Count(mUserInstance, &count, model2.NewWhere("mobile", c.Mobile),
|
||||
@ -88,7 +88,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
}
|
||||
|
||||
func NewRegister() RegisterHandle {
|
||||
return func(local uint64) *Register {
|
||||
return func(local string) *Register {
|
||||
return &Register{local: local}
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
// Instance 技术管理
|
||||
type Instance struct {
|
||||
*service.SessionEnterprise
|
||||
local uint64
|
||||
local string
|
||||
}
|
||||
|
||||
type InstanceHandle func(enterprise *service.SessionEnterprise, local uint64) *Instance
|
||||
type InstanceHandle func(enterprise *service.SessionEnterprise, local string) *Instance
|
||||
|
||||
type (
|
||||
// InstanceInfo 详细信息
|
||||
@ -157,7 +157,7 @@ func (c *Instance) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(enterprise *service.SessionEnterprise, local uint64) *Instance {
|
||||
return func(enterprise *service.SessionEnterprise, local string) *Instance {
|
||||
return &Instance{enterprise, local}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Paper 论文管理
|
||||
type Paper struct {
|
||||
*service.SessionEnterprise
|
||||
local uint64
|
||||
local string
|
||||
}
|
||||
|
||||
type PaperHandle func(enterprise *service.SessionEnterprise, local uint64) *Paper
|
||||
type PaperHandle func(enterprise *service.SessionEnterprise, local string) *Paper
|
||||
|
||||
type (
|
||||
PaperInfo struct {
|
||||
@ -113,7 +113,7 @@ func (c *Paper) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewPaper() PaperHandle {
|
||||
return func(enterprise *service.SessionEnterprise, local uint64) *Paper {
|
||||
return func(enterprise *service.SessionEnterprise, local string) *Paper {
|
||||
return &Paper{enterprise, local}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user