手机号授权: 相关类模块转移、补充手机格式校验
This commit is contained in:
@@ -173,6 +173,7 @@ public class CommonUtil {
|
|||||||
* @param phone
|
* @param phone
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean checkIsPhone(String phone) {
|
public static boolean checkIsPhone(String phone) {
|
||||||
if (StringUtils.isEmpty(phone)){
|
if (StringUtils.isEmpty(phone)){
|
||||||
return false;
|
return false;
|
||||||
@@ -251,9 +252,10 @@ public class CommonUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean checkPhoneFormat(String areaCode, String phone) {
|
public static boolean checkPhoneFormat(String areaCode, String phone) {
|
||||||
if (!checkNumberOnly(phone)) {
|
if (!checkNumberOnly(phone) || !checkNumberOnly(areaCode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String realPhone = phone;
|
String realPhone = phone;
|
||||||
if (realPhone.startsWith(areaCode)) {
|
if (realPhone.startsWith(areaCode)) {
|
||||||
realPhone = realPhone.replaceFirst(areaCode, "");
|
realPhone = realPhone.replaceFirst(areaCode, "");
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package com.accompany.business.model.phone;
|
package com.accompany.core.model.phone;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.accompany.business.model.phone;
|
package com.accompany.core.model.phone;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
@@ -1,6 +1,6 @@
|
|||||||
package com.accompany.business.mybatismapper;
|
package com.accompany.core.mybatismapper;
|
||||||
|
|
||||||
import com.accompany.business.model.phone.PhoneAuthApplyRecord;
|
import com.accompany.core.model.phone.PhoneAuthApplyRecord;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
@@ -1,6 +1,7 @@
|
|||||||
package com.accompany.business.mybatismapper;
|
package com.accompany.core.mybatismapper;
|
||||||
|
|
||||||
import com.accompany.business.model.phone.PhoneAuthRecord;
|
import com.accompany.core.model.phone.PhoneAuthApplyRecord;
|
||||||
|
import com.accompany.core.model.phone.PhoneAuthRecord;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
@@ -139,7 +139,7 @@ public class AccountService extends ServiceImpl<AccountMapper, Account> {
|
|||||||
public Boolean updateAccountErbanNo(Long uid, Long erbanNo) {
|
public Boolean updateAccountErbanNo(Long uid, Long erbanNo) {
|
||||||
Account account = getById(uid);
|
Account account = getById(uid);
|
||||||
if (!StringUtils.isEmpty(account)) {
|
if (!StringUtils.isEmpty(account)) {
|
||||||
if (!CommonUtil.checkIsPhone(account.getPhone())) {
|
if (!CommonUtil.checkPhoneFormat(account.getPhoneAreaCode(),account.getPhone())) {
|
||||||
account.setPhone(String.valueOf(erbanNo));
|
account.setPhone(String.valueOf(erbanNo));
|
||||||
}
|
}
|
||||||
account.setErbanNo(erbanNo);
|
account.setErbanNo(erbanNo);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.accompany.business.service.phone;
|
package com.accompany.core.service.phone;
|
||||||
|
|
||||||
import com.accompany.business.model.phone.PhoneAuthApplyRecord;
|
import com.accompany.core.model.phone.PhoneAuthApplyRecord;
|
||||||
import com.accompany.common.device.DeviceInfo;
|
import com.accompany.common.device.DeviceInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
public interface PhoneAuthApplyRecordService extends IService<PhoneAuthApplyRecord> {
|
public interface PhoneAuthApplyRecordService extends IService<PhoneAuthApplyRecord> {
|
||||||
|
|
||||||
|
|
||||||
void apply(String phone, String code, String phoneAreaCode);
|
void applyAuthCode(String phone, String phoneAreaCode);
|
||||||
|
|
||||||
void boundAuthCode(Long uid, String phone, String authCode, String phoneAreaCode, DeviceInfo deviceInfo);
|
void boundAuthCode(Long uid, String phone, String authCode, String phoneAreaCode, DeviceInfo deviceInfo);
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
package com.accompany.business.service.phone;
|
package com.accompany.core.service.phone;
|
||||||
|
|
||||||
import com.accompany.business.model.phone.PhoneAuthRecord;
|
import com.accompany.core.model.phone.PhoneAuthRecord;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,10 +1,10 @@
|
|||||||
package com.accompany.business.service.phone.impl;
|
package com.accompany.core.service.phone.impl;
|
||||||
|
|
||||||
import com.accompany.business.model.phone.PhoneAuthApplyRecord;
|
import com.accompany.core.model.phone.PhoneAuthApplyRecord;
|
||||||
import com.accompany.business.model.phone.PhoneAuthRecord;
|
import com.accompany.core.model.phone.PhoneAuthRecord;
|
||||||
import com.accompany.business.mybatismapper.PhoneAuthApplyRecordMapper;
|
import com.accompany.core.mybatismapper.PhoneAuthApplyRecordMapper;
|
||||||
import com.accompany.business.service.phone.PhoneAuthApplyRecordService;
|
import com.accompany.core.service.phone.PhoneAuthApplyRecordService;
|
||||||
import com.accompany.business.service.phone.PhoneAuthRecordService;
|
import com.accompany.core.service.phone.PhoneAuthRecordService;
|
||||||
import com.accompany.common.constant.Constant;
|
import com.accompany.common.constant.Constant;
|
||||||
import com.accompany.common.device.DeviceInfo;
|
import com.accompany.common.device.DeviceInfo;
|
||||||
import com.accompany.common.redis.RedisKey;
|
import com.accompany.common.redis.RedisKey;
|
||||||
@@ -17,7 +17,6 @@ import com.accompany.core.service.SysConfService;
|
|||||||
import com.accompany.core.service.account.AccountService;
|
import com.accompany.core.service.account.AccountService;
|
||||||
import com.accompany.core.service.common.JedisLockService;
|
import com.accompany.core.service.common.JedisLockService;
|
||||||
import com.accompany.core.service.common.JedisService;
|
import com.accompany.core.service.common.JedisService;
|
||||||
import com.accompany.sms.service.SmsService;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
@@ -43,8 +42,6 @@ public class PhoneAuthApplyRecordServiceImpl extends ServiceImpl<PhoneAuthApplyR
|
|||||||
@Autowired
|
@Autowired
|
||||||
private JedisLockService jedisLockService;
|
private JedisLockService jedisLockService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsService smsService;
|
|
||||||
@Autowired
|
|
||||||
private PhoneAuthRecordService phoneAuthRecordService;
|
private PhoneAuthRecordService phoneAuthRecordService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountService accountService;
|
private AccountService accountService;
|
||||||
@@ -54,8 +51,8 @@ public class PhoneAuthApplyRecordServiceImpl extends ServiceImpl<PhoneAuthApplyR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class, transactionManager = "mybatisplusTransactionManager")
|
@Transactional(rollbackFor = Exception.class, transactionManager = "mybatisplusTransactionManager")
|
||||||
public void apply(String phone, String code, String phoneAreaCode) {
|
public void applyAuthCode(String phone, String phoneAreaCode) {
|
||||||
if (StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)) {
|
if (StringUtils.isEmpty(phone)) {
|
||||||
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
|
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,12 +66,6 @@ public class PhoneAuthApplyRecordServiceImpl extends ServiceImpl<PhoneAuthApplyR
|
|||||||
throw new ServiceException(BusiStatus.SERVER_BUSY);
|
throw new ServiceException(BusiStatus.SERVER_BUSY);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String phoneStr = phoneAreaCode + phone;
|
|
||||||
boolean flag = smsService.verifySmsCode(phoneStr, code);
|
|
||||||
if (flag) {
|
|
||||||
throw new ServiceException(BusiStatus.SMSCODEERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
PhoneAuthApplyRecord applyRecord = getAuthApplyRecord(phone, phoneAreaCode);
|
PhoneAuthApplyRecord applyRecord = getAuthApplyRecord(phone, phoneAreaCode);
|
||||||
if (applyRecord != null) {
|
if (applyRecord != null) {
|
||||||
if (Constant.PhoneAuthApplyStatus.wait_audit.equals(applyRecord.getStatus())) {
|
if (Constant.PhoneAuthApplyStatus.wait_audit.equals(applyRecord.getStatus())) {
|
@@ -1,10 +1,8 @@
|
|||||||
package com.accompany.business.service.phone.impl;
|
package com.accompany.core.service.phone.impl;
|
||||||
|
|
||||||
import com.accompany.business.model.phone.PhoneAuthRecord;
|
import com.accompany.core.model.phone.PhoneAuthRecord;
|
||||||
import com.accompany.business.mybatismapper.PhoneAuthRecordMapper;
|
import com.accompany.core.mybatismapper.PhoneAuthRecordMapper;
|
||||||
import com.accompany.business.service.phone.PhoneAuthRecordService;
|
import com.accompany.core.service.phone.PhoneAuthRecordService;
|
||||||
import com.accompany.common.constant.Constant;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@@ -29,4 +29,11 @@ public interface PhoneBlackService extends IService<PhoneBlack> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean checkIsNeedIntercept(String phone);
|
boolean checkIsNeedIntercept(String phone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查手机号是否需要拦截 => 根据区号 + 手机号检测
|
||||||
|
* @param phone
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean checkIsNeedInterceptWithPhoneAreaCode(String phoneAreaCode,String phone);
|
||||||
}
|
}
|
||||||
|
@@ -369,7 +369,7 @@ public class UsersBaseService extends BaseService {
|
|||||||
Users user = usersMapper.selectByPrimaryKey(uid);
|
Users user = usersMapper.selectByPrimaryKey(uid);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
//如果手机号是平台号,则更换为靓号
|
//如果手机号是平台号,则更换为靓号
|
||||||
if (StringUtils.isBlank(user.getPhone()) || !CommonUtil.checkIsPhone(user.getPhone())) {
|
if (StringUtils.isBlank(user.getPhone()) || !CommonUtil.checkPhoneFormat(user.getPhoneAreaCode(),user.getPhone())) {
|
||||||
user.setPhone(String.valueOf(erbanNo));
|
user.setPhone(String.valueOf(erbanNo));
|
||||||
}
|
}
|
||||||
user.setErbanNo(erbanNo);
|
user.setErbanNo(erbanNo);
|
||||||
|
@@ -49,4 +49,22 @@ public class PhoneBlackServiceImpl extends ServiceImpl<PhoneBlackMapper, PhoneBl
|
|||||||
PhoneBlack phoneBlack = getOne(wrapper);
|
PhoneBlack phoneBlack = getOne(wrapper);
|
||||||
return phoneBlack != null;
|
return phoneBlack != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkIsNeedInterceptWithPhoneAreaCode(String phoneAreaCode,String phone) {
|
||||||
|
if (StringUtils.isBlank(phone)) {
|
||||||
|
throw new ServiceException("手機號不能為空");
|
||||||
|
}
|
||||||
|
if (!CommonUtil.checkPhoneFormat(phoneAreaCode,phone)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String phonePrefix = phone;
|
||||||
|
if (phone.length() > 7) phonePrefix = phone.substring(0, 7);
|
||||||
|
QueryWrapper<PhoneBlack> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.lambda().eq(PhoneBlack::getPhonePrefix, phonePrefix).eq(PhoneBlack::getInterceptStatus, Constant.status.valid)
|
||||||
|
.eq(PhoneBlack::getStatus, Constant.status.valid);
|
||||||
|
PhoneBlack phoneBlack = getOne(wrapper);
|
||||||
|
return phoneBlack != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<mapper namespace="com.accompany.business.model..dao.PhoneAuthApplyRecordMapper">
|
<mapper namespace="com.accompany.business.model..dao.PhoneAuthApplyRecordMapper">
|
||||||
|
|
||||||
<!-- 可根据自己的需求,是否要使用 -->
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
<resultMap type="com.accompany.business.model.phone.PhoneAuthApplyRecord" id="phoneAuthApplyRecordMap">
|
<resultMap type="com.accompany.core.model.phone.PhoneAuthApplyRecord" id="phoneAuthApplyRecordMap">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="phoneAreaCode" column="phone_area_code"/>
|
<result property="phoneAreaCode" column="phone_area_code"/>
|
||||||
<result property="phone" column="phone"/>
|
<result property="phone" column="phone"/>
|
@@ -4,7 +4,7 @@
|
|||||||
<mapper namespace="com.accompany.business.model..dao.PhoneAuthRecordMapper">
|
<mapper namespace="com.accompany.business.model..dao.PhoneAuthRecordMapper">
|
||||||
|
|
||||||
<!-- 可根据自己的需求,是否要使用 -->
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
<resultMap type="com.accompany.business.model.phone.PhoneAuthRecord" id="phoneAuthRecordMap">
|
<resultMap type="com.accompany.core.model.phone.PhoneAuthRecord" id="phoneAuthRecordMap">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="uid" column="uid"/>
|
<result property="uid" column="uid"/>
|
||||||
<result property="phone" column="phone"/>
|
<result property="phone" column="phone"/>
|
@@ -1,16 +1,12 @@
|
|||||||
package com.accompany.business.controller;
|
package com.accompany.business.controller;
|
||||||
|
|
||||||
import com.accompany.business.common.BaseController;
|
import com.accompany.business.common.BaseController;
|
||||||
import com.accompany.business.model.phone.PhoneAuthApplyRecord;
|
|
||||||
import com.accompany.business.service.phone.PhoneAuthApplyRecordService;
|
|
||||||
import com.accompany.common.constant.Constant;
|
|
||||||
import com.accompany.common.constant.SmsTypeEnum;
|
import com.accompany.common.constant.SmsTypeEnum;
|
||||||
import com.accompany.common.device.DeviceInfo;
|
import com.accompany.common.device.DeviceInfo;
|
||||||
import com.accompany.common.result.BusiResult;
|
import com.accompany.common.result.BusiResult;
|
||||||
import com.accompany.common.status.BusiStatus;
|
import com.accompany.common.status.BusiStatus;
|
||||||
import com.accompany.common.utils.CommonUtil;
|
import com.accompany.common.utils.CommonUtil;
|
||||||
import com.accompany.common.utils.IPUitls;
|
import com.accompany.common.utils.IPUitls;
|
||||||
import com.accompany.common.utils.StringUtils;
|
|
||||||
import com.accompany.core.exception.ServiceException;
|
import com.accompany.core.exception.ServiceException;
|
||||||
import com.accompany.core.model.Users;
|
import com.accompany.core.model.Users;
|
||||||
import com.accompany.core.service.user.PhoneBlackService;
|
import com.accompany.core.service.user.PhoneBlackService;
|
||||||
@@ -70,19 +66,19 @@ public class SmsController extends BaseController {
|
|||||||
mobile = userMobile != null && userMobile.length() == 11 ? userMobile : mobile;
|
mobile = userMobile != null && userMobile.length() == 11 ? userMobile : mobile;
|
||||||
}
|
}
|
||||||
logger.info("sendSmsCode2, mobile:{}, type:{}, uid:{}", mobile, type, uid);
|
logger.info("sendSmsCode2, mobile:{}, type:{}, uid:{}", mobile, type, uid);
|
||||||
if (phoneBlackService.checkIsNeedIntercept(mobile)) {
|
if (phoneBlackService.checkIsNeedInterceptWithPhoneAreaCode(phoneAreaCode,mobile)) {
|
||||||
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
|
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
|
||||||
}
|
}
|
||||||
// if (!CommonUtil.checkValidPhone(mobile)) {
|
if (!CommonUtil.checkPhoneFormat(phoneAreaCode,mobile)) {
|
||||||
// return SmsTypeEnum.REGISTER.getValue() == type ? new BusiResult(BusiStatus.SMS_SEND_SUCCESS) :
|
return SmsTypeEnum.REGISTER.getValue() == type ? new BusiResult(BusiStatus.SMS_SEND_SUCCESS) :
|
||||||
// new BusiResult(BusiStatus.PHONE_INVALID);
|
new BusiResult(BusiStatus.PHONE_INVALID);
|
||||||
// }
|
}
|
||||||
return smsService.sendSmsCode(mobile, type, deviceInfo, ip, null);
|
return smsService.sendSmsCode(mobile, type, deviceInfo, ip, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiParam("校验手机验证码")
|
@ApiParam("校验手机验证码")
|
||||||
@RequestMapping(value = "verify")
|
@RequestMapping(value = "verify")
|
||||||
public BusiResult verify(@RequestParam("mobile") String mobile,
|
public BusiResult verify(@RequestParam("mobile") String mobile,@RequestParam("phoneAreaCode") String phoneAreaCode,
|
||||||
@RequestParam("code") String code,HttpServletRequest request) {
|
@RequestParam("code") String code,HttpServletRequest request) {
|
||||||
Long uid = getUid(request);
|
Long uid = getUid(request);
|
||||||
mobile = decryptSensitiveInfo(request, mobile);
|
mobile = decryptSensitiveInfo(request, mobile);
|
||||||
@@ -90,7 +86,7 @@ public class SmsController extends BaseController {
|
|||||||
Users users = usersBaseService.getUsersByUid(uid);
|
Users users = usersBaseService.getUsersByUid(uid);
|
||||||
mobile = users == null ? mobile : users.getPhone();
|
mobile = users == null ? mobile : users.getPhone();
|
||||||
}
|
}
|
||||||
if (!CommonUtil.checkValidPhone(mobile)) {
|
if (!CommonUtil.checkPhoneFormat(phoneAreaCode,mobile)) {
|
||||||
return new BusiResult(BusiStatus.PHONE_INVALID);
|
return new BusiResult(BusiStatus.PHONE_INVALID);
|
||||||
}
|
}
|
||||||
boolean verify = smsService.verifySmsCode(mobile, code);
|
boolean verify = smsService.verifySmsCode(mobile, code);
|
||||||
|
@@ -107,7 +107,7 @@ public class WithdrawController extends BaseController {
|
|||||||
@RequestParam("phoneAreaCode") String phoneAreaCode,
|
@RequestParam("phoneAreaCode") String phoneAreaCode,
|
||||||
HttpServletRequest request) throws Exception{
|
HttpServletRequest request) throws Exception{
|
||||||
phone = decryptSensitiveInfo(request, phone);
|
phone = decryptSensitiveInfo(request, phone);
|
||||||
if (phoneBlackService.checkIsNeedIntercept(phone)) {
|
if (phoneBlackService.checkIsNeedInterceptWithPhoneAreaCode(phoneAreaCode,phone)) {
|
||||||
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
|
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
|
||||||
}
|
}
|
||||||
return new BusiResult(withdrawService.boundPhone(getUid(), phone, code,phoneAreaCode));
|
return new BusiResult(withdrawService.boundPhone(getUid(), phone, code,phoneAreaCode));
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
package com.accompany.business.controller.phone;
|
package com.accompany.business.controller.phone;
|
||||||
|
|
||||||
import com.accompany.business.common.BaseController;
|
import com.accompany.business.common.BaseController;
|
||||||
import com.accompany.business.service.phone.PhoneAuthApplyRecordService;
|
import com.accompany.core.service.phone.PhoneAuthApplyRecordService;
|
||||||
import com.accompany.business.service.phone.PhoneAuthRecordService;
|
|
||||||
import com.accompany.common.annotation.Authorization;
|
import com.accompany.common.annotation.Authorization;
|
||||||
import com.accompany.common.device.DeviceInfo;
|
import com.accompany.common.device.DeviceInfo;
|
||||||
import com.accompany.common.result.BusiResult;
|
import com.accompany.common.result.BusiResult;
|
||||||
@@ -35,11 +34,10 @@ public class PhoneAuthApplyRecordController extends BaseController {
|
|||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "phoneAreaCode", value = "区号", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "phoneAreaCode", value = "区号", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "phone", value = "手机号 如: 178xxxxxxxx", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "phone", value = "手机号 如: 178xxxxxxxx", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "code", value = "验证码", required = true, dataType = "String"),
|
|
||||||
})
|
})
|
||||||
@PostMapping("/apply")
|
@PostMapping("/apply")
|
||||||
public BusiResult apply(String phoneAreaCode, String phone, String code) {
|
public BusiResult apply(String phoneAreaCode, String phone) {
|
||||||
phoneAuthApplyRecordService.apply(phone,code,phoneAreaCode);
|
phoneAuthApplyRecordService.applyAuthCode(phone,phoneAreaCode);
|
||||||
return new BusiResult(BusiStatus.SUCCESS);
|
return new BusiResult(BusiStatus.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +64,7 @@ public class PhoneAuthApplyRecordController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "phone", value = "手机号 如: 178xxxxxxxx", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "phone", value = "手机号 如: 178xxxxxxxx", required = true, dataType = "String"),
|
||||||
})
|
})
|
||||||
@GetMapping("/isBoundPhoneAuthCode")
|
@GetMapping("/isBoundPhoneAuthCode")
|
||||||
public BusiResult apply(String phone,String phoneAreaCode) {
|
public BusiResult isBoundPhoneAuthCode(String phone,String phoneAreaCode) {
|
||||||
Boolean flag = phoneAuthApplyRecordService.isBoundPhoneAuthCode(phone,phoneAreaCode);
|
Boolean flag = phoneAuthApplyRecordService.isBoundPhoneAuthCode(phone,phoneAreaCode);
|
||||||
return new BusiResult(BusiStatus.SUCCESS,flag);
|
return new BusiResult(BusiStatus.SUCCESS,flag);
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,8 @@
|
|||||||
package com.accompany.business.controller.phone;
|
package com.accompany.business.controller.phone;
|
||||||
|
|
||||||
import com.accompany.business.common.BaseController;
|
import com.accompany.business.common.BaseController;
|
||||||
import com.accompany.business.service.phone.PhoneAuthRecordService;
|
import com.accompany.core.service.phone.PhoneAuthRecordService;
|
||||||
import com.accompany.common.result.BusiResult;
|
|
||||||
import com.accompany.common.status.BusiStatus;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@ import com.accompany.core.service.SysConfService;
|
|||||||
import com.accompany.core.service.account.AccountService;
|
import com.accompany.core.service.account.AccountService;
|
||||||
import com.accompany.core.service.common.JedisLockService;
|
import com.accompany.core.service.common.JedisLockService;
|
||||||
import com.accompany.core.service.common.JedisService;
|
import com.accompany.core.service.common.JedisService;
|
||||||
|
import com.accompany.core.service.phone.PhoneAuthApplyRecordService;
|
||||||
import com.accompany.core.service.user.PhoneBlackService;
|
import com.accompany.core.service.user.PhoneBlackService;
|
||||||
import com.accompany.core.util.JwtUtils;
|
import com.accompany.core.util.JwtUtils;
|
||||||
import com.accompany.core.util.KeyStore;
|
import com.accompany.core.util.KeyStore;
|
||||||
@@ -85,6 +86,8 @@ public class AccountController extends BaseController {
|
|||||||
private MyUserDetailsService myUserDetailsService;
|
private MyUserDetailsService myUserDetailsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PhoneBlackService phoneBlackService;
|
private PhoneBlackService phoneBlackService;
|
||||||
|
@Autowired
|
||||||
|
private PhoneAuthApplyRecordService phoneAuthApplyRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过手机号码注册
|
* 通过手机号码注册
|
||||||
|
Reference in New Issue
Block a user