| | |
| | | |
| | | JSONObject userResult = JSONObject.parseObject(responseEntity.getBody()); |
| | | int total = userResult.getIntValue("total"); |
| | | |
| | | JSONObject paramOut = new JSONObject(); |
| | | JSONObject userInfo = paramIn.getJSONObject("userInfo"); |
| | | |
| | | if (total == 0) { |
| | | //保存用户信息 |
| | | JSONObject registerInfo = new JSONObject(); |
| | | /*JSONObject registerInfo = new JSONObject(); |
| | | |
| | | //设置默认密码 |
| | | String userDefaultPassword = MappingCache.getValue(MappingConstant.KEY_STAFF_DEFAULT_PASSWORD); |
| | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new IllegalArgumentException("根绝openId 查询用户信息异常" + openId); |
| | | } |
| | | userResult = JSONObject.parseObject(responseEntity.getBody()); |
| | | userResult = JSONObject.parseObject(responseEntity.getBody());*/ |
| | | paramOut.put("openId", openId); |
| | | paramOut.put("msg", "还没有注册请先注册"); |
| | | responseEntity = new ResponseEntity<String>(paramOut.toJSONString(), HttpStatus.UNAUTHORIZED); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | JSONObject realUserInfo = userResult.getJSONArray("users").getJSONObject(0); |
| | |
| | | userMap.put(CommonConstant.LOGIN_USER_ID, userInfo.getString("userId")); |
| | | userMap.put(CommonConstant.LOGIN_USER_NAME, userInfo.getString("name")); |
| | | String token = AuthenticationFactory.createAndSaveToken(userMap); |
| | | JSONObject paramOut = new JSONObject(); |
| | | |
| | | paramOut.put("result", 0); |
| | | paramOut.put("userInfo", userInfo); |
| | | paramOut.put("token", token); |