@be-link/ecommerce-product-service-node-sdk 0.1.17 → 0.1.19
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/job/service.d.ts +1 -0
- package/modules/job/service.js +7 -0
- package/modules/job/types.d.ts +4 -0
- package/package.json +1 -1
- package/utils/http.js +2 -1
package/modules/job/service.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import BaseService from '../BaseService';
|
|
|
3
3
|
declare class JobService extends BaseService implements Service.JobController {
|
|
4
4
|
protected prefixUrl: string;
|
|
5
5
|
handleScheduledTasks(): Promise<void>;
|
|
6
|
+
syncQuantityTasks(): Promise<void>;
|
|
6
7
|
}
|
|
7
8
|
export declare const jobService: JobService;
|
|
8
9
|
export default jobService;
|
package/modules/job/service.js
CHANGED
|
@@ -21,11 +21,18 @@ let JobService = class JobService extends BaseService_1.default {
|
|
|
21
21
|
handleScheduledTasks() {
|
|
22
22
|
return (0, http_1.callApi)(this.getApiUrl(this.handleScheduledTasks));
|
|
23
23
|
}
|
|
24
|
+
syncQuantityTasks() {
|
|
25
|
+
return (0, http_1.callApi)(this.getApiUrl(this.syncQuantityTasks));
|
|
26
|
+
}
|
|
24
27
|
};
|
|
25
28
|
__decorate([
|
|
26
29
|
(0, tsoa_1.OperationId)('处理定时任务'),
|
|
27
30
|
(0, tsoa_1.Post)('handle-scheduled-tasks')
|
|
28
31
|
], JobService.prototype, "handleScheduledTasks", null);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, tsoa_1.OperationId)('同步商品数量缓存到数据库'),
|
|
34
|
+
(0, tsoa_1.Post)('sync-quantity-tasks')
|
|
35
|
+
], JobService.prototype, "syncQuantityTasks", null);
|
|
29
36
|
JobService = __decorate([
|
|
30
37
|
(0, tsoa_1.Route)('job'),
|
|
31
38
|
(0, tsoa_1.Tags)('Job')
|
package/modules/job/types.d.ts
CHANGED
package/package.json
CHANGED
package/utils/http.js
CHANGED
|
@@ -89,7 +89,7 @@ async function callApi(url, request) {
|
|
|
89
89
|
const beLinkUserId = ctx?.get('beLinkUserId') || '';
|
|
90
90
|
const pandoraRoleId = ctx?.get('pandoraRoleId') || '';
|
|
91
91
|
const realIp = ctx?.get('realIp') || '';
|
|
92
|
-
const response = await axios_1.default.post(url, request, {
|
|
92
|
+
const response = await axios_1.default.post(url, request || {}, {
|
|
93
93
|
headers: {
|
|
94
94
|
'x-request-id': requestId,
|
|
95
95
|
'x-belink-pandora-userid': pandoraUserId,
|
|
@@ -97,6 +97,7 @@ async function callApi(url, request) {
|
|
|
97
97
|
'x-belink-pandora-roleid': pandoraRoleId,
|
|
98
98
|
'x-real-ip': realIp,
|
|
99
99
|
Connection: 'keep-alive',
|
|
100
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
100
101
|
},
|
|
101
102
|
timeout: HTTP_CONFIG.requestTimeout,
|
|
102
103
|
httpAgent,
|