mirror of
https://github.com/certd/certd.git
synced 2026-07-29 08:37:36 +08:00
chore: 补充其他access的测试按钮
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user