mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
perf: 子域名托管重复域名不允许添加
This commit is contained in:
@@ -415,7 +415,7 @@ export default {
|
|||||||
is_present_no: "否",
|
is_present_no: "否",
|
||||||
basicInfo: "基础信息",
|
basicInfo: "基础信息",
|
||||||
titlea: "名称",
|
titlea: "名称",
|
||||||
disabled: "是否禁用",
|
disabled: "禁用",
|
||||||
ordera: "排序",
|
ordera: "排序",
|
||||||
supportBuy: "支持购买",
|
supportBuy: "支持购买",
|
||||||
intro: "介绍",
|
intro: "介绍",
|
||||||
|
|||||||
@@ -36,4 +36,25 @@ export class SubDomainService extends BaseService<SubDomainEntity> {
|
|||||||
return list.map(item=>item.domain);
|
return list.map(item=>item.domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async add(bean: SubDomainEntity) {
|
||||||
|
const {domain, userId} = bean;
|
||||||
|
if (!domain) {
|
||||||
|
throw new Error('域名不能为空');
|
||||||
|
}
|
||||||
|
if (!userId) {
|
||||||
|
throw new Error('用户ID不能为空');
|
||||||
|
}
|
||||||
|
const exist = await this.repository.findOne({
|
||||||
|
where: {
|
||||||
|
domain,
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (exist) {
|
||||||
|
throw new Error('域名已存在');
|
||||||
|
}
|
||||||
|
return await super.add(bean)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user