Commit fb1161a03bfd4c067db9431baf657d45d5ca2677
1 parent
2cdd6ca7ba
Exists in
master
and in
8 other branches
platform permission
fix bug
Showing 2 changed files with 9 additions and 9 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java
View file @
fb1161a
| ... | ... | @@ -64,7 +64,7 @@ |
| 64 | 64 | return null; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public static boolean sendVerCode(String phone, String typeId, String token) { | |
| 67 | + public static LoginContext sendVerCode(String phone, String typeId, String token) { | |
| 68 | 68 | HttpClient client = new HttpClient(); |
| 69 | 69 | String query = "?phone=" + phone + "&typeId=" + typeId + "&token=" + token + "&userType=2"; |
| 70 | 70 | GetMethod get = new MessageUtil.UTF8GetMethod("http://passport.healthbaby.com.cn/v1/vercode.action" + query); |
| 71 | 71 | |
| ... | ... | @@ -77,14 +77,12 @@ |
| 77 | 77 | get.releaseConnection(); |
| 78 | 78 | if(200 == statusCode) { |
| 79 | 79 | LoginContext loginState = JsonUtil.str2Obj(result, LoginContext.class); |
| 80 | - if(0 == loginState.getErrorcode()) { | |
| 81 | - return true; | |
| 82 | - } | |
| 80 | + return loginState; | |
| 83 | 81 | } |
| 84 | 82 | } catch (Exception e) { |
| 85 | 83 | e.printStackTrace(); |
| 86 | 84 | } |
| 87 | - return false; | |
| 85 | + return null; | |
| 88 | 86 | } |
| 89 | 87 | |
| 90 | 88 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
fb1161a
| ... | ... | @@ -154,11 +154,13 @@ |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| 157 | - if(LoginUtil.sendVerCode(phone, typeId, token) ) { | |
| 158 | - ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SUCCESS, "发送成功"); | |
| 159 | - } else { | |
| 160 | - ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SUCCESS, "发送失败"); | |
| 157 | + LoginContext loginContext = LoginUtil.sendVerCode(phone, typeId, token); | |
| 158 | + if(null != loginContext) { | |
| 159 | + ResultUtils.buildResultAndWrite(httpServletResponse, loginContext.getErrorcode(), loginContext.getErrormsg()); | |
| 160 | + return; | |
| 161 | 161 | } |
| 162 | + ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SYSTEM_ERROR, "服务器内部错误"); | |
| 163 | + | |
| 162 | 164 | } |
| 163 | 165 | |
| 164 | 166 |