diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/config/MVCConfiguration.java b/user/user-application/src/main/java/cn/iocoder/mall/user/config/MVCConfiguration.java index 653579f76..2994a78e0 100644 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/config/MVCConfiguration.java +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/config/MVCConfiguration.java @@ -21,7 +21,7 @@ public class MVCConfiguration implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { -// registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口 + registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口 } @Override diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/controller/PassportController.java b/user/user-application/src/main/java/cn/iocoder/mall/user/controller/PassportController.java index b97ed44d9..d68898914 100644 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/controller/PassportController.java +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/controller/PassportController.java @@ -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.vo.MobileRegisterVO; import com.alibaba.dubbo.config.annotation.Reference; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("user/passport") +@Api("Passport 模块") public class PassportController { @Reference @@ -48,13 +50,10 @@ public class PassportController { return PassportConvert.INSTANCE.convert(result); } - /** - * 发送手机验证码 - * - * @param mobile 手机号 - */ @PermitAll @PostMapping("mobile/send") + @ApiOperation(value = "发送手机验证码") + @ApiImplicitParam(name = "mobile", value = "手机号", required = true, example = "15601691300") public CommonResult mobileSend(@RequestParam("mobile") String mobile) { return mobileCodeService.send(mobile); } diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/controller/UserController.java b/user/user-application/src/main/java/cn/iocoder/mall/user/controller/UserController.java index f7d78d6d6..d84c797a6 100644 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/controller/UserController.java +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/controller/UserController.java @@ -2,19 +2,23 @@ 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 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.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/user") +@Api("用户模块") public class UserController { @GetMapping("/info") - public CommonResult info() { + @ApiOperation(value = "用户信息") + public CommonResult info() { // TODO 芋艿,正在实现中 - UserVO user = new UserVO().setId(SecurityContextHolder.getContext().getUid()); + UserInfoVO user = new UserInfoVO().setId(SecurityContextHolder.getContext().getUid()); return CommonResult.success(user); } diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/vo/MobileRegisterVO.java b/user/user-application/src/main/java/cn/iocoder/mall/user/vo/MobileRegisterVO.java index f0f960f9c..ce8334cb5 100644 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/vo/MobileRegisterVO.java +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/vo/MobileRegisterVO.java @@ -3,7 +3,7 @@ package cn.iocoder.mall.user.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -@ApiModel("手机注册结果VO") +@ApiModel("手机注册结果 VO") public class MobileRegisterVO { @ApiModelProperty(value = "访问令牌", required = true, example = "2e3d7635c15e47e997611707a237859f") diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/vo/UserInfoVO.java b/user/user-application/src/main/java/cn/iocoder/mall/user/vo/UserInfoVO.java new file mode 100644 index 000000000..5d416d0d9 --- /dev/null +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/vo/UserInfoVO.java @@ -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; + } + +} \ No newline at end of file diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/vo/UserVO.java b/user/user-application/src/main/java/cn/iocoder/mall/user/vo/UserVO.java deleted file mode 100644 index 4766053f4..000000000 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/vo/UserVO.java +++ /dev/null @@ -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; - } - -} \ No newline at end of file