mirror of https://github.com/certd/certd
chore: 新网dns完善
parent
298f7d9d52
commit
2c1600ddfb
|
@ -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 { merge } from 'lodash-es';
|
||||
|
||||
@Provide()
|
||||
@Provide("plusService")
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class PlusService {
|
||||
@Inject()
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export * from "./ocr-api.js";
|
|
@ -0,0 +1,3 @@
|
|||
export interface IOcrService {
|
||||
doOcrFromImage(opts: { image: string }): Promise<{ texts: string[] }>;
|
||||
}
|
Loading…
Reference in New Issue