chore: 补充其他access的测试按钮

This commit is contained in:
xiaojunnuo
2026-02-15 22:45:22 +08:00
parent 9671348dc1
commit 7cd8a645a8
16 changed files with 420 additions and 136 deletions
@@ -1,4 +1,5 @@
import { AccessInput, BaseAccess, IsAccess } from "@certd/pipeline";
import { AccessInput, BaseAccess, IsAccess, PageSearch } from "@certd/pipeline";
import { QiniuClient } from "./lib/sdk.js";
@IsAccess({
name: "qiniu",
@@ -21,6 +22,34 @@ export class QiniuAccess extends BaseAccess {
helper: "SK",
})
secretKey!: string;
@AccessInput({
title: "测试",
component: {
name: "api-test",
action: "onTestRequest",
},
helper: "点击测试接口看是否正常",
})
testRequest = true;
async onTestRequest() {
await this.getDomainList();
return "ok";
}
async getDomainList(req: PageSearch = {}) {
const qiniuClient = new QiniuClient({
http: this.ctx.http,
access:this,
logger: this.ctx.logger,
});
const url = `https://api.qiniu.com/domain?limit=${req.pageSize || 1000}`;
const res = await qiniuClient.doRequest(url, 'get');
return res.domains||[]
}
}
new QiniuAccess();