mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 15:13:55 +08:00
Merge pull request #1320 from xinnan-tech/manager-icp-num
可自定义智控台底部的系统名称、ICP备案号、公安备案号
This commit is contained in:
@@ -118,29 +118,17 @@ public interface Constant {
|
||||
|
||||
enum SysBaseParam {
|
||||
/**
|
||||
* 系统全称
|
||||
* ICP备案号
|
||||
*/
|
||||
SYS_NAME("SYS_NAME"),
|
||||
BEIAN_ICP_NUM("server.beian_icp_num"),
|
||||
/**
|
||||
* 系统简称
|
||||
* GA备案号
|
||||
*/
|
||||
SYS_SHORT_NAME("SYS_SHORT_NAME"),
|
||||
BEIAN_GA_NUM("server.beian_ga_num"),
|
||||
/**
|
||||
* 系统描述
|
||||
* 系统名称
|
||||
*/
|
||||
SYS_DES("SYS_DES"),
|
||||
/**
|
||||
* 登录失败几次锁定
|
||||
*/
|
||||
LOGIN_LOCK_COUNT("LOGIN_LOCK_COUNT"),
|
||||
/**
|
||||
* 账号失败锁定分钟数
|
||||
*/
|
||||
LOGIN_LOCK_TIME("LOGIN_LOCK_TIME"),
|
||||
/**
|
||||
* TOKEN强验证
|
||||
*/
|
||||
SYS_TOKEN_SECURITY("SYS_TOKEN_SECURITY");
|
||||
SERVER_NAME("server.name");
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -176,11 +164,11 @@ public interface Constant {
|
||||
/**
|
||||
* 单号码最大短信发送条数
|
||||
*/
|
||||
SYSTEM_SMS_MAX_SEND_COUNT("system.sms.max_send_count"),
|
||||
SERVER_SMS_MAX_SEND_COUNT("server.sms_max_send_count"),
|
||||
/**
|
||||
* 是否开启手机注册
|
||||
*/
|
||||
SYSTEM_ENABLE_MOBILE_REGISTER("system.enable_mobile_register");
|
||||
SERVER_ENABLE_MOBILE_REGISTER("server.enable_mobile_register");
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -245,4 +233,24 @@ public interface Constant {
|
||||
* 无效固件URL
|
||||
*/
|
||||
String INVALID_FIRMWARE_URL = "http://xiaozhi.server.com:8002/xiaozhi/otaMag/download/NOT_ACTIVATED_FIRMWARE_THIS_IS_A_INVALID_URL";
|
||||
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
enum DictType {
|
||||
/**
|
||||
* 手机区号
|
||||
*/
|
||||
MOBILE_AREA("MOBILE_AREA");
|
||||
|
||||
private String value;
|
||||
|
||||
DictType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-5
@@ -1,6 +1,7 @@
|
||||
package xiaozhi.modules.security.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -70,7 +71,7 @@ public class LoginController {
|
||||
throw new RenException("图形验证码错误");
|
||||
}
|
||||
Boolean isMobileRegister = sysParamsService
|
||||
.getValueObject(Constant.SysMSMParam.SYSTEM_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class);
|
||||
.getValueObject(Constant.SysMSMParam.SERVER_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class);
|
||||
if (!isMobileRegister) {
|
||||
throw new RenException("没有开启手机注册,没法使用短信验证码功能");
|
||||
}
|
||||
@@ -108,7 +109,7 @@ public class LoginController {
|
||||
}
|
||||
// 是否开启手机注册
|
||||
Boolean isMobileRegister = sysParamsService
|
||||
.getValueObject(Constant.SysMSMParam.SYSTEM_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class);
|
||||
.getValueObject(Constant.SysMSMParam.SERVER_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class);
|
||||
boolean validate;
|
||||
if (isMobileRegister) {
|
||||
// 验证用户是否是手机号码
|
||||
@@ -165,7 +166,7 @@ public class LoginController {
|
||||
public Result<?> retrievePassword(@RequestBody RetrievePasswordDTO dto) {
|
||||
// 是否开启手机注册
|
||||
Boolean isMobileRegister = sysParamsService
|
||||
.getValueObject(Constant.SysMSMParam.SYSTEM_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class);
|
||||
.getValueObject(Constant.SysMSMParam.SERVER_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class);
|
||||
if (!isMobileRegister) {
|
||||
throw new RenException("没有开启手机注册,没法使用找回密码功能");
|
||||
}
|
||||
@@ -198,11 +199,15 @@ public class LoginController {
|
||||
public Result<Map<String, Object>> pubConfig() {
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("enableMobileRegister", sysParamsService
|
||||
.getValueObject(Constant.SysMSMParam.SYSTEM_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class));
|
||||
.getValueObject(Constant.SysMSMParam.SERVER_ENABLE_MOBILE_REGISTER.getValue(), Boolean.class));
|
||||
config.put("version", Constant.VERSION);
|
||||
config.put("year", "©" + Calendar.getInstance().get(Calendar.YEAR));
|
||||
config.put("allowUserRegister", sysUserService.getAllowUserRegister());
|
||||
List<SysDictDataItem> list = sysDictDataService.getDictDataByType("MOBILE_AREA");
|
||||
List<SysDictDataItem> list = sysDictDataService.getDictDataByType(Constant.DictType.MOBILE_AREA.getValue());
|
||||
config.put("mobileAreaList", list);
|
||||
config.put("beianIcpNum", sysParamsService.getValue(Constant.SysBaseParam.BEIAN_ICP_NUM.getValue(), true));
|
||||
config.put("beianGaNum", sysParamsService.getValue(Constant.SysBaseParam.BEIAN_GA_NUM.getValue(), true));
|
||||
config.put("name", sysParamsService.getValue(Constant.SysBaseParam.SERVER_NAME.getValue(), true));
|
||||
|
||||
return new Result<Map<String, Object>>().ok(config);
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ public class CaptchaServiceImpl implements CaptchaService {
|
||||
|
||||
// 获取最大发送次数限制
|
||||
Integer maxSendCount = sysParamsService.getValueObject(
|
||||
Constant.SysMSMParam.SYSTEM_SMS_MAX_SEND_COUNT.getValue(),
|
||||
Constant.SysMSMParam.SERVER_SMS_MAX_SEND_COUNT.getValue(),
|
||||
Integer.class);
|
||||
if (maxSendCount == null) {
|
||||
maxSendCount = 5; // 默认值
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class SysParamsController {
|
||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = "paramCode", description = "参数编码", in = ParameterIn.QUERY, ref = "String")
|
||||
@Parameter(name = "paramCode", description = "参数编码或参数备注", in = ParameterIn.QUERY, ref = "String")
|
||||
})
|
||||
@RequiresPermissions("sys:role:superAdmin")
|
||||
public Result<PageData<SysParamsDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
|
||||
+3
-1
@@ -52,7 +52,9 @@ public class SysParamsServiceImpl extends BaseServiceImpl<SysParamsDao, SysParam
|
||||
|
||||
QueryWrapper<SysParamsEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("param_type", 1);
|
||||
wrapper.like(StringUtils.isNotBlank(paramCode), "param_code", paramCode);
|
||||
wrapper.nested(StringUtils.isNotBlank(paramCode),i->i.like("param_code", paramCode)
|
||||
.or()
|
||||
.like("remark", paramCode));
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
+9
-3
@@ -1,15 +1,21 @@
|
||||
-- 添加手机短信注册功能的需要的参数
|
||||
delete from sys_params where id in (601, 602, 610, 611, 612, 613);
|
||||
delete from sys_params where id in (108, 109, 110, 111, 112, 113, 114, 115);
|
||||
delete from sys_params where id in (610, 611, 612, 613);
|
||||
INSERT INTO sys_params
|
||||
(id, param_code, param_value, value_type, param_type, remark, creator, create_date, updater, update_date)
|
||||
VALUES
|
||||
(601, 'system.enable_mobile_register', 'false', 'boolean', 1, '是否开启手机注册', NULL, NULL, NULL, NULL),
|
||||
(602, 'system.sms.max_send_count', '10', 'number', 1, '单号码单日最大短信发送条数', NULL, NULL, NULL, NULL),
|
||||
(108, 'server.name', 'xiaozhi-esp32-server', 'string', 1, '系统名称', NULL, NULL, NULL, NULL),
|
||||
(109, 'server.beian_icp_num', 'null', 'string', 1, 'icp备案号,填写null则不设置', NULL, NULL, NULL, NULL),
|
||||
(110, 'server.beian_ga_num', 'null', 'string', 1, '公安备案号,填写null则不设置', NULL, NULL, NULL, NULL),
|
||||
(111, 'server.enable_mobile_register', 'false', 'boolean', 1, '是否开启手机注册', NULL, NULL, NULL, NULL),
|
||||
(112, 'server.sms_max_send_count', '10', 'number', 1, '单号码单日最大短信发送条数', NULL, NULL, NULL, NULL),
|
||||
(610, 'aliyun.sms.access_key_id', '', 'string', 1, '阿里云平台access_key', NULL, NULL, NULL, NULL),
|
||||
(611, 'aliyun.sms.access_key_secret', '', 'string', 1, '阿里云平台access_key_secret', NULL, NULL, NULL, NULL),
|
||||
(612, 'aliyun.sms.sign_name', '', 'string', 1, '阿里云短信签名', NULL, NULL, NULL, NULL),
|
||||
(613, 'aliyun.sms.sms_code_template_code', '', 'string', 1, '阿里云短信模板', NULL, NULL, NULL, NULL);
|
||||
|
||||
update sys_params set remark = '是否允许管理员以外的人注册' where param_code = 'server.allow_user_register';
|
||||
|
||||
-- 增加手机区域字典
|
||||
-- 插入固件类型字典类型
|
||||
delete from `sys_dict_type` where `id` = 102;
|
||||
@@ -114,13 +114,6 @@ databaseChangeLog:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505091409.sql
|
||||
- changeSet:
|
||||
id: 202505141132
|
||||
author: zjy
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505141132.sql
|
||||
- changeSet:
|
||||
id: 202505091555
|
||||
author: whosmyqueen
|
||||
@@ -149,3 +142,10 @@ databaseChangeLog:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505142037.sql
|
||||
- changeSet:
|
||||
id: 202505182234
|
||||
author: amen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505182234.sql
|
||||
Reference in New Issue
Block a user