zhengyiming
5 天以前 aceaa78144032843c543b0ba3a54bed9c529c0c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as ocrUtilsServices from '@/services/api/ocrUtils';
import { UploadUserFile } from '@bole-core/components';
import _ from 'lodash';
 
type VatLicenseOptions = {
  onSuccess?: (res: API.BaiduOcrBusinessLicenseResultModel) => any;
};
 
export async function vatLicense(response: UploadUserFile, options: VatLicenseOptions = {}) {
  try {
    if (response?.url) {
      const { onSuccess } = options;
      let res = await ocrUtilsServices.getLicenseOcr({
        url: response.url,
      });
      onSuccess?.(res.model);
    }
  } catch (error) {}
}
 
type UserCredentialVerifyOcrIDCardOptions = {
  access?: EnumOcrAccess;
  scene?: string;
  isOssUrl?: boolean;
  url?: string;
  onSuccess?: (res: API.BaiduOcrIdentityFrontResultModel) => any;
};
 
export async function userCredentialVerifyOcrIDCard(
  options: UserCredentialVerifyOcrIDCardOptions = {}
) {
  try {
    const { onSuccess, access, isOssUrl, url, scene } = options;
    if (url) {
      let res = await ocrUtilsServices.getIdentityFrontOcr({
        access: access,
        url: url,
        isOssUrl: isOssUrl,
      });
      onSuccess?.(res.model);
    }
  } catch (error) {}
}