wupengfei
2025-02-14 b61e0dd54ca5adf96bea4fd1f92d498fe5245ff4
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
44
import * as accountServices from '@12333/services/api/Account';
import * as commonServices from '@12333/services/api/Common';
import { FileItem } from '@nutui/nutui-taro/dist/types/__VUE/uploader/type';
import _ from 'lodash';
 
type VatLicenseOptions = {
  onSuccess?: (res: API.LicenseOcrModel) => any;
};
 
export async function vatLicense(response: FileItem, options: VatLicenseOptions = {}) {
  try {
    if (response?.url) {
      const { onSuccess } = options;
      let res = await accountServices.vatLicense({
        url: response.url,
      });
      onSuccess?.(
        _.mapValues(res, (x) => {
          if (x === '无') return '';
          return x;
        })
      );
    }
  } catch (error) {}
}
 
type UserCredentialVerifyOcrIDCardOptions = {
  onSuccess?: (res: API.UserCredentialVerifyOcrIDCardResponse) => any;
};
 
export async function userCredentialVerifyOcrIDCard(
  response: FileItem,
  options: UserCredentialVerifyOcrIDCardOptions = {}
) {
  try {
    if (response?.url) {
      const { onSuccess } = options;
      let res = await commonServices.userCredentialVerifyOcrIDCard({
        identityImageUrl: response.url,
      });
      onSuccess?.(res);
    }
  } catch (error) {}
}