Merge branch 'develop' into orders

This commit is contained in:
Hiven
2023-07-24 19:15:33 +08:00
98 changed files with 490 additions and 145 deletions

View File

@@ -31,7 +31,7 @@ func NewUserEmailRegisterLogic(ctx context.Context, svcCtx *svc.ServiceContext)
// }
// 处理逻辑后 w,r 如:重定向
// func (l *UserEmailRegisterLogic) AfterLogic(w http.ResponseWriter, r *http.Request) {
// func (l *UserEmailRegisterLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// }
func (l *UserEmailRegisterLogic) UserEmailRegister(req *types.RequestEmailRegister, userinfo *auth.UserInfo) (resp *basic.Response) {

View File

@@ -45,7 +45,7 @@ func NewUserGoogleLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *U
// log.Println(r, w)
// }
func (l *UserGoogleLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request) {
func (l *UserGoogleLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
rurl := fmt.Sprintf(
l.svcCtx.Config.MainAddress+"/oauth?token=%s&is_registered=%t&register_token=%s",

View File

@@ -23,7 +23,6 @@ type UserLoginLogic struct {
svcCtx *svc.ServiceContext
token string
resp *basic.Response
}
func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLoginLogic {
@@ -34,12 +33,12 @@ func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLog
}
}
func (l *UserLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request) {
func (l *UserLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
if l.token != "" {
w.Header().Add("Authorization", fmt.Sprintf("Bearer %s", l.token))
}
httpx.OkJsonCtx(r.Context(), w, l.resp)
httpx.OkJsonCtx(r.Context(), w, resp)
}
func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.UserInfo) (resp *basic.Response) {
@@ -79,7 +78,6 @@ func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.U
}
l.token = jwtToken
l.resp = resp.SetStatus(basic.CodeOK, data)
// 返回认证成功的状态码以及数据对象 data 和 JWT Token。
return resp.SetStatus(basic.CodeOK, data)