mirror of https://github.com/certd/certd
fix: 修复某些情况下bindUrl失败的bug
parent
4244569211
commit
91fc1cd735
|
@ -1,4 +1,4 @@
|
|||
import { Config, Init, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { AppKey, PlusRequestService, verify } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { SysInstallInfo, SysLicenseInfo, SysSettingsService } from '../../settings/index.js';
|
||||
|
@ -11,26 +11,26 @@ export class PlusService {
|
|||
@Config('plus.server.baseUrls')
|
||||
plusServerBaseUrls: string[];
|
||||
|
||||
plusRequestService: PlusRequestService;
|
||||
|
||||
@Init()
|
||||
async init() {
|
||||
async getPlusRequestService() {
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
this.plusRequestService = new PlusRequestService({
|
||||
return new PlusRequestService({
|
||||
plusServerBaseUrls: this.plusServerBaseUrls,
|
||||
subjectId: installInfo.siteId,
|
||||
});
|
||||
}
|
||||
|
||||
async requestWithoutSign(config: any) {
|
||||
return await this.plusRequestService.requestWithoutSign(config);
|
||||
const plusRequestService = await this.getPlusRequestService();
|
||||
return await plusRequestService.requestWithoutSign(config);
|
||||
}
|
||||
async request(config: any) {
|
||||
return await this.plusRequestService.request(config);
|
||||
const plusRequestService = await this.getPlusRequestService();
|
||||
return await plusRequestService.request(config);
|
||||
}
|
||||
|
||||
async active(formData: { code: any; appKey: string; subjectId: string }) {
|
||||
return await this.plusRequestService.requestWithoutSign({
|
||||
const plusRequestService = await this.getPlusRequestService();
|
||||
return await plusRequestService.requestWithoutSign({
|
||||
url: '/activation/active',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
|
@ -55,16 +55,18 @@ export class PlusService {
|
|||
const licenseInfo: SysLicenseInfo = await this.sysSettingsService.getSetting(SysLicenseInfo);
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
|
||||
const plusRequestService = await this.getPlusRequestService();
|
||||
return await verify({
|
||||
subjectId: installInfo.siteId,
|
||||
license: licenseInfo.license,
|
||||
plusRequestService: this.plusRequestService,
|
||||
plusRequestService: plusRequestService,
|
||||
bindUrl: installInfo?.bindUrl,
|
||||
});
|
||||
}
|
||||
|
||||
async bindUrl(subjectId: string, url: string) {
|
||||
return await this.plusRequestService.request({
|
||||
const plusRequestService = await this.getPlusRequestService();
|
||||
return await plusRequestService.request({
|
||||
url: '/activation/subject/urlBind',
|
||||
data: {
|
||||
subjectId,
|
||||
|
|
|
@ -22,19 +22,19 @@ typeorm:
|
|||
default:
|
||||
database: './data/db-comm.sqlite'
|
||||
|
||||
plus:
|
||||
server:
|
||||
baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
|
||||
|
||||
account:
|
||||
server:
|
||||
baseUrl: 'https://ai.handsfree.work/subject'
|
||||
|
||||
#
|
||||
#plus:
|
||||
# server:
|
||||
# baseUrls: ['http://127.0.0.1:11007']
|
||||
# baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
|
||||
#
|
||||
#account:
|
||||
# server:
|
||||
# baseUrl: 'http://127.0.0.1:1017/subject'
|
||||
# baseUrl: 'https://ai.handsfree.work/subject'
|
||||
|
||||
|
||||
plus:
|
||||
server:
|
||||
baseUrls: ['http://127.0.0.1:11007']
|
||||
|
||||
account:
|
||||
server:
|
||||
baseUrl: 'http://127.0.0.1:1017/subject'
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# key: ./data/ssl/cert.key
|
||||
# cert: ./data/ssl/cert.crt
|
||||
#plus:
|
||||
# server:
|
||||
# baseUrl: 'http://127.0.0.1:11007'
|
||||
|
||||
#flyway:
|
||||
# scriptDir: './db/migration-pg'
|
||||
|
||||
#typeorm:
|
||||
# dataSource:
|
||||
# default:
|
||||
# type: postgres
|
||||
# host: localhost
|
||||
# port: 5433
|
||||
# username: postgres
|
||||
# password: root
|
||||
# database: postgres
|
||||
|
||||
typeorm:
|
||||
dataSource:
|
||||
default:
|
||||
database: './data/db-comm-pro.sqlite'
|
||||
|
||||
plus:
|
||||
server:
|
||||
baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
|
||||
|
||||
account:
|
||||
server:
|
||||
baseUrl: 'https://ai.handsfree.work/subject'
|
||||
|
||||
#
|
||||
#plus:
|
||||
# server:
|
||||
# baseUrls: ['http://127.0.0.1:11007']
|
||||
#
|
||||
#account:
|
||||
# server:
|
||||
# baseUrl: 'http://127.0.0.1:1017/subject'
|
|
@ -8,6 +8,7 @@
|
|||
"start": "cross-env NODE_ENV=production node ./bootstrap.js",
|
||||
"dev": "cross-env NODE_ENV=local mwtsc --watch --run @midwayjs/mock/app",
|
||||
"commdev": "cross-env NODE_ENV=commdev mwtsc --watch --run @midwayjs/mock/app",
|
||||
"commpro": "cross-env NODE_ENV=commpro mwtsc --watch --run @midwayjs/mock/app",
|
||||
"pgdev": "cross-env NODE_ENV=pgdev mwtsc --watch --run @midwayjs/mock/app",
|
||||
"test": "cross-env NODE_ENV=unittest mocha",
|
||||
"cov": "cross-env c8 --all --reporter=text --reporter=lcovonly npm run test",
|
||||
|
|
Loading…
Reference in New Issue