Commit 735b38d8 authored by Java—KA—李 青's avatar Java—KA—李 青

删除/register/fast接口

parent d450557c
...@@ -245,7 +245,7 @@ public class UserController implements IBaseController { ...@@ -245,7 +245,7 @@ public class UserController implements IBaseController {
} }
private User registerFastWhenLogin(String phoneNo, Long channelId, Long registerFrom, String appChannel, Long btRegisterChannelId,String dimension) { private User registerFastWhenLogin(String phoneNo, Long channelId, Long registerFrom, String appChannel, Long btRegisterChannelId,String dimension) {
String password = PasswordUtil.generateRandomPwd(); String password = PasswordUtil.generateRandomPwd(15);
LOGGER.info("用户快速注册, phoneNo:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId", phoneNo, channelId, registerFrom, appChannel,btRegisterChannelId); LOGGER.info("用户快速注册, phoneNo:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId", phoneNo, channelId, registerFrom, appChannel,btRegisterChannelId);
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo); LOGGER.info("用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
...@@ -300,50 +300,6 @@ public class UserController implements IBaseController { ...@@ -300,50 +300,6 @@ public class UserController implements IBaseController {
return result; return result;
} }
/**
* 用户快速注册
*
* @param phoneNo
* @param verificationCode
* @param channelId
* @return
*/
@LogHttpCaller
@RequestMapping("/register/fast")
public JsonResult registerFast(@RequestParam String phoneNo, @RequestParam String verificationCode, @RequestParam(required = false) Long channelId,
@RequestParam(required = false) Long registerFrom, @RequestParam(required = false, defaultValue = "") String appChannel,
@RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false)String dimension) {
String password = PasswordUtil.generateRandomPwd();
LOGGER.info("用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId:{},dimension:{}", phoneNo, verificationCode, channelId, registerFrom, appChannel,btRegisterChannelId,dimension);
if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
return JsonResult.buildErrorStateResult("手机号错误", null);
}
if (StringUtils.isEmpty(password)) {
LOGGER.info("用户快速注册失败,密码不能为空, registerFrom:{}, phoneNo:{}, password:{}", registerFrom, phoneNo, password);
return JsonResult.buildErrorStateResult("密码不能为空", null);
}
if (password.length() < 6 || password.length() > 12) {
LOGGER.info("用户快速注册失败,密码长度须在6位至12位之间, registerFrom:{}, phoneNo:{}, password:{}", registerFrom, phoneNo, password);
return JsonResult.buildErrorStateResult("密码应为6-12位", null);
}
if (null == registerFrom) {
registerFrom = 1L;
}
smsValidForFastLogin(phoneNo, verificationCode);
if (userService.exist(phoneNo)) {
LOGGER.info("用户快速注册失败,该手机号已经被注册, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
return JsonResult.buildErrorStateResult("该手机号已经被注册", null);
}
if (!userService.register(phoneNo, password, registerFrom, getIp(), channelId,btRegisterChannelId,dimension)) {
LOGGER.info("用户快速注册失败,请稍后重试, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
return JsonResult.buildErrorStateResult("注册失败,请稍后重试", null);
}
LOGGER.info("用户快速注册成功, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
return JsonResult.buildSuccessResult(null, null);
}
/** /**
* 用户注册 * 用户注册
* *
......
package cn.quantgroup.xyqb.util; package cn.quantgroup.xyqb.util;
import com.google.common.base.Preconditions;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
...@@ -40,15 +42,17 @@ public class PasswordUtil { ...@@ -40,15 +42,17 @@ public class PasswordUtil {
/** /**
* 生成随机密码 * 生成随机密码
* @param pwdLen 密码长度,必须大于0
* @return * @return
*/ */
public static String generateRandomPwd() { public static String generateRandomPwd(int pwdLen) {
Preconditions.checkArgument(pwdLen > 0);
int pwdMax = PWD_BASE.length; int pwdMax = PWD_BASE.length;
int i; // 生成的随机数 int i; // 生成的随机数
int count = 0; // 生成的密码的长度 int count = 0; // 生成的密码的长度
StringBuffer pwd = new StringBuffer(); StringBuffer pwd = new StringBuffer();
while (count < 15) { while (count < pwdLen) {
i = Math.abs(ThreadLocalRandom.current().nextInt(pwdMax)); // 生成的数最大为36-1 i = ThreadLocalRandom.current().nextInt(pwdMax); // 生成的数最大为36-1
if (i >= 0 && i < PWD_BASE.length) { if (i >= 0 && i < PWD_BASE.length) {
pwd.append(PWD_BASE[i]); pwd.append(PWD_BASE[i]);
count++; count++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment