Rest API ,统一使用 CommonResult 做了一次替换~

This commit is contained in:
YunaiV
2019-02-26 00:58:58 +08:00
parent 4162eda377
commit 6cbce27412
11 changed files with 63 additions and 22 deletions

View File

@@ -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 登陆

View File

@@ -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);
}
}

View File

@@ -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;
}
}