auth_controller.go
1.3 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
43
44
45
46
package mobile_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/auth/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/auth/service"
)
type AuthController struct {
baseController
}
func (controller *AuthController) Login() {
authService := service.AuthService{}
loginCmd := &command.LoginCommand{}
err := controller.Unmarshal(loginCmd)
if err != nil {
controller.Response(nil, err)
return
}
data, err := authService.AuthLogin(loginCmd)
controller.Response(data, err)
}
func (controller *AuthController) GetAuthAccessToken() {
authService := service.AuthService{}
accessTokenCommand := &command.AccessTokenCommand{}
err := controller.Unmarshal(accessTokenCommand)
if err != nil {
controller.Response(nil, err)
return
}
data, err := authService.GetAuthAccessToken(accessTokenCommand)
controller.Response(data, err)
}
func (controller *AuthController) RefreshAuthAccessToken() {
authService := service.AuthService{}
refreshTokenCmd := &command.RefreshTokenCommand{}
err := controller.Unmarshal(refreshTokenCmd)
if err != nil {
controller.Response(nil, err)
return
}
data, err := authService.RefreshAuthAccessToken(refreshTokenCmd)
controller.Response(data, err)
}