|
|
@@ -169,6 +169,7 @@ public class WxUserGrantController extends BaseController { |
|
|
|
} |
|
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
|
Map resultMap = new HashMap(); |
|
|
|
resultMap.put("phone", basicInfo.getPhone()); |
|
|
|
resultMap.put("token", basicInfo.getToken()); |
|
|
|
return new ResultData(resultMap); |
|
|
|
} |
|
|
@@ -218,6 +219,7 @@ public class WxUserGrantController extends BaseController { |
|
|
|
} |
|
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
|
Map resultMap = new HashMap(); |
|
|
|
resultMap.put("phone", basicInfo.getPhone()); |
|
|
|
resultMap.put("token", basicInfo.getToken()); |
|
|
|
return new ResultData(resultMap); |
|
|
|
} else { |
|
|
@@ -225,6 +227,50 @@ public class WxUserGrantController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
@ApiOperation(value = "手机验证码修改密码", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
|
@PostMapping("/updPass") |
|
|
|
public ResultData updPass(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doLoginByPhone"); |
|
|
|
// String phone,String code,String pwd |
|
|
|
String phone = params.get("phone"); |
|
|
|
String code = params.get("code"); |
|
|
|
String pwd = params.get("pwd"); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(code)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(pwd)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// check 验证码正确 |
|
|
|
boolean isValidCode = false; |
|
|
|
try { |
|
|
|
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
} |
|
|
|
if(isValidCode) { |
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); |
|
|
|
if(basicInfo == null){ |
|
|
|
basicInfo = wxCUserBasicInfoService.registerByPhone(getTenantInfo(),phone,null,null,null,null); |
|
|
|
} |
|
|
|
String encryptPassword = PasswordHelper.encryptPassword(phone, pwd); |
|
|
|
WxCUserBasicInfo basicInfoUpd = new WxCUserBasicInfo(); |
|
|
|
basicInfoUpd.setId(basicInfo.getId()); |
|
|
|
basicInfoUpd.setPassword(encryptPassword); |
|
|
|
wxCUserBasicInfoService.update(basicInfoUpd); |
|
|
|
return new ResultData(); |
|
|
|
} else { |
|
|
|
return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("登出") |
|
|
|
@GetMapping("/logout") |
|
|
|
public ResultData logout() { |
|
|
|