Commit e93888d8 authored by liqin's avatar liqin 💬

Merge branch 'master' of http://111.203.232.171:8888/licc/shop-mall into master

parents 9258ced6 cc1a4120
......@@ -131,36 +131,36 @@ public class LoginController {
@ApiImplicitParam(name = "sms", value = "验证码",required = true, dataType = "String")
})
@RequestMapping("/register")
public Map register(@RequestParam String userId,@RequestParam String beInvitedCode, @RequestParam String sms) {
public Map register(@RequestParam String userId,@RequestParam String beInvitedCode, @RequestParam String sms)throws Exception {
User users=null;
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
try {
throw new BaseException(ResultEnum.FAIL_VERIFY);
} catch (BaseException e) {
// try {
// throw new BaseException(ResultEnum.FAIL_VERIFY);
//
// } catch (BaseException e) {
Map map=new HashMap();
map.put("code","1003");
map.put("msg","验证码错误");
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return map;
}
// }
}
redisUtils.delete(key);
//判断phone是否符合输入类型
if(!userId.matches(Constants.RegConstant.PHONE_REGSTR)){
try {
throw new BaseException(ResultEnum.PHONE_ERROR);
} catch (BaseException e) {
e.printStackTrace();
// try {
// throw new BaseException(ResultEnum.PHONE_ERROR);
// } catch (BaseException e) {
// e.printStackTrace();
Map map=new HashMap();
map.put("code","1008");
map.put("msg","手机号码格式不正确");
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return map;
}
// }
}
return usersService.userByZx(userId,beInvitedCode);
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.enums.ResultEnum;
import cn.wisenergy.common.utils.*;
import cn.wisenergy.web.sms.BaseException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -19,7 +17,7 @@ import java.util.Map;
@Api(tags = "发送手机验证码 codeType 0注册/登录验证 1修改密码 2订单通知信息")
@Slf4j
@RequestMapping("/api/sms")
@RequestMapping("/api/sms/")
@RestController
public class SmsController {
......@@ -46,25 +44,14 @@ public class SmsController {
Map map=new HashMap();
//判断phone和codeType是否符合输入类型
if(!phone.matches(Constants.RegConstant.PHONE_REGSTR)){
try {
throw new BaseException(ResultEnum.PHONE_ERROR);
} catch (BaseException e) {
e.printStackTrace();
map.put("code","1005");
map.put("msg","账号不存在,请注册");
return (Result) map;
}
return ResultUtils.returnFail ("手机号码格式不正确","1009") ;
}
if(codeType!=Constants.Sms.CodeType.LOGIN_OR_REGISTER && codeType!=Constants.Sms.CodeType.PASS_UPDATE && codeType!=Constants.Sms.CodeType.ORDER_NOTICE){
try {
throw new BaseException(ResultEnum.CODETYPE_ERROR);
} catch (BaseException e) {
e.printStackTrace();
map.put("code","1009");
map.put("msg","手机号码格式不正确");
return (Result) map;
}
return ResultUtils.returnFail ("输入codeType不正确!","1008") ;
}
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,phone,codeType+"");
......
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