mirror of
https://github.com/certd/certd.git
synced 2026-04-24 20:57:26 +08:00
chore: 新网dns完善
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import { cache, http, HttpRequestConfig, logger } from '@certd/basic';
|
|||||||
import { SysInstallInfo, SysLicenseInfo, SysSettingsService } from '../../settings/index.js';
|
import { SysInstallInfo, SysLicenseInfo, SysSettingsService } from '../../settings/index.js';
|
||||||
import { merge } from 'lodash-es';
|
import { merge } from 'lodash-es';
|
||||||
|
|
||||||
@Provide()
|
@Provide("plusService")
|
||||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||||
export class PlusService {
|
export class PlusService {
|
||||||
@Inject()
|
@Inject()
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ export * from "./qiniu/index.js";
|
|||||||
export * from "./ctyun/index.js";
|
export * from "./ctyun/index.js";
|
||||||
export * from "./oss/index.js";
|
export * from "./oss/index.js";
|
||||||
export * from "./s3/index.js";
|
export * from "./s3/index.js";
|
||||||
|
export * from "./lib/index.js";
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./ocr-api.js";
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export interface IOcrService {
|
||||||
|
doOcrFromImage(opts: { image: string }): Promise<{ texts: string[] }>;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user