用户模块的 API 梳理下,统一使用加上注解
This commit is contained in:
parent
4b0038759f
commit
e431530107
@ -21,7 +21,7 @@ public class MVCConfiguration implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口
|
registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,7 @@ import cn.iocoder.mall.user.service.api.UserService;
|
|||||||
import cn.iocoder.mall.user.service.api.bo.OAuth2AccessTokenBO;
|
import cn.iocoder.mall.user.service.api.bo.OAuth2AccessTokenBO;
|
||||||
import cn.iocoder.mall.user.vo.MobileRegisterVO;
|
import cn.iocoder.mall.user.vo.MobileRegisterVO;
|
||||||
import com.alibaba.dubbo.config.annotation.Reference;
|
import com.alibaba.dubbo.config.annotation.Reference;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("user/passport")
|
@RequestMapping("user/passport")
|
||||||
|
@Api("Passport 模块")
|
||||||
public class PassportController {
|
public class PassportController {
|
||||||
|
|
||||||
@Reference
|
@Reference
|
||||||
@ -48,13 +50,10 @@ public class PassportController {
|
|||||||
return PassportConvert.INSTANCE.convert(result);
|
return PassportConvert.INSTANCE.convert(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送手机验证码
|
|
||||||
*
|
|
||||||
* @param mobile 手机号
|
|
||||||
*/
|
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@PostMapping("mobile/send")
|
@PostMapping("mobile/send")
|
||||||
|
@ApiOperation(value = "发送手机验证码")
|
||||||
|
@ApiImplicitParam(name = "mobile", value = "手机号", required = true, example = "15601691300")
|
||||||
public CommonResult<Void> mobileSend(@RequestParam("mobile") String mobile) {
|
public CommonResult<Void> mobileSend(@RequestParam("mobile") String mobile) {
|
||||||
return mobileCodeService.send(mobile);
|
return mobileCodeService.send(mobile);
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,23 @@ package cn.iocoder.mall.user.controller;
|
|||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.user.sdk.context.SecurityContextHolder;
|
import cn.iocoder.mall.user.sdk.context.SecurityContextHolder;
|
||||||
import cn.iocoder.mall.user.vo.UserVO;
|
import cn.iocoder.mall.user.vo.UserInfoVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
|
@Api("用户模块")
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
public CommonResult<UserVO> info() {
|
@ApiOperation(value = "用户信息")
|
||||||
|
public CommonResult<UserInfoVO> info() {
|
||||||
// TODO 芋艿,正在实现中
|
// TODO 芋艿,正在实现中
|
||||||
UserVO user = new UserVO().setId(SecurityContextHolder.getContext().getUid());
|
UserInfoVO user = new UserInfoVO().setId(SecurityContextHolder.getContext().getUid());
|
||||||
return CommonResult.success(user);
|
return CommonResult.success(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package cn.iocoder.mall.user.vo;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
@ApiModel("手机注册结果VO")
|
@ApiModel("手机注册结果 VO")
|
||||||
public class MobileRegisterVO {
|
public class MobileRegisterVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "访问令牌", required = true, example = "2e3d7635c15e47e997611707a237859f")
|
@ApiModelProperty(value = "访问令牌", required = true, example = "2e3d7635c15e47e997611707a237859f")
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.mall.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
@ApiModel("用户信息 VO")
|
||||||
|
public class UserInfoVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编号", required = true, example = "123")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserInfoVO setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user