diff --git a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java index 37bf6cf..1e9b22a 100644 --- a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java +++ b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java @@ -57,6 +57,16 @@ public class AuthenticationInterceptor implements HandlerInterceptor { HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); + + TimeRequired timeRequired = method.getAnnotation(TimeRequired.class); + if (timeRequired !=null){ + Calendar calendar = Calendar.getInstance(); + int hour = calendar.get(Calendar.HOUR_OF_DAY); + if (hour<6){ + throw new HttpException(17001); + } + } + LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class); if (methodAnnotation != null) { String authorization = request.getHeader("Authorization"); @@ -102,14 +112,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor { throw new HttpException(1010); } - TimeRequired timeRequired = method.getAnnotation(TimeRequired.class); - if (timeRequired !=null){ - Calendar calendar = Calendar.getInstance(); - int hour = calendar.get(Calendar.HOUR_OF_DAY); - if (hour<6){ - throw new HttpException(17001); - } - } + return true; } diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index 2282e43..54fe8eb 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -63,14 +63,12 @@ public class MemberController { @PostMapping(value = "/login") @ApiOperation("手机端:登录:telephone/手机号, verifyCode/验证码") - @TimeRequired public ResponseVO login(@RequestBody VerifyCodeDTO verifyCodeDTO) { return ResponseData.generateCreatedResponse(0, memberService.login(verifyCodeDTO)); } @PostMapping("passwordLogin") @ApiOperation("手机端:密码登录 { companyId accountName password}") - @TimeRequired public ResponseVO passwordLogin(@RequestBody PasswordLoginDTO passwordLoginDTO){ return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(passwordLoginDTO)); } @@ -89,7 +87,6 @@ public class MemberController { return ResponseData.generateCreatedResponse(0,memberService.kunchiLogin(qingxuetangLoginDTO)); } - @PostMapping("updatePassword") @ApiOperation("修改密码 {id password}") @LoginRequired