mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
chore: 优化插件的翻页查询
This commit is contained in:
@@ -75,20 +75,16 @@ export class RainyunAccess extends BaseAccess {
|
||||
}
|
||||
|
||||
|
||||
async getCertList(req:{offset?:number,limit?:number,query?:string}){
|
||||
const size = req.limit ?? 20;
|
||||
const offset = req.offset ?? 0;
|
||||
let page = Math.floor(offset / size);
|
||||
if(offset % size === 0 ){
|
||||
page++
|
||||
}
|
||||
async getCertList(req:{pageNo?:number,pageSize?:number,query?:string}){
|
||||
const pageNo = req.pageNo ?? 1;
|
||||
const pageSize = req.pageSize ?? 20;
|
||||
const options ={
|
||||
columnFilters: {
|
||||
Domain: req.query??""
|
||||
},
|
||||
sort:[],
|
||||
page: page,
|
||||
perPage: size,
|
||||
page: pageNo,
|
||||
perPage: pageSize,
|
||||
|
||||
}
|
||||
const res = await this.doRequest({
|
||||
@@ -99,8 +95,8 @@ export class RainyunAccess extends BaseAccess {
|
||||
return {
|
||||
total: res.TotalRecords,
|
||||
list: res.Records || [],
|
||||
limit: size,
|
||||
offset: offset
|
||||
pageNo: pageNo,
|
||||
pageSize: pageSize
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,11 +81,11 @@ export class RainyunRefreshCert extends AbstractTaskPlugin {
|
||||
async onGetCertList(req: PageSearch = {}) {
|
||||
const access = await this.getAccess<RainyunAccess>(this.accessId);
|
||||
|
||||
const offset = req.offset ?? 0;
|
||||
const limit = req.limit ?? 100;
|
||||
const pageNo = req.pageNo ?? 1;
|
||||
const pageSize = req.pageSize ?? 100;
|
||||
const res = await access.getCertList({
|
||||
offset,
|
||||
limit
|
||||
pageNo,
|
||||
pageSize
|
||||
});
|
||||
const total = res.total;
|
||||
const list = res.list;
|
||||
@@ -103,8 +103,8 @@ export class RainyunRefreshCert extends AbstractTaskPlugin {
|
||||
return {
|
||||
list: this.ctx.utils.options.buildGroupOptions(options, this.certDomains),
|
||||
total: total,
|
||||
offset: offset,
|
||||
limit: limit
|
||||
pageNo: pageNo,
|
||||
pageSize: pageSize
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user