Rest API ,统一使用 CommonResult 做了一次替换~
This commit is contained in:
@@ -36,10 +36,13 @@ public class PassportController {
|
||||
/**
|
||||
* 手机号 + 验证码登陆
|
||||
*
|
||||
* @see #mobileRegister2(String, String) 使用替代
|
||||
*
|
||||
* @param mobile 手机号
|
||||
* @param code 验证码
|
||||
* @return 授权信息
|
||||
*/
|
||||
@Deprecated
|
||||
@PermitAll
|
||||
@PostMapping("/mobile/login")
|
||||
public OAuth2AccessTokenBO mobileRegister(@RequestParam("mobile") String mobile,
|
||||
@@ -96,8 +99,8 @@ public class PassportController {
|
||||
*/
|
||||
@PermitAll
|
||||
@PostMapping("mobile/send")
|
||||
public void mobileSend(@RequestParam("mobile") String mobile) {
|
||||
mobileCodeService.send(mobile);
|
||||
public CommonResult<Void> mobileSend(@RequestParam("mobile") String mobile) {
|
||||
return mobileCodeService.send(mobile);
|
||||
}
|
||||
|
||||
// TODO 功能:qq 登陆
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package cn.iocoder.mall.user.controller;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.sdk.context.SecurityContextHolder;
|
||||
import cn.iocoder.mall.user.vo.UserVO;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -10,9 +12,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class UserController {
|
||||
|
||||
@GetMapping("/info")
|
||||
public Long info() {
|
||||
public CommonResult<UserVO> info() {
|
||||
// TODO 芋艿,正在实现中
|
||||
return SecurityContextHolder.getContext().getUid();
|
||||
UserVO user = new UserVO().setId(SecurityContextHolder.getContext().getUid());
|
||||
return CommonResult.success(user);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.mall.user.vo;
|
||||
|
||||
public class UserVO {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UserVO setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user