@be-link/ecommerce-product-service-node-sdk 0.0.12 → 0.0.14
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/enum.d.ts +8 -0
- package/enum.js +10 -0
- package/modules/product/service.d.ts +1 -0
- package/modules/product/service.js +8 -0
- package/modules/product/types.d.ts +9 -1
- package/modules/productExp/service.d.ts +2 -0
- package/modules/productExp/service.js +16 -0
- package/modules/productExp/types.d.ts +20 -2
- package/package.json +1 -1
- package/utils/http.d.ts +3 -0
- package/utils/http.js +9 -1
package/enum.d.ts
CHANGED
|
@@ -66,6 +66,14 @@ export declare namespace ENUM {
|
|
|
66
66
|
JZH = "\u4EC5\u9650\u6C5F\u6D59\u6CAA\u53D1\u8D27",
|
|
67
67
|
REMOTE_AREAS = "\u504F\u8FDC\u5730\u533A\u4E0D\u53D1\u8D27"
|
|
68
68
|
}
|
|
69
|
+
enum STORE_SCOPE_TYPE {
|
|
70
|
+
VISIBLE = "VISIBLE",
|
|
71
|
+
INVISIBLE = "INVISIBLE"
|
|
72
|
+
}
|
|
73
|
+
enum STORE_SCOPE_TYPE_CHINESE {
|
|
74
|
+
VISIBLE = "\u53EF\u89C1",
|
|
75
|
+
INVISIBLE = "\u4E0D\u53EF\u89C1"
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
namespace TASK_ENUM {
|
|
71
79
|
enum STATUS {
|
package/enum.js
CHANGED
|
@@ -86,6 +86,16 @@ var ENUM;
|
|
|
86
86
|
FREIGHT_TYPE_CHINESE["JZH"] = "\u4EC5\u9650\u6C5F\u6D59\u6CAA\u53D1\u8D27";
|
|
87
87
|
FREIGHT_TYPE_CHINESE["REMOTE_AREAS"] = "\u504F\u8FDC\u5730\u533A\u4E0D\u53D1\u8D27";
|
|
88
88
|
})(FREIGHT_TYPE_CHINESE = PRODUCT_ENUM.FREIGHT_TYPE_CHINESE || (PRODUCT_ENUM.FREIGHT_TYPE_CHINESE = {}));
|
|
89
|
+
let STORE_SCOPE_TYPE;
|
|
90
|
+
(function (STORE_SCOPE_TYPE) {
|
|
91
|
+
STORE_SCOPE_TYPE["VISIBLE"] = "VISIBLE";
|
|
92
|
+
STORE_SCOPE_TYPE["INVISIBLE"] = "INVISIBLE";
|
|
93
|
+
})(STORE_SCOPE_TYPE = PRODUCT_ENUM.STORE_SCOPE_TYPE || (PRODUCT_ENUM.STORE_SCOPE_TYPE = {}));
|
|
94
|
+
let STORE_SCOPE_TYPE_CHINESE;
|
|
95
|
+
(function (STORE_SCOPE_TYPE_CHINESE) {
|
|
96
|
+
STORE_SCOPE_TYPE_CHINESE["VISIBLE"] = "\u53EF\u89C1";
|
|
97
|
+
STORE_SCOPE_TYPE_CHINESE["INVISIBLE"] = "\u4E0D\u53EF\u89C1";
|
|
98
|
+
})(STORE_SCOPE_TYPE_CHINESE = PRODUCT_ENUM.STORE_SCOPE_TYPE_CHINESE || (PRODUCT_ENUM.STORE_SCOPE_TYPE_CHINESE = {}));
|
|
89
99
|
})(PRODUCT_ENUM = ENUM.PRODUCT_ENUM || (ENUM.PRODUCT_ENUM = {}));
|
|
90
100
|
let TASK_ENUM;
|
|
91
101
|
(function (TASK_ENUM) {
|
|
@@ -15,6 +15,7 @@ declare class ProductService extends BaseService implements Service.ProductContr
|
|
|
15
15
|
querySkuBaseInfo(request: Service.Request.querySkuBaseInfo): Promise<Service.Response.querySkuBaseInfo[]>;
|
|
16
16
|
getProductDetail(request: Service.Request.detail): Promise<Service.Response.getProductDetail>;
|
|
17
17
|
isSoldOut(request: Service.Request.isSoldOut): Promise<Service.Response.isSoldOut>;
|
|
18
|
+
deleteScheduledTask(request: Service.Request.deleteScheduledTask): Promise<void>;
|
|
18
19
|
}
|
|
19
20
|
export declare const productService: ProductService;
|
|
20
21
|
export default productService;
|
|
@@ -60,6 +60,9 @@ let ProductService = class ProductService extends BaseService_1.default {
|
|
|
60
60
|
isSoldOut(request) {
|
|
61
61
|
return (0, http_1.callApi)(this.getApiUrl(this.isSoldOut), request);
|
|
62
62
|
}
|
|
63
|
+
deleteScheduledTask(request) {
|
|
64
|
+
return (0, http_1.callApi)(this.getApiUrl(this.deleteScheduledTask), request);
|
|
65
|
+
}
|
|
63
66
|
};
|
|
64
67
|
__decorate([
|
|
65
68
|
(0, tsoa_1.OperationId)('商品列表'),
|
|
@@ -126,6 +129,11 @@ __decorate([
|
|
|
126
129
|
(0, tsoa_1.Post)('is-sold-out'),
|
|
127
130
|
__param(0, (0, tsoa_1.Body)())
|
|
128
131
|
], ProductService.prototype, "isSoldOut", null);
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, tsoa_1.OperationId)('删除定时任务'),
|
|
134
|
+
(0, tsoa_1.Post)('delete-scheduled-task'),
|
|
135
|
+
__param(0, (0, tsoa_1.Body)())
|
|
136
|
+
], ProductService.prototype, "deleteScheduledTask", null);
|
|
129
137
|
ProductService = __decorate([
|
|
130
138
|
(0, tsoa_1.Route)('product'),
|
|
131
139
|
(0, tsoa_1.Tags)('Product')
|
|
@@ -35,6 +35,7 @@ export declare namespace ProductService {
|
|
|
35
35
|
* 定时任务接口
|
|
36
36
|
*/
|
|
37
37
|
interface ScheduledTask {
|
|
38
|
+
id?: string;
|
|
38
39
|
scheduledTime: number;
|
|
39
40
|
status: string;
|
|
40
41
|
}
|
|
@@ -85,7 +86,6 @@ export declare namespace ProductService {
|
|
|
85
86
|
interface ProductData {
|
|
86
87
|
productInfo: ProductInfo;
|
|
87
88
|
skuList: SkuItem[];
|
|
88
|
-
creatorId: string;
|
|
89
89
|
}
|
|
90
90
|
namespace Request {
|
|
91
91
|
interface detail {
|
|
@@ -146,12 +146,16 @@ export declare namespace ProductService {
|
|
|
146
146
|
interface isSoldOut {
|
|
147
147
|
skuId: string;
|
|
148
148
|
}
|
|
149
|
+
interface deleteScheduledTask {
|
|
150
|
+
taskId: string;
|
|
151
|
+
}
|
|
149
152
|
}
|
|
150
153
|
namespace Response {
|
|
151
154
|
interface create {
|
|
152
155
|
productId: string;
|
|
153
156
|
}
|
|
154
157
|
interface queryScheduledTask {
|
|
158
|
+
id: string;
|
|
155
159
|
scheduledTime: number;
|
|
156
160
|
status: string;
|
|
157
161
|
operationType: string;
|
|
@@ -303,5 +307,9 @@ export declare namespace ProductService {
|
|
|
303
307
|
* 是否售罄-C端
|
|
304
308
|
*/
|
|
305
309
|
isSoldOut(request: ProductService.Request.isSoldOut): Promise<ProductService.Response.isSoldOut>;
|
|
310
|
+
/**
|
|
311
|
+
* 删除定时任务
|
|
312
|
+
*/
|
|
313
|
+
deleteScheduledTask(request: ProductService.Request.deleteScheduledTask): Promise<void>;
|
|
306
314
|
}
|
|
307
315
|
}
|
|
@@ -7,6 +7,8 @@ declare class ProductExpService extends BaseService implements Service.ProductEx
|
|
|
7
7
|
getLiveGroupList(request: Service.Request.getLiveGroupList): Promise<Service.Response.getLiveGroupList>;
|
|
8
8
|
addLiveGroup(request: Service.Request.addLiveGroup): Promise<Service.Response.addLiveGroup>;
|
|
9
9
|
productCategoryList(request: Service.Request.productCategoryList): Promise<Service.ProductCategory[]>;
|
|
10
|
+
setStoreScope(request: Service.Request.setStoreScope): Promise<void>;
|
|
11
|
+
queryStoreScope(request: Service.Request.queryStoreScope): Promise<Service.Response.queryStoreScope>;
|
|
10
12
|
}
|
|
11
13
|
export declare const productExpService: ProductExpService;
|
|
12
14
|
export default productExpService;
|
|
@@ -36,6 +36,12 @@ let ProductExpService = class ProductExpService extends BaseService_1.default {
|
|
|
36
36
|
productCategoryList(request) {
|
|
37
37
|
return (0, http_1.callApi)(this.getApiUrl(this.productCategoryList), request);
|
|
38
38
|
}
|
|
39
|
+
setStoreScope(request) {
|
|
40
|
+
return (0, http_1.callApi)(this.getApiUrl(this.setStoreScope), request);
|
|
41
|
+
}
|
|
42
|
+
queryStoreScope(request) {
|
|
43
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryStoreScope), request);
|
|
44
|
+
}
|
|
39
45
|
};
|
|
40
46
|
__decorate([
|
|
41
47
|
(0, tsoa_1.OperationId)('获取供应商列表'),
|
|
@@ -62,6 +68,16 @@ __decorate([
|
|
|
62
68
|
(0, tsoa_1.Post)('product-category-list'),
|
|
63
69
|
__param(0, (0, tsoa_1.Body)())
|
|
64
70
|
], ProductExpService.prototype, "productCategoryList", null);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, tsoa_1.OperationId)('设置门店范围'),
|
|
73
|
+
(0, tsoa_1.Post)('set-store-scope'),
|
|
74
|
+
__param(0, (0, tsoa_1.Body)())
|
|
75
|
+
], ProductExpService.prototype, "setStoreScope", null);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, tsoa_1.OperationId)('获取门店范围'),
|
|
78
|
+
(0, tsoa_1.Post)('query-store-scope'),
|
|
79
|
+
__param(0, (0, tsoa_1.Body)())
|
|
80
|
+
], ProductExpService.prototype, "queryStoreScope", null);
|
|
65
81
|
ProductExpService = __decorate([
|
|
66
82
|
(0, tsoa_1.Route)('product-exp'),
|
|
67
83
|
(0, tsoa_1.Tags)('Product-exp')
|
|
@@ -13,7 +13,6 @@ export declare namespace ProductExpService {
|
|
|
13
13
|
}
|
|
14
14
|
interface addSupplier {
|
|
15
15
|
supplierName: string;
|
|
16
|
-
creatorId: string;
|
|
17
16
|
}
|
|
18
17
|
interface getLiveGroupList {
|
|
19
18
|
pageIndex: number;
|
|
@@ -22,12 +21,19 @@ export declare namespace ProductExpService {
|
|
|
22
21
|
}
|
|
23
22
|
interface addLiveGroup {
|
|
24
23
|
liveGroupName: string;
|
|
25
|
-
creatorId: string;
|
|
26
24
|
}
|
|
27
25
|
interface productCategoryList {
|
|
28
26
|
level: number;
|
|
29
27
|
parentId?: string;
|
|
30
28
|
}
|
|
29
|
+
interface setStoreScope {
|
|
30
|
+
productId: string;
|
|
31
|
+
type: string;
|
|
32
|
+
storeIds: string[];
|
|
33
|
+
}
|
|
34
|
+
interface queryStoreScope {
|
|
35
|
+
productId: string;
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
namespace Response {
|
|
33
39
|
interface addSupplier {
|
|
@@ -60,6 +66,10 @@ export declare namespace ProductExpService {
|
|
|
60
66
|
stock: number;
|
|
61
67
|
}[];
|
|
62
68
|
}
|
|
69
|
+
interface queryStoreScope {
|
|
70
|
+
type: string;
|
|
71
|
+
storeIds: string[];
|
|
72
|
+
}
|
|
63
73
|
}
|
|
64
74
|
/**
|
|
65
75
|
* ProductLive Controller 接口定义
|
|
@@ -85,5 +95,13 @@ export declare namespace ProductExpService {
|
|
|
85
95
|
* 商品分类列表
|
|
86
96
|
*/
|
|
87
97
|
productCategoryList(request: ProductExpService.Request.productCategoryList): Promise<ProductExpService.ProductCategory[]>;
|
|
98
|
+
/**
|
|
99
|
+
* 设置门店范围
|
|
100
|
+
*/
|
|
101
|
+
setStoreScope(request: ProductExpService.Request.setStoreScope): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* 获取门店范围
|
|
104
|
+
*/
|
|
105
|
+
queryStoreScope(request: ProductExpService.Request.queryStoreScope): Promise<ProductExpService.Response.queryStoreScope>;
|
|
88
106
|
}
|
|
89
107
|
}
|
package/package.json
CHANGED
package/utils/http.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ declare module '@fastify/request-context' {
|
|
|
2
2
|
interface RequestContextData {
|
|
3
3
|
requestId?: string;
|
|
4
4
|
traceMessageId?: string;
|
|
5
|
+
pandoraUserId?: string;
|
|
6
|
+
beLinkUserId?: string;
|
|
7
|
+
pandoraRoleId?: string;
|
|
5
8
|
}
|
|
6
9
|
}
|
|
7
10
|
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
|
@@ -56,10 +56,18 @@ const request_context_1 = require("@fastify/request-context");
|
|
|
56
56
|
});
|
|
57
57
|
async function callApi(url, request) {
|
|
58
58
|
const requestId = request_context_1.requestContext.get('requestId') || request_context_1.requestContext.get('traceMessageId') || (0, uuid_1.v4)();
|
|
59
|
+
const pandoraUserId = request_context_1.requestContext.get('pandoraUserId') || '';
|
|
60
|
+
const beLinkUserId = request_context_1.requestContext.get('beLinkUserId') || '';
|
|
61
|
+
const pandoraRoleId = request_context_1.requestContext.get('pandoraRoleId') || '';
|
|
59
62
|
try {
|
|
60
63
|
console.info(`准备发起ecommerce-product-service请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
|
|
61
64
|
const response = await axios_1.default.post(url, request || {}, {
|
|
62
|
-
headers: {
|
|
65
|
+
headers: {
|
|
66
|
+
'x-request-id': requestId,
|
|
67
|
+
'x-belink-pandora-userid': pandoraUserId,
|
|
68
|
+
'x-belink-userid': beLinkUserId,
|
|
69
|
+
'x-belink-pandora-roleid': pandoraRoleId,
|
|
70
|
+
},
|
|
63
71
|
});
|
|
64
72
|
const responseData = response.data;
|
|
65
73
|
return responseData.data;
|