提交 da30bf67 authored 作者: chenxinchang's avatar chenxinchang

--no commit message

上级 0a4d1447
......@@ -149,6 +149,39 @@ public class FgPermissionsController {
llService.save(form.getAccount(), ip, 1, form.getChannel(), "账号密码登录");
return CallBack.success(info);
}
@ApiOperation(value = "快速登录", notes = "0:登录成功;2:验证码不能为空;3:验证码有误;msg返回错误次数;5:该账户已禁用;")
@PostMapping(value = MemberRequestPath.PHONE+ MemberRequestPath.LOGIN)
public CallBack<LoginMemberInfo> phoneLogin(@RequestBody LoginForm form,HttpServletRequest request) throws BaseException, Exception {
if (StringUtils.isBlank(form.getAccount()) ) {
throw new BaseException(1,"手机号不能为空");
}
String ip = CusAccessObjectUtil.getIpAddress(request);
if (form.getCode() == null) {
throw new BaseException(2,"验证码不能为空");
}
String redisCode = redis.get(form.getAccount());
if (form.getCode() == null || redisCode == null || !form.getCode().toLowerCase().equals(redisCode.toLowerCase())) {
llService.save(form.getAccount(), ip, 0, form.getChannel(), "验证码有误");
throw new BaseException(3,"验证码有误");
}
redis.delete(form.getAccount());
Member m = mService.login(form.getAccount());
if(m == null) {
m = mService.loginPhone(form.getAccount());
}
if (m.getStatus() == 0) {
llService.save(form.getAccount(), ip, 0, form.getChannel(), "账号已被禁用,请联系网站管理员!");
throw new BaseException(5,"账号已被禁用,请联系网站管理员!");
}
LoginMemberInfo info = mService.isLevelLogin(m);
String token = MD5Util.getEncoderByMd5(m.getAccount());
info.setToken(token);
redis.set(token, info);
llService.save(form.getAccount(), ip, 1, form.getChannel(), "快速登录");
return CallBack.success(info);
}
@ApiOperation(value = "微信用户登录 登录渠道 0 PC,1 WAP,2 Android,3 iOS", notes = "0:登录成功;5:该账户已禁用;6:第三方登录错误;7:未绑定平台账号")
@GetMapping(value =MemberRequestPath.WECHAT + MemberRequestPath.LOGIN)
public CallBack<LoginMemberInfo> wechartLogin(@RequestParam("code")String code,Integer channel,HttpServletRequest request) throws BaseException, Exception {
......@@ -410,6 +443,30 @@ public class FgPermissionsController {
}
return CallBack.success("发送成功"+code,sendPhoneCount);
}
@ApiOperation(value = "发送手机短信 登录时使用", notes = "0:成功;16:60s内不能再次发送;;18:短信验证码发送失败;")
@GetMapping(value = MemberRequestPath.LOGIN + MemberRequestPath.CODE)
public CallBack<String> loginCode(String phone) throws Exception{
if(!mService.isExistByPhone(null, phone)) {
throw new BaseException(99,"手机号未注册");
}
String sendTime = phone+"login";
if(redis.get(sendTime) != null) {
throw new BaseException(16,"60s内不能再次发送");
}
SdkSmsForm ssf = new SdkSmsForm();
ssf.setMobile(phone);
String code = PasswordUtil.createPassword(6, 1);
ssf.setContent("您的验证码是:"+code+",在5分钟内有效。如非本人操作请忽略本短信。");
CallBack<String> sms = sdkSmsClient.send(ssf);
if(sms!=null && sms.isStatus()){
redis.set(phone, code,60*5,TimeUnit.SECONDS);
redis.set(sendTime, "60", 60);
}else{
throw new BaseException(18,"短信验证码发送失败");
}
return CallBack.success("发送成功"+code);
}
@ApiOperation(value = "重置密码-1 发送手机短信", notes = "0:成功;16:60s内不能再次发送;18:短信验证码发送失败;")
@GetMapping(value = MemberRequestPath.PASSWORD+1)
public CallBack<String> resetPassword1(String phone) throws Exception{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论