auth_controller.go
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/service"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
type AuthController struct {
beego.BaseController
}
// Login PC端登录
func (controller *AuthController) Login() {
authService := &service.AuthService{}
loginCommand := &command.LoginCommand{}
_ = controller.Unmarshal(loginCommand)
resp, err := authService.Login(loginCommand)
controller.Response(resp, err)
}
// 获取个人信息
func (controller *AuthController) User() {
userAuth := controller.Ctx.Input.GetData(domain.UserAuth{}).(*domain.UserAuth)
authService := &service.AuthService{}
param := &command.GetMeInfo{
UserId: userAuth.UserId,
CompanyId: userAuth.CompanyId,
}
resp, err := authService.MeInfo(param)
controller.Response(resp, err)
}
// Login 手机端登录
func (controller *AuthController) MobileLogin() {
authService := &service.AuthService{}
loginCommand := &command.MobileLoginCommand{}
_ = controller.Unmarshal(loginCommand)
resp, err := authService.MobileLogin(loginCommand)
controller.Response(resp, err)
}