ソースを参照

Merge remote-tracking branch 'origin/master'

zhangbin 4 年 前
コミット
2359702cef

+ 18 - 27
hzgzpt-admin/src/main/java/com/miaxis/app/controller/user/UserInfoController.java

@@ -1,5 +1,6 @@
 package com.miaxis.app.controller.user;
 
+import com.miaxis.app.file.vo.FileVo;
 import com.miaxis.app.user.dto.UserDto;
 import com.miaxis.app.user.service.IUserInfoService;
 import com.miaxis.app.user.vo.UserVo;
@@ -20,9 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 【用户信息】Controller
@@ -100,13 +99,14 @@ public class UserInfoController extends BaseController{
     })
     public Response uploadIdCardAndHeadPicture(String type,MultipartFile multFile) throws IOException {
         String savePath = AliyunConfig.gzpt_user + type + "/"
-                + new SimpleDateFormat("yyyyMM").format(new Date()) + "/";
-        String fileName = System.currentTimeMillis() + ".jpg";
+                + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "/";
+        String fileName = System.currentTimeMillis() + ".jpg";//文件名
         String fileUrl = AliyunUpload.uploadForStream(multFile.getInputStream(), savePath, fileName);
-        Map<String, Object> map = new HashMap<>();
-        map.put("filePath",savePath+fileName);//文件路径名
-        map.put("fileUrl",fileUrl);//文件访问路径
-        return Response.success(map);
+        FileVo fileVo = new FileVo();
+        fileVo.setFileName(fileName);
+        fileVo.setFilePath(savePath+fileName);
+        fileVo.setFileUrl(fileUrl);
+        return Response.success(fileVo);
     }
 
     /**
@@ -129,11 +129,8 @@ public class UserInfoController extends BaseController{
     @PostMapping("/saveUserInformation")
     @ApiOperation("保存用户报名信息")
     public Response saveUserInformation(UserDto userDto) {
-        try {
-            return userInfoService.saveUserInformation(userDto);
-        }catch (Exception e){
-            return Response.error();
-        }
+
+        return userInfoService.saveUserInformation(userDto);
     }
 
     /**
@@ -141,14 +138,11 @@ public class UserInfoController extends BaseController{
      * @return
      */
     @ApiOperation("注册报名获取短信验证码")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "type",value = "login:用户登录验证码、modify:修改手机验证码、signUp:注册报名验证码" ,dataType = "String",required = true),
-            @ApiImplicitParam(name = "phone", value = "手机号码", required = true, dataType = "String")
-    })
+    @ApiImplicitParam(name = "phone",value = "手机号码" ,dataType = "String",required = true)
     @PostMapping(value = "/sendSignUpVerificationCode")
-    public Response sendSignUpVerificationCode(String type,String phone){
+    public Response sendSignUpVerificationCode(String phone){
 
-        return userInfoService.sendSignUpVerificationCode(type,phone);
+        return userInfoService.sendSignUpVerificationCode(phone);
     }
 
     /**
@@ -156,16 +150,13 @@ public class UserInfoController extends BaseController{
      * @return
      */
     @ApiOperation("修改手机号获取短信验证码")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "type",value = "login:用户登录验证码、modify:修改手机验证码、signUp:注册报名验证码" ,dataType = "String",required = true),
-            @ApiImplicitParam(name = "phone", value = "手机号码", required = true, dataType = "String")
-    })
+    @ApiImplicitParam(name = "phone",value = "手机号码" ,dataType = "String",required = true)
     @PostMapping(value = "/sendModifyVerificationCode")
-    public Response sendModifyVerificationCode(String type,String phone){
+    public Response sendModifyVerificationCode(String phone){
         //获取当前用户
         SysUser user = SecurityUtils.getLoginUser().getUser();
 
-        return userInfoService.sendModifyVerificationCode(user,type,phone);
+        return userInfoService.sendModifyVerificationCode(user,phone);
     }
 
 
@@ -179,11 +170,11 @@ public class UserInfoController extends BaseController{
             @ApiImplicitParam(name = "phone", value = "手机号码", required = true, dataType = "String"),
             @ApiImplicitParam(name = "verificationCode", value = "短信验证码", required = true, dataType = "String")
     })
-    public Response modifyPhoneNumber(String smsCodeType,String phone,String verificationCode){
+    public Response modifyPhoneNumber(String phone,String verificationCode){
         //获取当前用户
         SysUser user = SecurityUtils.getLoginUser().getUser();
         //修改手机号
-        return userInfoService.modifyPhoneNumber(smsCodeType,phone,verificationCode,user);
+        return userInfoService.modifyPhoneNumber(phone,verificationCode,user);
     }
 
     /**

+ 24 - 10
hzgzpt-common/src/main/java/com/miaxis/common/utils/RedisPrefixUtils.java

@@ -1,7 +1,6 @@
 package com.miaxis.common.utils;
 
-import java.util.HashMap;
-import java.util.Map;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 
 /**
  * redis前缀生成工具
@@ -14,18 +13,33 @@ public class RedisPrefixUtils {
     /**
      * 生成短信验证码redis前缀
      * keyPrefix : 验证码缓存前缀
-     * smsKeyCountPrefix :该手机号验证次数缓存前缀
      * @return
      */
-    public static Map<String,String> smsRedisPrefix(String type, String phone){
-        String keyPrefix = "sms:code:"+type+":"+phone;
-        String smsKeyCountPrefix = "sms:code:count:"+type+":"+phone;
+    public static String getSmsKeyPrefix(String type, String phone){
 
-        Map<String, String> map = new HashMap<>();
-        map.put("keyPrefix",keyPrefix);
-        map.put("smsKeyCountPrefix",smsKeyCountPrefix);
+        if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(phone)){
+            String keyPrefix = "sms:code:"+type+":"+phone;
+            return keyPrefix;
+        }
+        return null;
+    }
+
+    /**
+     * 生成短信验证码redis前缀
+     *  smsKeyCountPrefix :该手机号验证次数缓存前缀
+     * @param type
+     * @param phone
+     * @return
+     */
+    public static String getSmsKeyCountPrefix(String type, String phone){
 
-        return map;
+        if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(phone)){
+            String smsKeyCountPrefix = "sms:code:count:"+type+":"+phone;
+            return smsKeyCountPrefix;
+        }
+        return null;
     }
 
+
+
 }

+ 1 - 3
hzgzpt-framework/src/main/java/com/miaxis/framework/web/service/SysLoginService.java

@@ -24,7 +24,6 @@ import org.springframework.security.core.Authentication;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.Map;
 
 /**
  * 登录校验方法
@@ -118,8 +117,7 @@ public class SysLoginService
         if (StringUtils.isEmpty(credential)){
             throw new CustomException("验证码不能为空");
         }
-        Map map = (Map)RedisPrefixUtils.smsRedisPrefix("login", principal);
-        String  cacheCode = (String) redisTemplate.opsForValue().get(map.get("keyPrefix"));
+        String cacheCode = (String) redisTemplate.opsForValue().get(RedisPrefixUtils.getSmsKeyPrefix("login", principal));
         if (StringUtils.isEmpty(cacheCode)){
             throw new CustomException("验证码已过期,请重新发送");
         }else if (!credential.equals(cacheCode)){

+ 27 - 0
hzgzpt-service-app/src/main/java/com/miaxis/app/file/vo/FileVo.java

@@ -0,0 +1,27 @@
+package com.miaxis.app.file.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 文件上传vo
+ *
+ * @Author wwl
+ * @Date 2021/1/4
+ * @Version 1.0
+ */
+@Data
+public class FileVo implements Serializable {
+
+    @ApiModelProperty(value = "文件名")
+    private String fileName;
+
+    @ApiModelProperty(value = "文件路径")
+    private String filePath;
+
+    @ApiModelProperty(value = "文件访问路径")
+    private String fileUrl;
+
+}

+ 1 - 1
hzgzpt-service-app/src/main/java/com/miaxis/app/sms/domain/SmsParameter.java

@@ -16,7 +16,7 @@ public class SmsParameter implements Serializable {
     /** 手机号码 */
     private String phone;
 
-    /** 发送短信类型(登录验证、修改手机号验证...) */
+    /** 发送短信类型(login:用户登录验证码、modify:修改手机验证码、signUp:注册报名验证码) */
     private String type;
 
     /** 缓存key前缀 */

+ 13 - 14
hzgzpt-service-app/src/main/java/com/miaxis/app/sms/impl/SmsServiceImpl.java

@@ -4,7 +4,7 @@ import com.miaxis.app.sms.ISmsService;
 import com.miaxis.app.sms.domain.SmsParameter;
 import com.miaxis.common.constant.SmsTemplateConstants;
 import com.miaxis.common.core.domain.Response;
-import com.miaxis.common.core.domain.ResponseEnum;
+import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.sms.Client;
 import com.miaxis.common.utils.RedisPrefixUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,7 +15,6 @@ import org.springframework.stereotype.Service;
 import java.net.URLEncoder;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
@@ -33,7 +32,7 @@ public class SmsServiceImpl implements ISmsService {
 
     private final String MOBILE_REGEX = "^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\\d{8}$";//手机号码验证
     private final Integer SMS_MAX_COUNT = 500 ;//每天系统发送最大次数(预留)
-    private final Integer MAX_COUNT = 50 ;//每个手机号验证发送最大次数
+    private final Integer MAX_COUNT = 5 ;//每个手机号验证发送最大次数
     private final long SEND_INTERVAL = 3 ;//发送间隔时间
 
 
@@ -62,25 +61,26 @@ public class SmsServiceImpl implements ISmsService {
                 .filter(str -> str.equals(smsParameter.getType()))
                 .collect(Collectors.toList());
         if (collect.size()==0){
-            return Response.error(500,"参数{type}类型错误");
+            throw new CustomException("参数{type}类型错误!");
         }
 
         //手机号格式验证
         if(smsParameter.getPhone().length() != 11){
-            return Response.error(500,"手机格式错误");
+            throw new CustomException("手机格式错误!");
         } else {
             Pattern pattern = Pattern.compile(MOBILE_REGEX);
             Matcher matcher = pattern.matcher(smsParameter.getPhone());
             if(!matcher.matches()) {
-                return Response.error(500,"手机号格式错误");
+                throw new CustomException("手机号格式错误!");
             }
         }
         try{
 
             //生成redis 验证码key前缀 验证次数key前缀
-            Map<String, String> map = RedisPrefixUtils.smsRedisPrefix(smsParameter.getType(), smsParameter.getPhone());
-            smsParameter.setKeyPrefix(map.get("keyPrefix"));
-            smsParameter.setVerificationCount(map.get("smsKeyCountPrefix"));
+            String smsKeyPrefix = RedisPrefixUtils.getSmsKeyPrefix(smsParameter.getType(), smsParameter.getPhone());
+            String smsKeyCountPrefix = RedisPrefixUtils.getSmsKeyCountPrefix(smsParameter.getType(), smsParameter.getPhone());
+            smsParameter.setKeyPrefix(smsKeyPrefix);
+            smsParameter.setVerificationCount(smsKeyCountPrefix);
 
             if ("login".equals(smsParameter.getType())){
                 smsParameter.setSmsTemplateConstants(SmsTemplateConstants.login);
@@ -146,10 +146,9 @@ public class SmsServiceImpl implements ISmsService {
                 Info = "未知错误";
             }
 
-            return Response.error(500,Info);
+            throw new CustomException(Info);
         } catch (Exception e) {
-            e.printStackTrace();
-            return Response.error(ResponseEnum.ERROR);
+            throw new CustomException(e.getMessage());
         }
     }
 
@@ -166,13 +165,13 @@ public class SmsServiceImpl implements ISmsService {
         if(redisTemplate.hasKey(smsParameter.getVerificationCount())){
             // 验证发送时间
             if (redisTemplate.hasKey(smsParameter.getKeyPrefix())){
-                return Response.error(500,"验证码还未过期,不能重新发送!");
+                throw new CustomException("验证码还未过期,不能重新发送!",500);
             }
 
             // 验证发送次数
             Integer count = Integer.valueOf(redisTemplate.opsForValue().get(smsParameter.getVerificationCount()).toString());
             if(count >= MAX_COUNT) {
-                return Response.error(500,"当前手机号发送验证码次数过多!");
+                throw new CustomException("当前手机号发送验证码次数过多!",500);
             }
         }
         return Response.success();

+ 0 - 3
hzgzpt-service-app/src/main/java/com/miaxis/app/user/dto/UserDto.java

@@ -71,9 +71,6 @@ public class UserDto extends BaseBusinessEntity {
     @ApiModelProperty(value = "人像图片路径")
     private String facesPath;
 
-    @ApiModelProperty(value = "获取短信验证码类型")
-    private String smsCodeType;
-
     @ApiModelProperty(value = "短信验证码")
     private String verificationCode;
 }

+ 3 - 5
hzgzpt-service-app/src/main/java/com/miaxis/app/user/service/IUserInfoService.java

@@ -44,7 +44,7 @@ public interface IUserInfoService extends IService<UserInfo>{
      * @param verificationCode
      * @return
      */
-    Response modifyPhoneNumber(String smsCodeType,String phone, String verificationCode,SysUser user);
+    Response modifyPhoneNumber(String phone, String verificationCode,SysUser user);
 
     /**
      * 保存用户报名信息
@@ -55,20 +55,18 @@ public interface IUserInfoService extends IService<UserInfo>{
 
     /**
      * 注册报名获取短信验证码
-     * @param type
      * @param phone
      * @return
      */
-    Response sendSignUpVerificationCode(String type, String phone);
+    Response sendSignUpVerificationCode(String phone);
 
     /**
      * 修改手机号获取短信验证码
      * @param user
-     * @param type
      * @param phone
      * @return
      */
-    Response sendModifyVerificationCode(SysUser user, String type, String phone);
+    Response sendModifyVerificationCode(SysUser user, String phone);
 
 
     /**

+ 88 - 91
hzgzpt-service-app/src/main/java/com/miaxis/app/user/service/impl/UserInfoServiceImpl.java

@@ -18,6 +18,7 @@ import com.miaxis.common.constant.SmsTemplateConstants;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.domain.entity.SysUser;
 import com.miaxis.common.core.domain.entity.UserInfo;
+import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.utils.DateUtils;
 import com.miaxis.common.utils.RedisPrefixUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -102,20 +103,21 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Response modifyPhoneNumber(String smsCodeType,String phone,String verificationCode,SysUser user) {
+    public Response modifyPhoneNumber(String phone,String verificationCode,SysUser user) {
 
         //生成短信缓存前缀
-        Map<String, String> map = RedisPrefixUtils.smsRedisPrefix(smsCodeType,phone);
+        String smsKeyPrefix = RedisPrefixUtils.getSmsKeyPrefix("modify", phone);
+        String smsKeyCountPrefix = RedisPrefixUtils.getSmsKeyCountPrefix("modify", phone);
 
         //查看验证码是否过期
-        if (redisTemplate.hasKey(map.get("smsKeyCountPrefix")) &&
-                !redisTemplate.hasKey(map.get("keyPrefix"))){
-            return Response.error(500,"验证码已过期,请重新验证!");
+        if (redisTemplate.hasKey(smsKeyCountPrefix) &&
+                !redisTemplate.hasKey(smsKeyPrefix)){
+            throw new CustomException("验证码已过期,请重新验证!");
         }
         //比对缓存中的验证码
-        String smsCodeValue = redisTemplate.opsForValue().get(map.get("keyPrefix")).toString();
+        String smsCodeValue = redisTemplate.opsForValue().get(smsKeyPrefix).toString();
         if (!verificationCode.equals(smsCodeValue)){
-            return Response.error(500,"验证码错误,请重新输入");
+            throw new CustomException("验证码错误,请重新输入!");
         }
 
         UserInfo userInfo = new UserInfo();
@@ -135,102 +137,98 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Response saveUserInformation(UserDto userDto) {
-        try {
 
-            //生成短信缓存前缀
-            Map<String, String> map = RedisPrefixUtils.smsRedisPrefix(userDto.getSmsCodeType(), userDto.getMobile());
+        //生成短信缓存前缀
+        String smsKeyPrefix = RedisPrefixUtils.getSmsKeyPrefix("signUp", userDto.getMobile());
+        String smsKeyCountPrefix = RedisPrefixUtils.getSmsKeyCountPrefix("signUp", userDto.getMobile());
 
-            //查看验证码是否过期
-            if (redisTemplate.hasKey(map.get("smsKeyCountPrefix")) &&
-                    !redisTemplate.hasKey(map.get("keyPrefix"))){
-                return Response.error(500,"验证码已过期,请重新验证!");
-            }
-            //比对缓存中的验证码
-            String smsCodeValue = redisTemplate.opsForValue().get(map.get("keyPrefix")).toString();
-            if (!userDto.getVerificationCode().equals(smsCodeValue)){
-                return Response.error(500,"验证码错误,请重新输入");
-            }
+        //查看验证码是否过期
+        if (redisTemplate.hasKey(smsKeyCountPrefix) &&
+                !redisTemplate.hasKey(smsKeyPrefix)){
+            throw new CustomException("验证码已过期,请重新验证!");
+        }
+        //比对缓存中的验证码
+        String smsCodeValue = redisTemplate.opsForValue().get(smsKeyPrefix).toString();
+        if (!userDto.getVerificationCode().equals(smsCodeValue)){
+            throw new CustomException("验证码错误,请重新输入!");
+        }
 
-            UserInfo userInfo = new UserInfo();
-            //用户信息表
-            userInfo.setName(userDto.getName());
-            userInfo.setSex(userDto.getSex());
-            userInfo.setSfzmlx(1l);
-            userInfo.setIdCard(userDto.getIdCard());
-            userInfo.setMobile(userDto.getMobile());
-            userInfo.setInscode(userDto.getInscode());
-            userInfo.setPxcx(userDto.getPxcx());
-            userInfo.setSchoolClassTypeId(userDto.getSchoolClassTypeId());
-            userInfo.setCoachnum(userDto.getCoachnum());
-            userInfo.setStatus(0);
-            userInfoMapper.insert(userInfo);
-
-
-            //用户报名信息表
-            UserRegister userRegister = new UserRegister();
-            userRegister.setUserId(userInfo.getId());
-            userRegister.setInscode(userDto.getInscode());
-            userRegister.setBmcx(userDto.getPxcx());
-            userRegister.setCoachnum(userDto.getCoachnum());
-            userRegister.setClassId(userDto.getSchoolClassTypeId());
-            userRegisterMapper.insert(userRegister);
-
-            //报名缴费信息
-            UserPay userPay = new UserPay();
-            userPay.setUserId(userInfo.getId());
-            userPay.setPrice(userDto.getSchoolClassTypePrice());
-            userPay.setPayType(4l);
-            userPay.setPayStatus(0l);
-            userPayMapper.insert(userPay);
-
-            //用户图片信息
-            List<UserImages> userImagesList = new ArrayList<>();
-            for (int i = 0; i < 3; i++) {
-                UserImages userImages = new UserImages();
-                userImages.setUserId(userInfo.getId());
-                switch(i){
-                    case 0 :
-                        userImages.setFileUrl(userDto.getIdCardFrontUrl());
-                        userImages.setFilePath(userDto.getIdCardFrontPath());
-                        userImages.setImageType(1l);
-                        userImagesList.add(userImages);
-                        break;
-                    case 1 :
-                        userImages.setFileUrl(userDto.getIdCardReverseUrl());
-                        userImages.setFilePath(userDto.getIdCardReversePath());
-                        userImages.setImageType(2l);
-                        userImagesList.add(userImages);
-                        break;
-                    case 2 :
-                        userImages.setFileUrl(userDto.getFacesUrl());
-                        userImages.setFilePath(userDto.getFacesPath());
-                        userImages.setImageType(3l);
-                        userImagesList.add(userImages);
-                        break;
-                    default :
-                        break;
-                }
+        UserInfo userInfo = new UserInfo();
+        //用户信息表
+        userInfo.setName(userDto.getName());
+        userInfo.setSex(userDto.getSex());
+        userInfo.setSfzmlx(1l);
+        userInfo.setIdCard(userDto.getIdCard());
+        userInfo.setMobile(userDto.getMobile());
+        userInfo.setInscode(userDto.getInscode());
+        userInfo.setPxcx(userDto.getPxcx());
+        userInfo.setSchoolClassTypeId(userDto.getSchoolClassTypeId());
+        userInfo.setCoachnum(userDto.getCoachnum());
+        userInfo.setStatus(0);
+        userInfoMapper.insert(userInfo);
+
+
+        //用户报名信息表
+        UserRegister userRegister = new UserRegister();
+        userRegister.setUserId(userInfo.getId());
+        userRegister.setInscode(userDto.getInscode());
+        userRegister.setBmcx(userDto.getPxcx());
+        userRegister.setCoachnum(userDto.getCoachnum());
+        userRegister.setClassId(userDto.getSchoolClassTypeId());
+        userRegisterMapper.insert(userRegister);
+
+        //报名缴费信息
+        UserPay userPay = new UserPay();
+        userPay.setUserId(userInfo.getId());
+        userPay.setPrice(userDto.getSchoolClassTypePrice());
+        userPay.setPayType(4l);
+        userPay.setPayStatus(0l);
+        userPayMapper.insert(userPay);
+
+        //用户图片信息
+        List<UserImages> userImagesList = new ArrayList<>();
+        for (int i = 0; i < 3; i++) {
+            UserImages userImages = new UserImages();
+            userImages.setUserId(userInfo.getId());
+            switch(i){
+                case 0 :
+                    userImages.setFileUrl(userDto.getIdCardFrontUrl());
+                    userImages.setFilePath(userDto.getIdCardFrontPath());
+                    userImages.setImageType(1l);
+                    userImagesList.add(userImages);
+                    break;
+                case 1 :
+                    userImages.setFileUrl(userDto.getIdCardReverseUrl());
+                    userImages.setFilePath(userDto.getIdCardReversePath());
+                    userImages.setImageType(2l);
+                    userImagesList.add(userImages);
+                    break;
+                case 2 :
+                    userImages.setFileUrl(userDto.getFacesUrl());
+                    userImages.setFilePath(userDto.getFacesPath());
+                    userImages.setImageType(3l);
+                    userImagesList.add(userImages);
+                    break;
+                default :
+                    break;
             }
-            userImagesService.saveBatch(userImagesList);
-
-            return Response.success(userInfo);
-        }catch (Exception e){
-            throw new RuntimeException(e);
         }
+        userImagesService.saveBatch(userImagesList);
+
+        return Response.success(userInfo);
 
     }
 
     /**
      * 注册报名获取短信验证码
-     * @param type
      * @param phone
      * @return
      */
     @Override
-    public Response sendSignUpVerificationCode(String type, String phone) {
+    public Response sendSignUpVerificationCode(String phone) {
         SmsParameter smsParameter = new SmsParameter();
         smsParameter.setPhone(phone);
-        smsParameter.setType(type);
+        smsParameter.setType("signUp");
 
         return smsService.sendVerificationCode(smsParameter);
     }
@@ -239,19 +237,18 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
     /**
      * 修改手机号获取短信验证码
      * @param user
-     * @param type
      * @param phone
      * @return
      */
     @Override
-    public Response sendModifyVerificationCode(SysUser user, String type, String phone) {
+    public Response sendModifyVerificationCode(SysUser user, String phone) {
         if (user.getPhonenumber().equals(phone)){
-            return Response.error(500,"该手机号与当前绑定的手机号相同");
+            throw new CustomException("该手机号与当前绑定的手机号相同!");
         }
 
         SmsParameter smsParameter = new SmsParameter();
         smsParameter.setPhone(phone);
-        smsParameter.setType(type);
+        smsParameter.setType("modify");
 
         return smsService.sendVerificationCode(smsParameter);
     }