提交 9118b043 authored 作者: wangjiahao's avatar wangjiahao

refactor: 国际化

上级 5d674fcc
......@@ -4,6 +4,8 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysRole;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
......@@ -122,17 +124,17 @@ public class SysUserController {
Long userId = AuthUtils.getUser().getUserId();
// 防止修改他人信息, 防止必填内容留空
if (!request.getUserId().equals(userId) || request.getEmail() == null || request.getNickName() == null) {
throw new RuntimeException("内容不合法");
DataEaseException.throwException(Translator.get("i18n_wrong_content"));
}
// 再次验证,匹配格式
if (!request.getPhone().isEmpty() && !request.getPhone().matches("^1[3|4|5|7|8][0-9]{9}$")) {
throw new RuntimeException("电话格式错误");
DataEaseException.throwException(Translator.get("i18n_wrong_tel"));
}
if (!request.getEmail().matches("^[a-zA-Z0-9_._-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")) {
throw new RuntimeException("邮箱格式错误");
DataEaseException.throwException(Translator.get("i18n_wrong_email"));
}
if (!(2 <= request.getNickName().length() && request.getNickName().length() <= 50)) {
throw new RuntimeException("姓名格式错误");
DataEaseException.throwException(Translator.get("i18n_wrong_name_format"));
}
sysUserService.updatePersonBasicInfo(request);
}
......
......@@ -123,4 +123,8 @@ theme_name_empty=name can not be empty
i18n_public_chart=【Public Chart】
i18n_class_blue=Blue Tone
插件管理=Plugins
i18n_plugin_not_allow_delete=The plugin in in use cannot be deleted
\ No newline at end of file
i18n_plugin_not_allow_delete=The plugin in in use cannot be deleted
i18n_wrong_content=Wrong content
i18n_wrong_tel=Wrong tel format
i18n_wrong_email=Wrong email format
i18n_wrong_name_format=Wrong name format
......@@ -123,4 +123,8 @@ i18n_public_chart=【存量视图】
i18n_class_blue=蓝色调
插件管理=插件管理
i18n_plugin_not_allow_delete=正在使用的插件不允许删除
i18n_wrong_content=内容不合法
i18n_wrong_tel=电话格式错误
i18n_wrong_email=邮箱格式错误
i18n_wrong_name_format=姓名格式错误
......@@ -123,4 +123,8 @@ theme_name_empty=名稱不能為空
i18n_public_chart=【存量视图】
i18n_class_blue=蓝色调
插件管理=插件管理
i18n_plugin_not_allow_delete=正在使用的插件不允許刪除
\ No newline at end of file
i18n_plugin_not_allow_delete=正在使用的插件不允許刪除
i18n_wrong_content=內容不合法
i18n_wrong_tel=電話格式錯誤
i18n_wrong_email=郵箱格式錯誤
i18n_wrong_name_format=姓名格式錯誤
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论