chore: pipeline utils 转移到basic

This commit is contained in:
xiaojunnuo
2024-10-08 19:02:51 +08:00
parent 01b79bbeaf
commit 9498d189e4
31 changed files with 301 additions and 104 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
"@midwayjs/logger": "^3.1.0",
"@midwayjs/static-file": "^3.16.4",
"@midwayjs/typeorm": "^3.16.4",
"@midwayjs/upload": "3",
"@midwayjs/upload": "~3.16.4",
"@midwayjs/validate": "^3.16.4",
"ali-oss": "^6.21.0",
"axios": "^1.7.2",
@@ -1,7 +1,7 @@
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
import { SysSettingsService } from '@certd/lib-server';
import { ALL, Body, Controller, Get, Inject, Post, Provide } from '@midwayjs/core';
import { Constants, SysSettingsService } from '@certd/lib-server';
import { BaseController } from '@certd/lib-server';
import { AppKey } from '@certd/pipeline';
import { AppKey, http, PlusRequestService, verify } from '@certd/pipeline';
import { SysInstallInfo } from '@certd/lib-server';
import { logger } from '@certd/pipeline';
import { PlusService } from '@certd/lib-server';
@@ -50,6 +50,49 @@ export class SysPlusController extends BaseController {
installInfo.bindUrl = url;
await this.sysSettingsService.saveSetting(installInfo);
//重新验证配置
await this.plusService.verify();
return this.ok(true);
}
@Get('/test', { summary: Constants.per.guest })
async test() {
const subjectId = 'vpyoZb6fDBjzzSZp67OBP';
const license = '';
const timestamps = 1728365013899;
const bindUrl = 'http://89.21.0.171:7001/';
const service = new PlusRequestService({
logger: logger,
http: http,
subjectId: subjectId,
plusServerBaseUrls: ['https://api.ai.handsfree.work'],
});
const body = { subjectId, appKey: 'kQth6FHM71IPV3qdWc', url: bindUrl };
async function test() {
await verify({
subjectId: subjectId,
license: license,
plusRequestService: service,
});
const res = await service.sign(body, timestamps);
console.log('sign:', res);
const res2 = await service.request({
url: '/activation/subject/vip/check',
data: {
url: 'http://127.0.0.1:7001/',
},
});
console.log('res2:', res2);
}
console.log('2222');
await test();
console.log('3333');
return this.ok(true);
}
}