mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
feat(system/sms): 短信渠道支持数据字典配置 (#159)
This commit is contained in:
@@ -38,7 +38,6 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.comm.constant.SupplierConstant;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -204,12 +203,16 @@ public class CaptchaController {
|
||||
String captcha = RandomUtil.randomNumbers(captchaSms.getLength());
|
||||
// 发送验证码
|
||||
Long expirationInMinutes = captchaSms.getExpirationInMinutes();
|
||||
SmsBlend smsBlend = SmsFactory.getBySupplier(SupplierConstant.CLOOPEN);
|
||||
|
||||
SmsBlend smsBlend = SmsFactory.getBySupplier(captchaSms.getSupplier());
|
||||
|
||||
Map<String, String> messageMap = MapUtil.newHashMap(2, true);
|
||||
messageMap.put("captcha", captcha);
|
||||
messageMap.put("expirationInMinutes", String.valueOf(expirationInMinutes));
|
||||
messageMap.put(captchaSms.getCodeKey(), captcha);
|
||||
messageMap.put(captchaSms.getTimeKey(), String.valueOf(expirationInMinutes));
|
||||
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(phone, captchaSms
|
||||
.getTemplateId(), (LinkedHashMap<String, String>)messageMap);
|
||||
|
||||
CheckUtils.throwIf(!smsResponse.isSuccess(), "验证码发送失败");
|
||||
// 保存验证码
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + phone;
|
||||
|
@@ -11,6 +11,8 @@ databaseChangeLog:
|
||||
file: db/changelog/mysql/plugin/plugin_open.sql
|
||||
- include:
|
||||
file: db/changelog/mysql/plugin/plugin_generator.sql
|
||||
- include:
|
||||
file: db/changelog/mysql/sms_dict_data.sql
|
||||
# PostgreSQL
|
||||
# - include:
|
||||
# file: db/changelog/postgresql/main_table.sql
|
||||
@@ -23,4 +25,6 @@ databaseChangeLog:
|
||||
# - include:
|
||||
# file: db/changelog/postgresql/plugin/plugin_open.sql
|
||||
# - include:
|
||||
# file: db/changelog/postgresql/plugin/plugin_generator.sql
|
||||
# file: db/changelog/postgresql/plugin/plugin_generator.sql
|
||||
# - include:
|
||||
# file: db/changelog/postgresql/sms_dict_data.sql
|
@@ -0,0 +1,38 @@
|
||||
-- liquibase formatted sql
|
||||
|
||||
-- changeset TopHub:2
|
||||
-- comment 新增 短信厂商 字典
|
||||
|
||||
-- 新增 短信厂商 字典数据
|
||||
INSERT INTO `sys_dict`
|
||||
(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`)
|
||||
VALUES
|
||||
(4, '短信厂商', 'sms_supplier_type', NULL, b'1', 1, NOW());
|
||||
|
||||
-- 新增 短信厂商 字典项
|
||||
INSERT INTO `sys_dict_item`
|
||||
(`id`, `label`, `value`, `color`, `sort`, `description`, `status`, `dict_id`, `create_user`, `create_time`)
|
||||
VALUES
|
||||
(8, '阿里云', 'alibaba', 'primary', 1, NULL, 1, 4, 1, NOW()),
|
||||
(9, '容联云', 'cloopen', 'success', 2, NULL, 1, 4, 1, NOW()),
|
||||
(10, '天翼云', 'ctyun', 'warning', 3, NULL, 1, 4, 1, NOW()),
|
||||
(11, '亿美软通', 'emay', 'primary', 4, NULL, 1, 4, 1, NOW()),
|
||||
(12, '华为', 'huawei', 'success', 5, NULL, 1, 4, 1, NOW()),
|
||||
(13, '京东', 'jdcloud', 'warning', 6, NULL, 1, 4, 1, NOW()),
|
||||
(14, '网易', 'netease', 'primary', 7, NULL, 1, 4, 1, NOW()),
|
||||
(15, '腾讯', 'tencent', 'success', 8, NULL, 1, 4, 1, NOW()),
|
||||
(16, '合一', 'unisms', 'warning', 9, NULL, 1, 4, 1, NOW()),
|
||||
(17, '云片', 'yunpian', 'primary', 10, NULL, 1, 4, 1, NOW()),
|
||||
(18, '助通', 'zhutong', 'success', 11, NULL, 1, 4, 1, NOW()),
|
||||
(19, '联麓', 'lianlu', 'warning', 12, NULL, 1, 4, 1, NOW()),
|
||||
(20, '鼎众', 'dingzhong', 'primary', 13, NULL, 1, 4, 1, NOW()),
|
||||
(21, '七牛云', 'qiniu', 'success', 14, NULL, 1, 4, 1, NOW()),
|
||||
(22, '创蓝', 'chuanglan', 'warning', 15, NULL, 1, 4, 1, NOW()),
|
||||
(23, '极光', 'jiguang', 'primary', 16, NULL, 1, 4, 1, NOW()),
|
||||
(24, '布丁云V2', 'buding_v2', 'success', 17, NULL, 1, 4, 1, NOW()),
|
||||
(25, '中国移动 云MAS', 'mas', 'warning', 18, NULL, 1, 4, 1, NOW()),
|
||||
(26, '百度云', 'baidu', 'primary', 19, NULL, 1, 4, 1, NOW()),
|
||||
(27, '螺丝帽', 'luosimao', 'success', 20, NULL, 1, 4, 1, NOW()),
|
||||
(28, 'SUBMAIL短信', 'mysubmail', 'success', 21, NULL, 1, 4, 1, NOW()),
|
||||
(29, '单米科技短信', 'danmi', 'success', 22, NULL, 1, 4, 1, NOW()),
|
||||
(30, '联通一信通', 'yixintong', 'success', 23, NULL, 1, 4, 1, NOW());
|
@@ -0,0 +1,38 @@
|
||||
-- liquibase formatted sql
|
||||
|
||||
-- changeset TopHub:2
|
||||
-- comment 新增 短信厂商 字典
|
||||
|
||||
-- 新增 短信厂商 字典数据
|
||||
INSERT INTO "sys_dict"
|
||||
("id", "name", "code", "description", "is_system", "create_user", "create_time")
|
||||
VALUES
|
||||
(4, '短信厂商', 'sms_supplier_type', NULL, true, 1, NOW());
|
||||
|
||||
-- 新增 短信厂商 字典项
|
||||
INSERT INTO "sys_dict_item"
|
||||
("id", "label", "value", "color", "sort", "description", "status", "dict_id", "create_user", "create_time")
|
||||
VALUES
|
||||
(8, '阿里云', 'alibaba', 'primary', 1, NULL, 1, 4, 1, NOW()),
|
||||
(9, '容联云', 'cloopen', 'success', 2, NULL, 1, 4, 1, NOW()),
|
||||
(10, '天翼云', 'ctyun', 'warning', 3, NULL, 1, 4, 1, NOW()),
|
||||
(11, '亿美软通', 'emay', 'primary', 4, NULL, 1, 4, 1, NOW()),
|
||||
(12, '华为', 'huawei', 'success', 5, NULL, 1, 4, 1, NOW()),
|
||||
(13, '京东', 'jdcloud', 'warning', 6, NULL, 1, 4, 1, NOW()),
|
||||
(14, '网易', 'netease', 'primary', 7, NULL, 1, 4, 1, NOW()),
|
||||
(15, '腾讯', 'tencent', 'success', 8, NULL, 1, 4, 1, NOW()),
|
||||
(16, '合一', 'unisms', 'warning', 9, NULL, 1, 4, 1, NOW()),
|
||||
(17, '云片', 'yunpian', 'primary', 10, NULL, 1, 4, 1, NOW()),
|
||||
(18, '助通', 'zhutong', 'success', 11, NULL, 1, 4, 1, NOW()),
|
||||
(19, '联麓', 'lianlu', 'warning', 12, NULL, 1, 4, 1, NOW()),
|
||||
(20, '鼎众', 'dingzhong', 'primary', 13, NULL, 1, 4, 1, NOW()),
|
||||
(21, '七牛云', 'qiniu', 'success', 14, NULL, 1, 4, 1, NOW()),
|
||||
(22, '创蓝', 'chuanglan', 'warning', 15, NULL, 1, 4, 1, NOW()),
|
||||
(23, '极光', 'jiguang', 'primary', 16, NULL, 1, 4, 1, NOW()),
|
||||
(24, '布丁云V2', 'buding_v2', 'success', 17, NULL, 1, 4, 1, NOW()),
|
||||
(25, '中国移动 云MAS', 'mas', 'warning', 18, NULL, 1, 4, 1, NOW()),
|
||||
(26, '百度云', 'baidu', 'primary', 19, NULL, 1, 4, 1, NOW()),
|
||||
(27, '螺丝帽', 'luosimao', 'success', 20, NULL, 1, 4, 1, NOW()),
|
||||
(28, 'SUBMAIL短信', 'mysubmail', 'success', 21, NULL, 1, 4, 1, NOW()),
|
||||
(29, '单米科技短信', 'danmi', 'success', 22, NULL, 1, 4, 1, NOW()),
|
||||
(30, '联通一信通', 'yixintong', 'success', 23, NULL, 1, 4, 1, NOW());
|
Reference in New Issue
Block a user