diff --git a/README.md b/README.md index 73dcf15e451387250460bdb653bac7966d0b15ae..a98c2ea3a8eb92c1edd2ed6e043244417aebe408 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,22 @@ # oauthserver ## 简介 -oauthserver是一个基于Spring Boot Oauth2的完整的独立的Oauth2 Server微服务。仅仅需要创建相关数据表,修改数据库的连接信息,你就可以得到一个Oauth2 Server微服务。 -为了开发方便,项目拆分成两个模块,api和web。api运行在8181端口,web运行在8182端口。api模块是提供api服务的,主要是oauth token、支付等接口;web是管理端。 +oauthserver是一个基于Spring Boot Oauth2的完整的独立的Oauth2 Server微服务。项目的目的是,仅仅需要创建相关数据表,修改数据库的连接信息,你就可以得到一个Oauth2 Server微服务。 +为了开发方便,项目拆分成三个模块,api、web和common: +1. api运行在8181端口,api模块是提供api服务的,主要是oauth token等其他业务接口; +2. web运行在8182端口,是一个简单的管理后台; +3. common是公共工具模块。 支持的关系型数据库: - MySQL ## 功能概览 ### api -1. Oauth token服务; -2. 微信、支付宝支付; -3. 七牛云存储; -3. 代码生成器。 +1. Oauth token服务,支持3种登录方式:手机号+验证码、手机号+密码、邮箱+密码(使用流程参考[oauth接口调用示例](tutorial/api.md),如果你需要使用短信验证码服务,请前往阿里大于和云之讯短信服务购买短信验证码服务,并在application.properties中配置相关参数); +2. 短信验证码服务,支持两种:阿里大于和云之讯短信服务; +3. 微信、支付宝支付; +4. 七牛云存储; +5. 代码生成器。 ### common 公共工具类模块 ### web @@ -51,28 +55,6 @@ oauthserver是一个基于Spring Boot Oauth2的完整的独立的Oauth2 Server 2. 代码生成器支持时间类型字段; 3. 代码生成默认位置改为test目录; 4. 修复java.lang.IllegalArgumentException: Request header is too large。 -### 1.3.0-2(2019-01-20) -#### web -1. 升级Spring Boot 1.5.18.RELEASE到1.5.19.RELEASE; -2. 模板增加MyBatis Provider模板; -3. 新增角色管理(权限管理核心); -4. 完善权限控制,支持到页面操作按钮; -5. 使用代码生成器生成“新闻管理”,并不修改一行代码。 - -### 1.3.0-1(2019-01-06) -#### web -1. 新闻管理的新增和修改页面使用layer代替easyui-window,以解决neditor图片上传弹框高度太高,造成确定按钮被遮挡的问题; -2. 修复订单管理页面搜索bug; -3. 操作结果使用toastr代替easyui messager; -4. 移除froala editor依赖,该富文本编辑器不被允许用在开源项目中; -5. 解决index_iframe页面侧边栏菜单项打不开的bug; -6. 移除toastr依赖,并在plug-in中添加toastr相关js和css; -7. 移除index_v1和index_iframe页面的footer,以保留更多的标签页高度,给easyui-window提供更多的高度空间。 - -### 1.3.0(2018-12-20) -1. 项目拆分成两个模块,api和web;api运行在8181端口,web运行在8182端口。 -2. 代码生成器[http://localhost:8181/tables?easyui-list](http://localhost:8181/tables?easyui-list)和[http://localhost:8182/tables?easyui-list](http://localhost:8182/tables?easyui-list) -3. 大量更新; **更多历史更新日志查看[CHANGE_LOG.md](tutorial/CHANGE_LOG.md)** diff --git a/api/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java b/api/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java index dcfa09c8a544c6c068fb9bc71e159bfdb2e03fc6..cb88f784309d4f84739328f31a21aa4caa35b47c 100644 --- a/api/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java +++ b/api/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java @@ -1,5 +1,6 @@ package com.simon.common.plugins.oauth; +import com.simon.common.config.AppConfig; import com.simon.common.domain.UserEntity; import com.simon.service.OauthUserService; import com.simon.service.SmsService; @@ -25,7 +26,7 @@ public class SmsIntegrationAuthenticator extends AbstractPreparableIntegrationAu private OauthUserService oauthUserService; @Autowired - @Qualifier(value = "yzxSmsServiceImpl") + @Qualifier(value = AppConfig.SMS_SERVICE_IMPL) private SmsService smsService; private PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(11); diff --git a/api/src/main/java/com/simon/controller/OauthUserController.java b/api/src/main/java/com/simon/controller/OauthUserController.java index 6d57c7c6dc7a37efb8049a73955c54b54097d3d4..f2ae83b7f9b0f2cc795e496c7f5ccaf2f77c297d 100644 --- a/api/src/main/java/com/simon/controller/OauthUserController.java +++ b/api/src/main/java/com/simon/controller/OauthUserController.java @@ -1,6 +1,7 @@ package com.simon.controller; import com.alibaba.fastjson.JSON; +import com.simon.common.config.AppConfig; import com.simon.common.controller.BaseController; import com.simon.common.domain.ResultCode; import com.simon.common.domain.ResultMsg; @@ -43,7 +44,7 @@ public class OauthUserController extends BaseController { private OauthUserService oauthUserService; @Autowired - @Qualifier(value = "yzxSmsServiceImpl") + @Qualifier(value = AppConfig.SMS_SERVICE_IMPL) private SmsService smsService; PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(11); diff --git a/api/src/main/java/com/simon/controller/VeriCodeController.java b/api/src/main/java/com/simon/controller/VeriCodeController.java index f797f6255dab5b0db354e1d2f99df69ed9b6aefe..ef295684a0054cd73ed707b20667e54851b18da7 100644 --- a/api/src/main/java/com/simon/controller/VeriCodeController.java +++ b/api/src/main/java/com/simon/controller/VeriCodeController.java @@ -1,13 +1,16 @@ package com.simon.controller; +import com.simon.common.config.AppConfig; import com.simon.common.controller.BaseController; import com.simon.common.domain.ResultCode; import com.simon.common.domain.ResultMsg; +import com.simon.common.utils.ValidUtil; import com.simon.service.SmsService; import com.taobao.api.ApiException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import lombok.var; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.GetMapping; @@ -15,26 +18,47 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.List; + /** * @author simon * @date 2019-01-02 */ @Slf4j -@Api(value = "验证码", description = "验证码") +@Api(description = "验证码") @RestController @RequestMapping("/api/veriCodes") public class VeriCodeController extends BaseController { + @Autowired + private org.springframework.cache.CacheManager cacheManager; @Autowired - @Qualifier(value = "yzxSmsServiceImpl") + @Qualifier(value = AppConfig.SMS_SERVICE_IMPL) private SmsService smsService; @ApiOperation(value = "获取验证码") @GetMapping("/sms/{phone}") public ResultMsg getVeriCodeByPhone(@PathVariable String phone) throws ApiException { - if (smsService.sendIdentifyCode(phone)){ + if (!ValidUtil.isMobile(phone)) { + return ResultMsg.fail(ResultCode.ERROR_INVALID_PHONE); + } + + //测试手机号 + List whiteList = new ArrayList<>(); + whiteList.add("18800000000"); + whiteList.add("18800000001"); + whiteList.add("18800000002"); + if (whiteList.contains(phone)){ + //写入缓存 + var cache = cacheManager.getCache("smsCache"); + cache.put(phone, "123456"); + return ResultMsg.success(); + } + + if (smsService.sendIdentifyCode(phone)) { return ResultMsg.success(); - }else{ + } else { return ResultMsg.fail(ResultCode.FAIL); } } diff --git a/api/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java b/api/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java index d2e9050dc8725e2d0dcdb47f33672b4120cfdba5..c0944da7953d3eb24c500ca5a062b7601956f4a2 100644 --- a/api/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java @@ -1,5 +1,7 @@ package com.simon.service.impl; +import com.simon.common.domain.ResultCode; +import com.simon.common.exception.BusinessException; import com.simon.service.SmsService; import com.taobao.api.ApiException; import com.taobao.api.DefaultTaobaoClient; @@ -81,11 +83,20 @@ public class AliSmsServiceImpl implements SmsService { log.info("checkCode"); var cache = cacheManager.getCache("smsCache"); var ele = cache.get(mobile); - String output = (ele == null ? null : ele.get().toString()); + + if (null == ele) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + + String output = ele.get().toString(); log.info("从缓存中读到" + mobile + "," + output); var result = false; + if (StringUtils.isEmpty(output)) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(output)) { if (code.equals(output)) { result = true; diff --git a/api/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java b/api/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java index ee1ccb0bb307a16000f7f5f3488a98b3a0c26a81..e5368dd21b6015aea164d7568a2d5ed4a8e8bcb9 100644 --- a/api/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java @@ -3,6 +3,8 @@ package com.simon.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.simon.common.config.AppConfig; +import com.simon.common.domain.ResultCode; +import com.simon.common.exception.BusinessException; import com.simon.common.utils.SmsUtil; import com.simon.service.SmsService; import lombok.extern.slf4j.Slf4j; @@ -74,11 +76,20 @@ public class YzxSmsServiceImpl implements SmsService { log.info("checkCode"); var cache = cacheManager.getCache("smsCache"); var ele = cache.get(mobile); - String output = (ele == null ? null : ele.get().toString()); + + if (null == ele) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + + String output = ele.get().toString(); log.info("从缓存中读到" + mobile + "," + output); var result = false; + if (StringUtils.isEmpty(output)) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(output)) { if (code.equals(output)) { result = true; diff --git a/api/src/main/resources/application.properties b/api/src/main/resources/application.properties index 2f2f2898c0b83caf4a7a94547b974d71bd66ff17..e0863e0f37b5c6a807b0468e42581bc499c57081 100644 --- a/api/src/main/resources/application.properties +++ b/api/src/main/resources/application.properties @@ -22,10 +22,10 @@ com.alibaba.dayu.sms-type= com.alibaba.dayu.sms-free-sign-name= com.alibaba.dayu.sms-template-code= -##sms +# ֮Ѷŷ sms.clientid= sms.password= -sms.identity-code-msg-template=xxAPP֤:%s +sms.identity-code-msg-template=thymelte֤:%s # ļϴ· file.upload.dir=fileUpload diff --git a/common/src/main/java/com/simon/common/config/AppConfig.java b/common/src/main/java/com/simon/common/config/AppConfig.java index a6be396202160a48043ea7a7c902352e198b87a3..19f2ad8d89ab2176a0ecd07477365aeae8a3a610 100644 --- a/common/src/main/java/com/simon/common/config/AppConfig.java +++ b/common/src/main/java/com/simon/common/config/AppConfig.java @@ -56,6 +56,11 @@ public class AppConfig { public static final String ROLE_ADMIN = "ROLE_ADMIN"; public static final String ROLE_SU = "ROLE_SU"; + /** + * 可选值yzxSmsServiceImpl,aliSmsServiceImpl + */ + public static final String SMS_SERVICE_IMPL = "yzxSmsServiceImpl"; + public static String SERVER_PORT; static { Properties prop = new Properties(); diff --git a/common/src/main/java/com/simon/common/domain/ResultCode.java b/common/src/main/java/com/simon/common/domain/ResultCode.java index 835f9ba8d76bd07e156f9023c2d7f35c6c331a48..bb8aea79bba1af23d6d070f4d715b6ca7ebb0e20 100644 --- a/common/src/main/java/com/simon/common/domain/ResultCode.java +++ b/common/src/main/java/com/simon/common/domain/ResultCode.java @@ -8,10 +8,13 @@ package com.simon.common.domain; **/ public enum ResultCode { - + /** + * 结果码 + */ SUCCESS(200, "操作成功"), FAIL(500, "服务器内部错误"), - ERROR_VERI_CODE(404001, "验证码错误"); + ERROR_VERI_CODE(404001, "验证码错误"), + ERROR_INVALID_PHONE(404002, "手机号格式不正确"); private final int code; private final String msg; diff --git a/common/src/main/java/com/simon/common/exception/BusinessException.java b/common/src/main/java/com/simon/common/exception/BusinessException.java index e814ee5bbd6cdc887fc0b5d3b4f0de3d5d7fc150..57800d646f060cd6902a362416ff085fb4b61e7b 100644 --- a/common/src/main/java/com/simon/common/exception/BusinessException.java +++ b/common/src/main/java/com/simon/common/exception/BusinessException.java @@ -1,5 +1,7 @@ package com.simon.common.exception; +import com.simon.common.domain.ResultCode; + /** * 业务异常 * @@ -16,4 +18,8 @@ public class BusinessException extends RuntimeException { public BusinessException(String message) { super(message); } + + public BusinessException(ResultCode resultCode){ + super(resultCode.getMsg()); + } } diff --git a/tutorial/CHANGE_LOG.md b/tutorial/CHANGE_LOG.md index 9d4a9b36661c1e236775ade3072a74470e12b4de..c5ec9f7f3de2f8978bce653a431ec6fa4dc85319 100644 --- a/tutorial/CHANGE_LOG.md +++ b/tutorial/CHANGE_LOG.md @@ -1,3 +1,26 @@ +### 1.3.0-2(2019-01-20) +#### web +1. 升级Spring Boot 1.5.18.RELEASE到1.5.19.RELEASE; +2. 模板增加MyBatis Provider模板; +3. 新增角色管理(权限管理核心); +4. 完善权限控制,支持到页面操作按钮; +5. 使用代码生成器生成“新闻管理”,并不修改一行代码。 + +### 1.3.0-1(2019-01-06) +#### web +1. 新闻管理的新增和修改页面使用layer代替easyui-window,以解决neditor图片上传弹框高度太高,造成确定按钮被遮挡的问题; +2. 修复订单管理页面搜索bug; +3. 操作结果使用toastr代替easyui messager; +4. 移除froala editor依赖,该富文本编辑器不被允许用在开源项目中; +5. 解决index_iframe页面侧边栏菜单项打不开的bug; +6. 移除toastr依赖,并在plug-in中添加toastr相关js和css; +7. 移除index_v1和index_iframe页面的footer,以保留更多的标签页高度,给easyui-window提供更多的高度空间。 + +### 1.3.0(2018-12-20) +1. 项目拆分成两个模块,api和web;api运行在8181端口,web运行在8182端口。 +2. 代码生成器[http://localhost:8181/tables?easyui-list](http://localhost:8181/tables?easyui-list)和[http://localhost:8182/tables?easyui-list](http://localhost:8182/tables?easyui-list) +3. 大量更新; + ### v.1.2.4.beta2(2018-09-13) - 默认使用MySQL数据库连接配置,更新MySQL连接配置以支持utf8mb4编码; - 新增BaseController,解决接口的时间类型传输问题; diff --git a/tutorial/api.md b/tutorial/api.md index 3ba8239eeeecd37ee4c688551339a00718d80d84..7d1c8b6d6babed7ff11231e5b2511c388422825e 100644 --- a/tutorial/api.md +++ b/tutorial/api.md @@ -19,8 +19,17 @@ public void configure(ClientDetailsServiceConfigurer clients) throws Exception { **token相关的接口,都需要进行Basic Oauth认证。** 如下图所示: ![截图](screenshots/2018-04-26_234934.png) -> 1、根据用户名和密码获取access_token ->> POST [http://localhost:8181/oauth/token?grant_type=password&username=jeesun&password=1234567890c](http://localhost:8181/oauth/token?grant_type=password&username=jeesun&password=1234567890c) + +> 1、获取access_token +>> 1.1 手机号+密码 +>>> POST [http://localhost:8181/oauth/token?grant_type=password&username=18800000000&password=1234567890c](http://localhost:8181/oauth/token?grant_type=password&username=18800000000&password=1234567890c) + +>> 1.2 手机号+验证码 +>>> POST [http://localhost:8181/oauth/token?grant_type=password&username=18800000000&password=123456&auth_type=sms](http://localhost:8181/oauth/token?grant_type=password&username=18800000000&password=123456&auth_type=sms) +注:验证码必须先通过[http://localhost:8181/api/veriCodes/sms/18800000000](http://localhost:8181/api/veriCodes/sms/18800000000)获取,测试账号验证码都是123456。 + +>> 1.3 邮箱+密码 +>>> POST [http://localhost:8181/oauth/token?grant_type=password&username=18800000000@163.com&password=1234567890c](http://localhost:8181/oauth/token?grant_type=password&username=18800000000@163.com&password=1234567890c) **成功示例** status=200,返回的json数据: diff --git a/web/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java b/web/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java index dcfa09c8a544c6c068fb9bc71e159bfdb2e03fc6..cb88f784309d4f84739328f31a21aa4caa35b47c 100644 --- a/web/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java +++ b/web/src/main/java/com/simon/common/plugins/oauth/SmsIntegrationAuthenticator.java @@ -1,5 +1,6 @@ package com.simon.common.plugins.oauth; +import com.simon.common.config.AppConfig; import com.simon.common.domain.UserEntity; import com.simon.service.OauthUserService; import com.simon.service.SmsService; @@ -25,7 +26,7 @@ public class SmsIntegrationAuthenticator extends AbstractPreparableIntegrationAu private OauthUserService oauthUserService; @Autowired - @Qualifier(value = "yzxSmsServiceImpl") + @Qualifier(value = AppConfig.SMS_SERVICE_IMPL) private SmsService smsService; private PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(11); diff --git a/web/src/main/java/com/simon/controller/VeriCodeController.java b/web/src/main/java/com/simon/controller/VeriCodeController.java index 55c0eb21755b81785d111e20e7b08571b9424c4d..aa56daae47a1c5e80c192cd19732f9a85dc960fc 100644 --- a/web/src/main/java/com/simon/controller/VeriCodeController.java +++ b/web/src/main/java/com/simon/controller/VeriCodeController.java @@ -1,13 +1,16 @@ package com.simon.controller; +import com.simon.common.config.AppConfig; import com.simon.common.controller.BaseController; import com.simon.common.domain.ResultCode; import com.simon.common.domain.ResultMsg; +import com.simon.common.utils.ValidUtil; import com.simon.service.SmsService; import com.taobao.api.ApiException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import lombok.var; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.GetMapping; @@ -15,6 +18,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.List; + /** * @author simon * @date 2019-01-02 @@ -25,12 +31,31 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("/api/veriCodes") public class VeriCodeController extends BaseController { @Autowired - @Qualifier(value = "yzxSmsServiceImpl") + private org.springframework.cache.CacheManager cacheManager; + + @Autowired + @Qualifier(value = AppConfig.SMS_SERVICE_IMPL) private SmsService smsService; @ApiOperation(value = "获取验证码") @GetMapping("/sms/{phone}") public ResultMsg getVeriCodeByPhone(@PathVariable String phone) throws ApiException { + if (!ValidUtil.isMobile(phone)) { + return ResultMsg.fail(ResultCode.ERROR_INVALID_PHONE); + } + + //测试手机号 + List whiteList = new ArrayList<>(); + whiteList.add("18800000000"); + whiteList.add("18800000001"); + whiteList.add("18800000002"); + if (whiteList.contains(phone)){ + //写入缓存 + var cache = cacheManager.getCache("smsCache"); + cache.put(phone, "123456"); + return ResultMsg.success(); + } + if (smsService.sendIdentifyCode(phone)){ return ResultMsg.success(); }else{ diff --git a/web/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java b/web/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java index d2e9050dc8725e2d0dcdb47f33672b4120cfdba5..c0944da7953d3eb24c500ca5a062b7601956f4a2 100644 --- a/web/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/AliSmsServiceImpl.java @@ -1,5 +1,7 @@ package com.simon.service.impl; +import com.simon.common.domain.ResultCode; +import com.simon.common.exception.BusinessException; import com.simon.service.SmsService; import com.taobao.api.ApiException; import com.taobao.api.DefaultTaobaoClient; @@ -81,11 +83,20 @@ public class AliSmsServiceImpl implements SmsService { log.info("checkCode"); var cache = cacheManager.getCache("smsCache"); var ele = cache.get(mobile); - String output = (ele == null ? null : ele.get().toString()); + + if (null == ele) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + + String output = ele.get().toString(); log.info("从缓存中读到" + mobile + "," + output); var result = false; + if (StringUtils.isEmpty(output)) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(output)) { if (code.equals(output)) { result = true; diff --git a/web/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java b/web/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java index ee1ccb0bb307a16000f7f5f3488a98b3a0c26a81..e5368dd21b6015aea164d7568a2d5ed4a8e8bcb9 100644 --- a/web/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/YzxSmsServiceImpl.java @@ -3,6 +3,8 @@ package com.simon.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.simon.common.config.AppConfig; +import com.simon.common.domain.ResultCode; +import com.simon.common.exception.BusinessException; import com.simon.common.utils.SmsUtil; import com.simon.service.SmsService; import lombok.extern.slf4j.Slf4j; @@ -74,11 +76,20 @@ public class YzxSmsServiceImpl implements SmsService { log.info("checkCode"); var cache = cacheManager.getCache("smsCache"); var ele = cache.get(mobile); - String output = (ele == null ? null : ele.get().toString()); + + if (null == ele) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + + String output = ele.get().toString(); log.info("从缓存中读到" + mobile + "," + output); var result = false; + if (StringUtils.isEmpty(output)) { + throw new BusinessException(ResultCode.ERROR_VERI_CODE); + } + if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(output)) { if (code.equals(output)) { result = true; diff --git a/web/src/main/resources/application.properties b/web/src/main/resources/application.properties index 09a10da55c51e2b271217491cbfa17377653f122..98fcc43f2e703dc895ad6dbc8067615426e00aa1 100644 --- a/web/src/main/resources/application.properties +++ b/web/src/main/resources/application.properties @@ -22,7 +22,7 @@ com.alibaba.dayu.sms-type= com.alibaba.dayu.sms-free-sign-name= com.alibaba.dayu.sms-template-code= -##sms +# ֮Ѷŷ sms.clientid= sms.password= sms.identity-code-msg-template=xxAPP֤:%s