chore: 新网dns完善

v2
xiaojunnuo 2025-09-23 23:27:36 +08:00
parent 298f7d9d52
commit 2c1600ddfb
5 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,24 @@
import { Inject, Provide, Scope, ScopeEnum } from "@midwayjs/core";
import { PlusService } from "./plus-service.js";
import { IOcrService } from "@certd/plugin-lib";
/**
*/
@Provide("ocrService")
@Scope(ScopeEnum.Request, { allowDowngrade: true })
export class OcrService implements IOcrService {
@Inject()
plusService: PlusService;
async doOcrFromImage(opts: { image: string }): Promise<{ texts: string[] }> {
const res = await this.plusService.requestWithToken({
url: "/activation/certd/ocr",
method: "post",
data: {
image: opts.image
}
});
return res;
}
}

View File

@ -4,7 +4,7 @@ import { cache, http, HttpRequestConfig, logger } from '@certd/basic';
import { SysInstallInfo, SysLicenseInfo, SysSettingsService } from '../../settings/index.js';
import { merge } from 'lodash-es';
@Provide()
@Provide("plusService")
@Scope(ScopeEnum.Request, { allowDowngrade: true })
export class PlusService {
@Inject()

View File

@ -7,3 +7,4 @@ export * from "./qiniu/index.js";
export * from "./ctyun/index.js";
export * from "./oss/index.js";
export * from "./s3/index.js";
export * from "./lib/index.js";

View File

@ -0,0 +1 @@
export * from "./ocr-api.js";

View File

@ -0,0 +1,3 @@
export interface IOcrService {
doOcrFromImage(opts: { image: string }): Promise<{ texts: string[] }>;
}