feat:优化项目结构

This commit is contained in:
henry
2021-11-24 10:50:09 +08:00
parent f007168919
commit 0862142ef0
25 changed files with 306 additions and 203 deletions

View File

@ -1,8 +1,11 @@
package api
import (
account2 "SciencesServer/app/api/enterprise/controller/account"
"SciencesServer/app/api/enterprise/controller/account"
"SciencesServer/app/basic/api"
"SciencesServer/app/service"
"SciencesServer/app/session"
"SciencesServer/config"
"github.com/gin-gonic/gin"
)
@ -32,7 +35,7 @@ func (a *Account) Login(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
data, err := account2.NewLogin()(api.GetLocal()(c).(string)).Launch(account2.LoginMode(form.Mode), &account2.LoginParams{
data, err := account.NewLogin()(api.GetLocal()(c).(string)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
Captcha: struct {
Mobile string
Captcha string
@ -52,7 +55,7 @@ func (a *Account) Register(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
data, err := account2.NewRegister()(api.GetLocal()(c).(string)).Launch(&account2.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,
})
@ -63,16 +66,14 @@ func (*Account) Authorize(c *gin.Context) {
}
func (*Account) BindMobile(c *gin.Context) {
//account.NewOther()().BindMobile()
}
func (*Account) Logout(c *gin.Context) {
// 因跳过中间键故只能自己去获取token用户信息
//token := c.GetHeader(config.APIRequestToken)
token := c.GetHeader(config.APIRequestToken)
//session, _ := service.NewAuthToken(token).Auth()
_session := session.NewEnterprise()
err := account2.NewLogout()(nil).Launch()
_ = service.NewAuthToken(token).Auth(_session)
err := account.NewLogout()(_session).Launch()
api.APIResponse(err)(c)
}