fix: 解决 PHP 模版添加失败的问题 (#3541)

This commit is contained in:
zhengkunwang 2024-01-09 15:57:34 +08:00 committed by GitHub
parent c4b7dd70cb
commit 45a58b3b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@ func (p PHPExtensionsService) List() ([]response.PHPExtensionsDTO, error) {
func (p PHPExtensionsService) Create(req request.PHPExtensionsCreate) error {
exist, _ := phpExtensionsRepo.GetFirst(commonRepo.WithByName(req.Name))
if exist.ID == 0 {
if exist.ID > 0 {
return buserr.New(constant.ErrNameIsExist)
}
extension := model.PHPExtensions{

View File

@ -478,7 +478,7 @@ const checkPHPExtensions = (rule, value, callback) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.phpExtension')));
} else {
const reg = /^[a-z0-9,_]{3,300}$/;
const reg = /^[a-z0-9,_]{1,300}$/;
if (!reg.test(value)) {
callback(new Error(i18n.global.t('commons.rule.phpExtension')));
} else {

View File

@ -54,7 +54,7 @@ const loading = ref(false);
const updateID = ref(0);
const extensionsForm = ref<FormInstance>();
const rules = ref({
name: [Rules.requiredInput],
name: [Rules.requiredInput, Rules.name],
extensions: [Rules.requiredInput, Rules.phpExtensions],
});
const em = defineEmits(['close']);