common.ts
2.11 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { RpcApiClient } from '../core/rpc-client';
import type { DictItem, MerchantRow } from '../core/types';
/** 下拉 / 字典 / 权限树公共接口。method 名逐字取自老 H5 源码。 */
class CommonApi extends RpcApiClient {
findAllDictData(dictType: string) {
return this.rpc<DictItem[]>('entmicro-account', 'merchants.api.menu.findAllDictData', {
dictType,
});
}
findAllMerchant() {
return this.rpc<MerchantRow[]>('entmicro-account', 'merchants.api.menu.findAllMerchant');
}
findMerchantTree(id?: string | number) {
return this.rpc<unknown>('entmicro-account', 'merchants.api.merchant.findMerchantTree', { id });
}
findMenuFunTreeByMerId(params: Record<string, unknown>) {
return this.rpc<unknown>(
'entmicro-account',
'merchants.api.merchant.findMenuFunTreeByMerId',
params,
);
}
findMenuFunTreeByRoleId(id: string | number) {
return this.rpc<unknown>('entmicro-account', 'merchants.api.merchant.findMenuFunTreeByRoleId', {
id,
});
}
getCarbrandTree() {
return this.rpc<unknown>('entmicro-account', 'merchants.api.merchantCommon.getCarbrandTree');
}
accountTypeSearchRequest(params: Record<string, unknown>) {
return this.rpc<unknown>(
'entmicro-account',
'merchants.api.merchant.accountTypeSearchRequest',
params,
);
}
findPermissionsByMerId(id: string | number) {
return this.rpc<unknown>('entmicro-account', 'merchants.api.merchant.findPermissionsByMerId', {
id,
});
}
roleList(id: string | number) {
return this.rpc<unknown>('entmicro-account', 'merchants.api.role.list', {
id,
delFlag: 0,
});
}
/**
* 老 request.js 的 isOtherUrl 分支:独立上传网关、app_key、MD5、file 不参与签名。
* file 的值逐字保留 `<扩展名>@<base64>` 拼法;不做任何本地 fetch / Blob 落地。
*/
uploadFile(file: string) {
return this.rpc<string>(
'account-upload',
'glsx.accounts.biz.common.pictureUpload',
{ file },
{ unsignedKeys: ['file'], noSession: true },
);
}
}
export const commonApi = new CommonApi();