Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
3ce81d9c
Commit
3ce81d9c
authored
Nov 10, 2019
by
macro
Browse files
添加会员登录接口
parent
287276c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
mall-portal/src/main/java/com/macro/mall/portal/controller/UmsMemberController.java
View file @
3ce81d9c
...
...
@@ -5,12 +5,16 @@ import com.macro.mall.portal.service.UmsMemberService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 会员登录注册管理Controller
* Created by macro on 2018/8/3.
...
...
@@ -19,10 +23,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Api
(
tags
=
"UmsMemberController"
,
description
=
"会员登录注册管理"
)
@RequestMapping
(
"/sso"
)
public
class
UmsMemberController
{
@Value
(
"${jwt.tokenHead}"
)
private
String
tokenHead
;
@Autowired
private
UmsMemberService
memberService
;
@ApiOperation
(
"注册"
)
@ApiOperation
(
"
会员
注册"
)
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
register
(
@RequestParam
String
username
,
...
...
@@ -32,6 +38,21 @@ public class UmsMemberController {
return
memberService
.
register
(
username
,
password
,
telephone
,
authCode
);
}
@ApiOperation
(
"会员登录"
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
login
(
@RequestParam
String
username
,
@RequestParam
String
password
)
{
String
token
=
memberService
.
login
(
username
,
password
);
if
(
token
==
null
)
{
return
CommonResult
.
validateFailed
(
"用户名或密码错误"
);
}
Map
<
String
,
String
>
tokenMap
=
new
HashMap
<>();
tokenMap
.
put
(
"token"
,
token
);
tokenMap
.
put
(
"tokenHead"
,
tokenHead
);
return
CommonResult
.
success
(
tokenMap
);
}
@ApiOperation
(
"获取验证码"
)
@RequestMapping
(
value
=
"/getAuthCode"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment