初始化项目框架,完成部分接口开发
This commit is contained in:
18
internal/controller/auth/auth_v1_user_login.go
Normal file
18
internal/controller/auth/auth_v1_user_login.go
Normal file
@ -0,0 +1,18 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
"server/api/auth/v1"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) UserLogin(ctx context.Context, req *v1.UserLoginReq) (res *v1.UserLoginRes, err error) {
|
||||
out, err := service.User().Login(ctx, &model.UserLoginIn{Email: req.Email, Password: req.Password})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.UserLoginRes{Token: out.Token}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user