diff --git a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/http-verify-plan.vue b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/http-verify-plan.vue
index f0c0bebd..16c66497 100644
--- a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/http-verify-plan.vue
+++ b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/http-verify-plan.vue
@@ -33,6 +33,7 @@
import { Ref, ref, watch, nextTick } from "vue";
import { HttpRecord } from "/@/components/plugins/cert/domains-verify-plan-editor/type";
import { dict } from "@fast-crud/fast-crud";
+import { Dicts } from "/@/components/plugins/lib/dicts";
defineOptions({
name: "HttpVerifyPlan",
@@ -68,17 +69,7 @@ async function onRecordChange() {
emit("change", records.value);
}
-const uploaderTypeDict = dict({
- data: [
- { label: "SFTP", value: "sftp" },
- { label: "FTP", value: "ftp" },
- { label: "阿里云OSS", value: "alioss" },
- { label: "腾讯云COS", value: "tencentcos" },
- { label: "七牛OSS", value: "qiniuoss" },
- { label: "S3/Minio", value: "s3" },
- { label: "SSH(已废弃,请选择SFTP方式)", value: "ssh", disabled: true },
- ],
-});
+const uploaderTypeDict = Dicts.uploaderTypeDict;
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/dicts.ts b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/dicts.ts
deleted file mode 100644
index d135544b..00000000
--- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/dicts.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { dict } from "@fast-crud/fast-crud";
-
-export const Dicts = {
- sslProviderDict: dict({
- data: [
- { value: "letsencrypt", label: "Let‘s Encrypt" },
- { value: "zerossl", label: "ZeroSSL" },
- ],
- }),
- challengeTypeDict: dict({ data: [{ value: "dns", label: "DNS校验" }] }),
- dnsProviderTypeDict: dict({
- url: "pi/dnsProvider/dnsProviderTypeDict",
- }),
-};
diff --git a/packages/ui/certd-server/db/migration/v10027__auto.sql b/packages/ui/certd-server/db/migration/v10027__auto.sql
new file mode 100644
index 00000000..512cfaa2
--- /dev/null
+++ b/packages/ui/certd-server/db/migration/v10027__auto.sql
@@ -0,0 +1,19 @@
+CREATE TABLE "cd_domain"
+(
+ "id" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ "user_id" integer,
+ "domain" varchar(1024),
+ challenge_type varchar(50),
+ dns_provider_type varchar(50),
+ dns_provider_access bigint,
+ http_uploader_type varchar(50),
+ http_uploader_access bigint,
+ http_upload_root_dir varchar(512),
+ "disabled" boolean NOT NULL DEFAULT (false),
+ "create_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP),
+ "update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP)
+);
+
+CREATE INDEX "index_domain_user_id" ON "cd_domain" ("user_id");
+CREATE INDEX "index_domain_domain" ON "cd_domain" ("domain");
+
diff --git a/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts b/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts
new file mode 100644
index 00000000..ffcb0bd2
--- /dev/null
+++ b/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts
@@ -0,0 +1,81 @@
+import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
+import { Constants, CrudController } from '@certd/lib-server';
+import {DomainService} from "../../../modules/cert/service/domain-service.js";
+
+/**
+ * 授权
+ */
+@Provide()
+@Controller('/api/cert/domain')
+export class DomainController extends CrudController {
+ @Inject()
+ service: DomainService;
+
+ getService(): DomainService {
+ return this.service;
+ }
+
+ @Post('/page', { summary: Constants.per.authOnly })
+ async page(@Body(ALL) body: any) {
+ body.query = body.query ?? {};
+ body.query.userId = this.getUserId();
+ const domain = body.query.domain;
+ delete body.query.domain;
+
+ const bq = qb => {
+ if (domain) {
+ qb.andWhere('domain like :domain', { domain: `%${domain}%` });
+ }
+ };
+
+ const pageRet = await this.getService().page({
+ query: body.query,
+ page: body.page,
+ sort: body.sort,
+ buildQuery: bq,
+ });
+ return this.ok(pageRet);
+ }
+
+ @Post('/list', { summary: Constants.per.authOnly })
+ async list(@Body(ALL) body: any) {
+ body.query = body.query ?? {};
+ body.query.userId = this.getUserId();
+ const list = await this.getService().list(body);
+ return this.ok(list);
+ }
+
+ @Post('/add', { summary: Constants.per.authOnly })
+ async add(@Body(ALL) bean: any) {
+ bean.userId = this.getUserId();
+ return super.add(bean);
+ }
+
+ @Post('/update', { summary: Constants.per.authOnly })
+ async update(@Body(ALL) bean: any) {
+ await this.service.checkUserId(bean.id, this.getUserId());
+ delete bean.userId;
+ return super.update(bean);
+ }
+
+ @Post('/info', { summary: Constants.per.authOnly })
+ async info(@Query('id') id: number) {
+ await this.service.checkUserId(id, this.getUserId());
+ return super.info(id);
+ }
+
+ @Post('/delete', { summary: Constants.per.authOnly })
+ async delete(@Query('id') id: number) {
+ await this.service.checkUserId(id, this.getUserId());
+ return super.delete(id);
+ }
+
+ @Post('/deleteByIds', { summary: Constants.per.authOnly })
+ async deleteByIds(@Body(ALL) body: any) {
+ await this.service.delete(body.ids, {
+ userId: this.getUserId(),
+ });
+ return this.ok();
+ }
+
+}
diff --git a/packages/ui/certd-server/src/modules/cert/entity/domain.ts b/packages/ui/certd-server/src/modules/cert/entity/domain.ts
index 5bfb8b5b..51c36fe1 100644
--- a/packages/ui/certd-server/src/modules/cert/entity/domain.ts
+++ b/packages/ui/certd-server/src/modules/cert/entity/domain.ts
@@ -13,26 +13,26 @@ export class DomainEntity {
@Column({ comment: '主域名', length: 100 })
domain: string;
- @Column({ comment: '校验类型', name: 'challenge_type', length: 100 })
+ @Column({ comment: '校验类型', name: 'challenge_type', length: 50 })
challengeType : string;
- @Column({ comment: 'DNS提供商', name: 'dns_provider_type', length: 100 })
+ @Column({ comment: 'DNS提供商', name: 'dns_provider_type', length: 50 })
dnsProviderType: string;
- @Column({ comment: 'DNS提供商授权', name: 'dns_provider_access', length: 200 })
+ @Column({ comment: 'DNS提供商授权', name: 'dns_provider_access' })
dnsProviderAccess: number;
@Column({ comment: '是否禁用', name: 'disabled' })
disabled: boolean;
- @Column({ comment: 'http上传类型', name: 'http_uploader_type', length: 200 })
+ @Column({ comment: 'http上传类型', name: 'http_uploader_type', length: 50 })
httpUploaderType: string;
- @Column({ comment: 'http上传授权', name: 'http_uploader_access', length: 200 })
+ @Column({ comment: 'http上传授权', name: 'http_uploader_access' })
httpUploaderAccess: number;
- @Column({ comment: 'http上传根目录', name: 'http_upload_root_dir', length: 200 })
+ @Column({ comment: 'http上传根目录', name: 'http_upload_root_dir', length: 512 })
httpUploadRootDir: string;
@Column({