bug fix:短信功能是否启用判断不生效
parent
5801fd414f
commit
4aa37e731f
|
|
@ -44,8 +44,8 @@ public class SysSmsController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/code")
|
||||
public R<Void> smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") String phonenumber) {
|
||||
if (smsProperties.getEnabled()) {
|
||||
R.fail("当前系统没有开启短信功能!");
|
||||
if (!smsProperties.getEnabled()) {
|
||||
return R.fail("当前系统没有开启短信功能!");
|
||||
}
|
||||
String key = CacheConstants.CAPTCHA_CODE_KEY + phonenumber;
|
||||
String code = RandomUtil.randomNumbers(4);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.ruoyi.resource.dubbo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.common.sms.config.properties.SmsProperties;
|
||||
|
|
@ -37,8 +36,8 @@ public class RemoteSmsServiceImpl implements RemoteSmsService {
|
|||
* @param param 模板对应参数
|
||||
*/
|
||||
public SysSms send(String phones, String templateId, Map<String, String> param) throws ServiceException {
|
||||
if (smsProperties.getEnabled()) {
|
||||
R.fail("当前系统没有开启短信功能!");
|
||||
if (!smsProperties.getEnabled()) {
|
||||
throw new ServiceException("当前系统没有开启短信功能!");
|
||||
}
|
||||
SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class);
|
||||
SmsResult smsResult = smsTemplate.send(phones, templateId, param);
|
||||
|
|
|
|||
Loading…
Reference in New Issue