Merge branch 'develop' into orders
This commit is contained in:
commit
95e6491de5
|
@ -13,6 +13,7 @@ import (
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ type UserLoginLogic struct {
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
|
|
||||||
token string
|
token string
|
||||||
|
resp *basic.Response
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLoginLogic {
|
func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLoginLogic {
|
||||||
|
@ -36,6 +38,8 @@ func (l *UserLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request) {
|
||||||
if l.token != "" {
|
if l.token != "" {
|
||||||
w.Header().Add("Authorization", fmt.Sprintf("Bearer %s", l.token))
|
w.Header().Add("Authorization", fmt.Sprintf("Bearer %s", l.token))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, l.resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
|
@ -75,6 +79,7 @@ func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.U
|
||||||
}
|
}
|
||||||
|
|
||||||
l.token = jwtToken
|
l.token = jwtToken
|
||||||
|
l.resp = resp.SetStatus(basic.CodeOK, data)
|
||||||
|
|
||||||
// 返回认证成功的状态码以及数据对象 data 和 JWT Token。
|
// 返回认证成功的状态码以及数据对象 data 和 JWT Token。
|
||||||
return resp.SetStatus(basic.CodeOK, data)
|
return resp.SetStatus(basic.CodeOK, data)
|
||||||
|
|
|
@ -109,8 +109,8 @@ type RequestBasicInfoForm struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RequestUserLogin struct {
|
type RequestUserLogin struct {
|
||||||
Email string `form:"email"`
|
Email string `json:"email"`
|
||||||
Password string `form:"password"`
|
Password string `json:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RequestAddAddress struct {
|
type RequestAddAddress struct {
|
||||||
|
|
|
@ -178,8 +178,8 @@ type RequestBasicInfoForm {
|
||||||
|
|
||||||
// UserAddAddressHandler 用户登录请求结构
|
// UserAddAddressHandler 用户登录请求结构
|
||||||
type RequestUserLogin {
|
type RequestUserLogin {
|
||||||
Email string `form:"email"`
|
Email string `json:"email"`
|
||||||
Password string `form:"password"`
|
Password string `json:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestAddAddress 增加地址结构
|
// RequestAddAddress 增加地址结构
|
||||||
|
|
Loading…
Reference in New Issue
Block a user