feat:完善信息
This commit is contained in:
@ -2,9 +2,9 @@ package config
|
||||
|
||||
// Area 区域
|
||||
type Area struct {
|
||||
Province uint64 `json:"province" form:"province"`
|
||||
City uint64 `json:"city" form:"city"`
|
||||
District uint64 `json:"district" form:"district"`
|
||||
Province string `json:"province" form:"province"`
|
||||
City string `json:"city" form:"city"`
|
||||
District string `json:"district" form:"district"`
|
||||
Address string `json:"address" form:"address"`
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ func (m *Images) AnalysisSlice(domain string) []string {
|
||||
}
|
||||
|
||||
type Local struct {
|
||||
Local uint64 `gorm:"column:local;type:int(11);default:0;comment:数据位置来源" json:"-"`
|
||||
Local string `gorm:"column:local;type:varchar(8);default:null;comment:数据位置来源" json:"-"`
|
||||
}
|
||||
|
||||
// AccountStatus 账号状态
|
||||
@ -102,9 +102,9 @@ const (
|
||||
)
|
||||
|
||||
type Area struct {
|
||||
Province uint64 `gorm:"column:province;type:int;default:0;comment:所在省" json:"province"`
|
||||
City uint64 `gorm:"column:city;type:int;default:0;comment:所在市" json:"city"`
|
||||
District uint64 `gorm:"column:district;type:int;default:0;comment:所在区/县" json:"district"`
|
||||
Province string `gorm:"column:province;type:varchar(8);default:null;comment:所在省" json:"province"`
|
||||
City string `gorm:"column:city;type:varchar(8);default:null;comment:所在市" json:"city"`
|
||||
District string `gorm:"column:district;type:varchar(8);default:null;comment:所在区/县" json:"district"`
|
||||
Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"`
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ func (a *Account) Login(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account.NewLogin()(api.GetLocal()(c).(uint64)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
|
||||
data, err := account.NewLogin()(api.GetLocal()(c).(string)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
|
||||
Captcha: struct {
|
||||
Mobile string
|
||||
Captcha string
|
||||
@ -53,7 +53,7 @@ func (a *Account) Register(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account.NewRegister()(api.GetLocal()(c).(uint64)).Launch(&account.RegisterParams{
|
||||
data, err := account.NewRegister()(api.GetLocal()(c).(string)).Launch(&account.RegisterParams{
|
||||
Name: form.Name, Mobile: form.Mobile, Captcha: form.Captcha,
|
||||
Password: form.Password, RepeatPass: form.RepeatPass, Identity: form.Identity,
|
||||
})
|
||||
|
@ -31,7 +31,7 @@ func (a *Technology) Paper(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
|
||||
data, err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -43,7 +43,7 @@ func (a *Technology) PaperAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.PaperParams{
|
||||
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
|
||||
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
|
||||
@ -60,7 +60,7 @@ func (a *Technology) PaperEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.PaperParams{
|
||||
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
|
||||
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
|
||||
@ -75,7 +75,7 @@ func (a *Technology) PaperDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -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