Feat: 登录接口实现
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-04-09 11:48:44 +08:00
parent 0df2aaa82f
commit 35801f5ee9
13 changed files with 160 additions and 39 deletions

View File

@@ -47,3 +47,8 @@ func (r *Response) ErrBadRequest() {
func (r *Response) ErrUnauthorized() {
r.Error(http.StatusUnauthorized, "未登录")
}
// 账号或密码错误
func (r *Response) ErrBadAccPasswd() {
r.Error(serializer.ErrBadLogin, "账号或密码错误")
}

View File

@@ -1,7 +1,7 @@
package dto
import (
"drive-linked/model"
"drive-linked/pkg/model"
"github.com/jinzhu/copier"
)
@@ -15,11 +15,6 @@ type UserProfile struct {
Roles string `json:"roles"`
}
type QueryUserParams struct {
Method string `json:"method"`
Value string `json:"value"`
}
func (u *UserProfile) CopyOf(user *model.User) error {
err := copier.Copy(u, user)
if err != nil {
@@ -27,3 +22,13 @@ func (u *UserProfile) CopyOf(user *model.User) error {
}
return nil
}
type QueryUserParams struct {
Method string `json:"method"`
Value string `json:"value"`
}
type LoginParams struct {
Account string `json:"account"`
Password string `json:"password"`
}