@be-link/ecommerce-trade-service-node-sdk 0.0.40 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/pos/orderCore/types.d.ts +1 -1
- package/package.json +1 -1
- package/utils/http.d.ts +1 -0
- package/utils/http.js +2 -0
package/package.json
CHANGED
package/utils/http.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare module '@fastify/request-context' {
|
|
|
5
5
|
pandoraUserId?: string;
|
|
6
6
|
beLinkUserId?: string;
|
|
7
7
|
pandoraRoleId?: string;
|
|
8
|
+
realIp?: string;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export declare function callApi<T extends (...args: any[]) => Promise<any>>(url: string, request?: Parameters<T>[0]): Promise<Awaited<ReturnType<T>>>;
|
package/utils/http.js
CHANGED
|
@@ -59,6 +59,7 @@ async function callApi(url, request) {
|
|
|
59
59
|
const pandoraUserId = request_context_1.requestContext.get('pandoraUserId') || '';
|
|
60
60
|
const beLinkUserId = request_context_1.requestContext.get('beLinkUserId') || '';
|
|
61
61
|
const pandoraRoleId = request_context_1.requestContext.get('pandoraRoleId') || '';
|
|
62
|
+
const realIp = request_context_1.requestContext.get('realIp') || '';
|
|
62
63
|
try {
|
|
63
64
|
console.info(`准备发起ecommerce-trade-service请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
|
|
64
65
|
const response = await axios_1.default.post(url, request, {
|
|
@@ -67,6 +68,7 @@ async function callApi(url, request) {
|
|
|
67
68
|
'x-belink-pandora-userid': pandoraUserId,
|
|
68
69
|
'x-belink-userid': beLinkUserId,
|
|
69
70
|
'x-belink-pandora-roleid': pandoraRoleId,
|
|
71
|
+
'x-real-ip': realIp,
|
|
70
72
|
},
|
|
71
73
|
});
|
|
72
74
|
const responseData = response.data;
|