|
@@ -60,59 +60,15 @@ public class UserLiveController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxCUserAuthorityService wxCUserAuthorityService; |
|
|
private WxCUserAuthorityService wxCUserAuthorityService; |
|
|
|
|
|
|
|
|
// @AuthIgnore |
|
|
|
|
|
// @ApiOperation("验证码") |
|
|
|
|
|
// @GetMapping("/captcha.jpg") |
|
|
|
|
|
// public void captcha(HttpServletResponse response) { |
|
|
|
|
|
// logger.debug("[" + getIpAddr() + "] WxUserGrantController::captcha"); |
|
|
|
|
|
// response.setHeader("Cache-Control", "no-store, no-cache"); |
|
|
|
|
|
// response.setContentType("image/jpeg"); |
|
|
|
|
|
// |
|
|
|
|
|
// //生成文字验证码 |
|
|
|
|
|
// String text = producer.createText(); |
|
|
|
|
|
// //生成图片验证码 |
|
|
|
|
|
// BufferedImage image = producer.createImage(text); |
|
|
|
|
|
// |
|
|
|
|
|
// //保存到redis |
|
|
|
|
|
// String ipAddr = getIpAddr(); |
|
|
|
|
|
// String key = Constant.captchaPrev + ":" + ipAddr; |
|
|
|
|
|
// RedisCacheUtils.cache(redisTemplate, key, text, 60); |
|
|
|
|
|
// |
|
|
|
|
|
// ServletOutputStream out = null; |
|
|
|
|
|
// try { |
|
|
|
|
|
// out = response.getOutputStream(); |
|
|
|
|
|
// ImageIO.write(image, "jpg", out); |
|
|
|
|
|
// } catch (IOException e) { |
|
|
|
|
|
// e.printStackTrace(); |
|
|
|
|
|
// } finally { |
|
|
|
|
|
// IOUtils.closeQuietly(out); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
@AuthIgnore |
|
|
@PostMapping("/login") |
|
|
@PostMapping("/login") |
|
|
@ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"Mcode\":\"string\",\"status\":\"int\"}") |
|
|
|
|
|
|
|
|
@ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"status\":\"int\"}") |
|
|
public Map<String,Object> login(@RequestBody Map<String, String> map, HttpServletResponse response) { |
|
|
public Map<String,Object> login(@RequestBody Map<String, String> map, HttpServletResponse response) { |
|
|
Map<String,Object> wxCLiveLoginVos = new HashMap<>(); |
|
|
Map<String,Object> wxCLiveLoginVos = new HashMap<>(); |
|
|
String ipAddr = getIpAddr(); |
|
|
String ipAddr = getIpAddr(); |
|
|
logger.debug("[" + ipAddr + "] WxUserGrantController::login"); |
|
|
logger.debug("[" + ipAddr + "] WxUserGrantController::login"); |
|
|
String code = map.get("code"); |
|
|
|
|
|
if (StringUtils.isBlank(code)) { |
|
|
|
|
|
HashMap<Object, Object> status = new HashMap<>(); |
|
|
|
|
|
status.put("code",ErrorCode.SYS_PARAMETER_NOT_NULL.getCode()); |
|
|
|
|
|
status.put("message","请输入验证码"); |
|
|
|
|
|
wxCLiveLoginVos.put("status",status); |
|
|
|
|
|
return wxCLiveLoginVos; |
|
|
|
|
|
// new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "请输入验证码"); |
|
|
|
|
|
} |
|
|
|
|
|
String key = Constant.captchaPrev + ":" + ipAddr; |
|
|
|
|
|
String code1 = RedisCacheUtils.getCacheString(redisTemplate, key); |
|
|
|
|
|
// if (StringUtils.isBlank(code1)) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码已过期"); |
|
|
|
|
|
// } |
|
|
|
|
|
// if (!code1.equals(code)) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码不正确"); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
String phone = map.get("username"); |
|
|
String phone = map.get("username"); |
|
|
String password = map.get("password"); |
|
|
String password = map.get("password"); |
|
|
if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) { |
|
|
if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) { |
|
@@ -148,7 +104,7 @@ public class UserLiveController extends BaseController { |
|
|
|
|
|
|
|
|
if (statu == 0) { |
|
|
if (statu == 0) { |
|
|
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); |
|
|
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); |
|
|
if (basicLiveInfo.getCode() != null && !map.get("Mcode").equals(basicLiveInfo.getCode())) { |
|
|
|
|
|
|
|
|
if (basicLiveInfo.getCode() != null && !map.get("code").equals(basicLiveInfo.getCode())) { |
|
|
HashMap<Object, Object> status = new HashMap<>(); |
|
|
HashMap<Object, Object> status = new HashMap<>(); |
|
|
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode()); |
|
|
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode()); |
|
|
status.put("message","用户已在其他设备登录"); |
|
|
status.put("message","用户已在其他设备登录"); |
|
@@ -157,7 +113,7 @@ public class UserLiveController extends BaseController { |
|
|
// return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录"); |
|
|
// return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录"); |
|
|
} |
|
|
} |
|
|
if (basicLiveInfo.getCode() == null) { |
|
|
if (basicLiveInfo.getCode() == null) { |
|
|
wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("Mcode")); |
|
|
|
|
|
|
|
|
wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("code")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (statu == -1) { |
|
|
if (statu == -1) { |
|
@@ -178,7 +134,7 @@ public class UserLiveController extends BaseController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WxCLiveLoginVo wxCLiveLoginVo = new WxCLiveLoginVo(); |
|
|
WxCLiveLoginVo wxCLiveLoginVo = new WxCLiveLoginVo(); |
|
|
wxCLiveLoginVo.setCode(Integer.parseInt(map.get("Mcode"))); |
|
|
|
|
|
|
|
|
wxCLiveLoginVo.setCode(Integer.parseInt(map.get("code"))); |
|
|
//wxCLiveLoginVo.setVersion(basicLiveInfo.getVersion()); |
|
|
//wxCLiveLoginVo.setVersion(basicLiveInfo.getVersion()); |
|
|
wxCLiveLoginVo.setUsername(map.get("username")); |
|
|
wxCLiveLoginVo.setUsername(map.get("username")); |
|
|
//wxCLiveLoginVo.setStatus(0); |
|
|
//wxCLiveLoginVo.setStatus(0); |
|
|