@be-link/ecommerce-client-backend-service-node-sdk 0.1.90 → 0.1.92
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/consts.d.ts +30 -0
- package/consts.js +36 -0
- package/index.d.ts +2 -0
- package/index.js +5 -1
- package/modules/data/service.d.ts +4 -0
- package/modules/data/service.js +18 -0
- package/modules/data/types.d.ts +49 -0
- package/modules/roomData/types.d.ts +4 -0
- package/modules/rule/types.d.ts +1 -1
- package/modules/userData/types.d.ts +26 -0
- package/package.json +1 -1
- package/utils/http.d.ts +1 -0
- package/utils/http.js +5 -0
package/consts.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare namespace HOTEL_TRAVEL_MQ {
|
|
2
|
+
/** 酒旅 MQ vhost */
|
|
3
|
+
const VHOST = "trade";
|
|
4
|
+
/** 正向订单 MQ */
|
|
5
|
+
namespace POS {
|
|
6
|
+
/** 正向订单主题 */
|
|
7
|
+
const TOPIC = "positive-topic";
|
|
8
|
+
/** 正向订单路由键 */
|
|
9
|
+
const ROUTING_KEY: {
|
|
10
|
+
/** 创建 */
|
|
11
|
+
readonly CREATE: "order.positive.create";
|
|
12
|
+
/** 支付成功 */
|
|
13
|
+
readonly PAY_SUCCESS: "order.positive.pay_success";
|
|
14
|
+
/** 关闭 */
|
|
15
|
+
readonly CLOSED: "order.positive.close";
|
|
16
|
+
/** 定金补全 */
|
|
17
|
+
readonly DEPOSIT_RESERVE_COMPLETED: "order.positive.deposit_reserve_completed";
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** 逆向订单 MQ */
|
|
21
|
+
namespace ROS {
|
|
22
|
+
/** 逆向订单主题 */
|
|
23
|
+
const TOPIC = "reverse-topic";
|
|
24
|
+
/** 逆向订单路由键 */
|
|
25
|
+
const ROUTING_KEY: {
|
|
26
|
+
/** 退款成功 */
|
|
27
|
+
readonly SUCCESS: "order.reverse.success";
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
package/consts.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HOTEL_TRAVEL_MQ = void 0;
|
|
4
|
+
var HOTEL_TRAVEL_MQ;
|
|
5
|
+
(function (HOTEL_TRAVEL_MQ) {
|
|
6
|
+
/** 酒旅 MQ vhost */
|
|
7
|
+
HOTEL_TRAVEL_MQ.VHOST = 'trade';
|
|
8
|
+
/** 正向订单 MQ */
|
|
9
|
+
let POS;
|
|
10
|
+
(function (POS) {
|
|
11
|
+
/** 正向订单主题 */
|
|
12
|
+
POS.TOPIC = 'positive-topic';
|
|
13
|
+
/** 正向订单路由键 */
|
|
14
|
+
POS.ROUTING_KEY = {
|
|
15
|
+
/** 创建 */
|
|
16
|
+
CREATE: 'order.positive.create',
|
|
17
|
+
/** 支付成功 */
|
|
18
|
+
PAY_SUCCESS: 'order.positive.pay_success',
|
|
19
|
+
/** 关闭 */
|
|
20
|
+
CLOSED: 'order.positive.close',
|
|
21
|
+
/** 定金补全 */
|
|
22
|
+
DEPOSIT_RESERVE_COMPLETED: 'order.positive.deposit_reserve_completed',
|
|
23
|
+
};
|
|
24
|
+
})(POS = HOTEL_TRAVEL_MQ.POS || (HOTEL_TRAVEL_MQ.POS = {}));
|
|
25
|
+
/** 逆向订单 MQ */
|
|
26
|
+
let ROS;
|
|
27
|
+
(function (ROS) {
|
|
28
|
+
/** 逆向订单主题 */
|
|
29
|
+
ROS.TOPIC = 'reverse-topic';
|
|
30
|
+
/** 逆向订单路由键 */
|
|
31
|
+
ROS.ROUTING_KEY = {
|
|
32
|
+
/** 退款成功 */
|
|
33
|
+
SUCCESS: 'order.reverse.success',
|
|
34
|
+
};
|
|
35
|
+
})(ROS = HOTEL_TRAVEL_MQ.ROS || (HOTEL_TRAVEL_MQ.ROS = {}));
|
|
36
|
+
})(HOTEL_TRAVEL_MQ || (exports.HOTEL_TRAVEL_MQ = HOTEL_TRAVEL_MQ = {}));
|
package/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export { ruleService } from './modules/rule/service';
|
|
|
13
13
|
export { miniProgramService } from './modules/miniprogram/service';
|
|
14
14
|
export { userDataService } from './modules/userData/service';
|
|
15
15
|
export { ENUM as CLIENT_BACKEND_ENUM } from './enum';
|
|
16
|
+
export { HOTEL_TRAVEL_MQ } from './consts';
|
|
17
|
+
export { destroyHttpAgents } from './utils/http';
|
|
16
18
|
export type { Room, RoomAutoStartConfig, RoomLoopVideo, RoomTag, RoomBindStore } from './types';
|
|
17
19
|
export type { Domain, Current } from './modules/domain/types';
|
|
18
20
|
export type { MiniProgram, Info as MiniProgramInfo } from './modules/miniprogram/types';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLIENT_BACKEND_ENUM = exports.userDataService = exports.miniProgramService = exports.ruleService = exports.domainService = exports.dataService = exports.roomDataService = exports.roomService = void 0;
|
|
3
|
+
exports.destroyHttpAgents = exports.HOTEL_TRAVEL_MQ = exports.CLIENT_BACKEND_ENUM = exports.userDataService = exports.miniProgramService = exports.ruleService = exports.domainService = exports.dataService = exports.roomDataService = exports.roomService = void 0;
|
|
4
4
|
var service_1 = require("./modules/room/service");
|
|
5
5
|
Object.defineProperty(exports, "roomService", { enumerable: true, get: function () { return service_1.roomService; } });
|
|
6
6
|
var service_2 = require("./modules/roomData/service");
|
|
@@ -17,4 +17,8 @@ var service_7 = require("./modules/userData/service");
|
|
|
17
17
|
Object.defineProperty(exports, "userDataService", { enumerable: true, get: function () { return service_7.userDataService; } });
|
|
18
18
|
var enum_1 = require("./enum");
|
|
19
19
|
Object.defineProperty(exports, "CLIENT_BACKEND_ENUM", { enumerable: true, get: function () { return enum_1.ENUM; } });
|
|
20
|
+
var consts_1 = require("./consts");
|
|
21
|
+
Object.defineProperty(exports, "HOTEL_TRAVEL_MQ", { enumerable: true, get: function () { return consts_1.HOTEL_TRAVEL_MQ; } });
|
|
22
|
+
var http_1 = require("./utils/http");
|
|
23
|
+
Object.defineProperty(exports, "destroyHttpAgents", { enumerable: true, get: function () { return http_1.destroyHttpAgents; } });
|
|
20
24
|
// 服务.模块.枚举名称.枚举值 示例: DEMO_ENUM.ORDER_ENUM.STATUS.PENDING
|
|
@@ -40,6 +40,10 @@ declare class DataServiceClass extends BaseService implements DataService.BaseCo
|
|
|
40
40
|
syncPreviewAudienceStatistics(): Promise<void>;
|
|
41
41
|
/** 从订单服务同步 trade_order(定时调度:order_change_log 扫单回写) */
|
|
42
42
|
syncTradeOrderFromOrderService(): Promise<void>;
|
|
43
|
+
/** 定时校准酒旅用户累计消费金额(脏用户集合回查) */
|
|
44
|
+
syncHotelTravelUserConsumptionAmount(request?: DataService.Request.SyncHotelTravelUserConsumptionAmount): Promise<void>;
|
|
45
|
+
/** 一次性历史回填酒旅用户累计消费金额(支持 userId 游标断点续传) */
|
|
46
|
+
backfillHotelTravelUserConsumptionAmount(request?: DataService.Request.BackfillHotelTravelUserConsumptionAmount): Promise<void>;
|
|
43
47
|
/** 补偿指定直播间的回放观众统计(拉火山回放写回放三字段,用于手动补偿) */
|
|
44
48
|
compensateReplayAudienceStatistics(request: DataService.Request.CompensateReplayAudienceStatistics): Promise<void>;
|
|
45
49
|
batchCompensateReplayAudienceStatistics(request: DataService.Request.BatchCompensateReplayAudienceStatistics): Promise<void>;
|
package/modules/data/service.js
CHANGED
|
@@ -101,6 +101,14 @@ let DataServiceClass = class DataServiceClass extends BaseService_1.default {
|
|
|
101
101
|
syncTradeOrderFromOrderService() {
|
|
102
102
|
return (0, http_1.callApi)(this.getApiUrl(this.syncTradeOrderFromOrderService), undefined);
|
|
103
103
|
}
|
|
104
|
+
/** 定时校准酒旅用户累计消费金额(脏用户集合回查) */
|
|
105
|
+
syncHotelTravelUserConsumptionAmount(request) {
|
|
106
|
+
return (0, http_1.callApi)(this.getApiUrl(this.syncHotelTravelUserConsumptionAmount), request);
|
|
107
|
+
}
|
|
108
|
+
/** 一次性历史回填酒旅用户累计消费金额(支持 userId 游标断点续传) */
|
|
109
|
+
backfillHotelTravelUserConsumptionAmount(request) {
|
|
110
|
+
return (0, http_1.callApi)(this.getApiUrl(this.backfillHotelTravelUserConsumptionAmount), request);
|
|
111
|
+
}
|
|
104
112
|
/** 补偿指定直播间的回放观众统计(拉火山回放写回放三字段,用于手动补偿) */
|
|
105
113
|
compensateReplayAudienceStatistics(request) {
|
|
106
114
|
return (0, http_1.callApi)(this.getApiUrl(this.compensateReplayAudienceStatistics), request);
|
|
@@ -254,6 +262,16 @@ __decorate([
|
|
|
254
262
|
(0, tsoa_1.OperationId)('从订单服务同步 trade_order'),
|
|
255
263
|
(0, tsoa_1.Post)('sync-trade-order-from-order-service')
|
|
256
264
|
], DataServiceClass.prototype, "syncTradeOrderFromOrderService", null);
|
|
265
|
+
__decorate([
|
|
266
|
+
(0, tsoa_1.OperationId)('定时校准酒旅用户累计消费金额'),
|
|
267
|
+
(0, tsoa_1.Post)('sync-hotel-travel-user-consumption-amount'),
|
|
268
|
+
__param(0, (0, tsoa_1.Body)())
|
|
269
|
+
], DataServiceClass.prototype, "syncHotelTravelUserConsumptionAmount", null);
|
|
270
|
+
__decorate([
|
|
271
|
+
(0, tsoa_1.OperationId)('一次性历史回填酒旅用户累计消费金额'),
|
|
272
|
+
(0, tsoa_1.Post)('backfill-hotel-travel-user-consumption-amount'),
|
|
273
|
+
__param(0, (0, tsoa_1.Body)())
|
|
274
|
+
], DataServiceClass.prototype, "backfillHotelTravelUserConsumptionAmount", null);
|
|
257
275
|
__decorate([
|
|
258
276
|
(0, tsoa_1.OperationId)('补偿回放观众统计'),
|
|
259
277
|
(0, tsoa_1.Post)('compensate-replay-audience-statistics'),
|
package/modules/data/types.d.ts
CHANGED
|
@@ -211,6 +211,22 @@ export declare namespace DataService {
|
|
|
211
211
|
/** 目标对账日期(ISO 8601格式,如 "2024-01-15"),不传则对账昨天 */
|
|
212
212
|
targetDate?: string;
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* 定时校准酒旅用户累计消费金额(脏用户集合回查)
|
|
216
|
+
*/
|
|
217
|
+
interface SyncHotelTravelUserConsumptionAmount {
|
|
218
|
+
/** 单次处理用户数(默认500,最大5000) */
|
|
219
|
+
batchSize?: number;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* 一次性历史回填酒旅用户累计消费金额(支持 userId 游标断点续传)
|
|
223
|
+
*/
|
|
224
|
+
interface BackfillHotelTravelUserConsumptionAmount {
|
|
225
|
+
/** 单次分页大小(默认500,最大5000) */
|
|
226
|
+
pageSize?: number;
|
|
227
|
+
/** 起始 userId(断点续传游标) */
|
|
228
|
+
startUserId?: string;
|
|
229
|
+
}
|
|
214
230
|
/**
|
|
215
231
|
* 批量更新用户消费数据(从CSV文件)
|
|
216
232
|
*/
|
|
@@ -302,6 +318,33 @@ export declare namespace DataService {
|
|
|
302
318
|
message: string;
|
|
303
319
|
}
|
|
304
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* 直播间统计缓存结构(Redis)
|
|
323
|
+
*/
|
|
324
|
+
interface LiveStreamRoomStatisticsCache {
|
|
325
|
+
/** 直播间id */
|
|
326
|
+
liveStreamRoomId: string;
|
|
327
|
+
/** 交易总金额(待支付金额+实收金额、含退款金额) */
|
|
328
|
+
gmv?: number;
|
|
329
|
+
/** 实收金额:支付成功且未退款金额 */
|
|
330
|
+
actualReceivedAmount?: number;
|
|
331
|
+
/** 退款金额 */
|
|
332
|
+
refundAmount?: number;
|
|
333
|
+
/** 待支付金额 */
|
|
334
|
+
pendingPaymentAmount?: number;
|
|
335
|
+
/** 成交订单数 */
|
|
336
|
+
transactOrderCount?: number;
|
|
337
|
+
/** 商品销售量 */
|
|
338
|
+
salesVolume?: number;
|
|
339
|
+
/** 待支付份数 */
|
|
340
|
+
pendingSalesVolume?: number;
|
|
341
|
+
/** 下单人数(去重) */
|
|
342
|
+
orderUserCount?: number;
|
|
343
|
+
/** 退款人数(去重) */
|
|
344
|
+
refundUserCount?: number;
|
|
345
|
+
/** 酒旅预计尾款(单位:分) */
|
|
346
|
+
hotelTravelEstimatedFinalPayment?: number;
|
|
347
|
+
}
|
|
305
348
|
interface BaseController {
|
|
306
349
|
userLiveStreamRelation(request: Request.UserLiveStreamRelation, req?: FastifyRequest): Promise<void>;
|
|
307
350
|
getUserViewDuration(request: Request.UserViewDuration, req?: FastifyRequest): Promise<Response.UserViewDuration>;
|
|
@@ -324,6 +367,8 @@ export declare namespace DataService {
|
|
|
324
367
|
syncReplayAudienceStatistics(): Promise<void>;
|
|
325
368
|
syncPreviewAudienceStatistics(): Promise<void>;
|
|
326
369
|
syncTradeOrderFromOrderService(): Promise<void>;
|
|
370
|
+
syncHotelTravelUserConsumptionAmount(request?: Request.SyncHotelTravelUserConsumptionAmount, req?: FastifyRequest): Promise<void>;
|
|
371
|
+
backfillHotelTravelUserConsumptionAmount(request?: Request.BackfillHotelTravelUserConsumptionAmount, req?: FastifyRequest): Promise<void>;
|
|
327
372
|
compensateReplayAudienceStatistics(request: Request.CompensateReplayAudienceStatistics, req?: FastifyRequest): Promise<void>;
|
|
328
373
|
batchCompensateReplayAudienceStatistics(request: Request.BatchCompensateReplayAudienceStatistics, req?: FastifyRequest): Promise<void>;
|
|
329
374
|
dailyUpdateUserFirstWatchTime(req?: FastifyRequest): Promise<void>;
|
|
@@ -405,6 +450,10 @@ export interface RoomStatistics {
|
|
|
405
450
|
salesVolume: number;
|
|
406
451
|
/** 待支付份数 */
|
|
407
452
|
pendingSalesVolume: number;
|
|
453
|
+
/** 开通会员卡份数 */
|
|
454
|
+
memberCardPaidOrderCount: number;
|
|
455
|
+
/** 酒旅预计尾款(单位:分) */
|
|
456
|
+
hotelTravelEstimatedFinalPayment: number;
|
|
408
457
|
}
|
|
409
458
|
export interface Product {
|
|
410
459
|
/** 直播间id */
|
|
@@ -126,6 +126,7 @@ export declare namespace RoomDataService {
|
|
|
126
126
|
productImage: string;
|
|
127
127
|
actualQuantity: number;
|
|
128
128
|
price: number;
|
|
129
|
+
remainAmount: number;
|
|
129
130
|
}
|
|
130
131
|
interface ProductSalesRanking {
|
|
131
132
|
list: ProductSalesItem[];
|
|
@@ -214,6 +215,9 @@ export declare namespace StoreAnalysisService {
|
|
|
214
215
|
interface StoreAnalysisItem {
|
|
215
216
|
storeId: string;
|
|
216
217
|
storeName: string;
|
|
218
|
+
province: string;
|
|
219
|
+
city: string;
|
|
220
|
+
area: string;
|
|
217
221
|
storeAddress: string;
|
|
218
222
|
viewerCount: number;
|
|
219
223
|
orderUserCount: number;
|
package/modules/rule/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare namespace RuleService {
|
|
|
3
3
|
interface Info {
|
|
4
4
|
/** 直播间id */
|
|
5
5
|
liveStreamRoomId: string;
|
|
6
|
-
/** 规则分类:city-城市、delivery-配送、tag-标签、businessScope-主营业务 */
|
|
6
|
+
/** 规则分类:city-城市、delivery-配送、urbanDelivery-仓配方式(城配/非城配)、newbieLivePeriodInRoomStart-新手开播期是否覆盖直播开始时间、tag-标签、businessScope-主营业务 */
|
|
7
7
|
cate: string;
|
|
8
8
|
/** 规则值 */
|
|
9
9
|
ruleValue: string;
|
|
@@ -40,6 +40,10 @@ export declare namespace UserDataService {
|
|
|
40
40
|
lastWatchTimeRange?: number[];
|
|
41
41
|
/** 累计消费金额范围(分)[最小值, 最大值] */
|
|
42
42
|
accumulatedConsumptionAmountRange?: number[];
|
|
43
|
+
/** 总累计消费金额范围(分)[最小值, 最大值] */
|
|
44
|
+
totalAccumulatedConsumptionAmountRange?: number[];
|
|
45
|
+
/** 酒旅累计消费金额范围(分)[最小值, 最大值] */
|
|
46
|
+
hotelTravelAccumulatedConsumptionAmountRange?: number[];
|
|
43
47
|
/** 最近消费时间范围(毫秒)[开始时间, 结束时间] */
|
|
44
48
|
lastConsumptionTimeRange?: number[];
|
|
45
49
|
/** 每页数量,默认20 */
|
|
@@ -72,6 +76,12 @@ export declare namespace UserDataService {
|
|
|
72
76
|
nickname?: string;
|
|
73
77
|
/** 会员等级 */
|
|
74
78
|
memberLevel?: string;
|
|
79
|
+
/** 电商累计消费金额范围(分)[最小值, 最大值] */
|
|
80
|
+
accumulatedConsumptionAmountRange?: number[];
|
|
81
|
+
/** 总累计消费金额范围(分)[最小值, 最大值] */
|
|
82
|
+
totalAccumulatedConsumptionAmountRange?: number[];
|
|
83
|
+
/** 酒旅累计消费金额范围(分)[最小值, 最大值] */
|
|
84
|
+
hotelTravelAccumulatedConsumptionAmountRange?: number[];
|
|
75
85
|
/** 页码,从0开始 */
|
|
76
86
|
pageIndex: number;
|
|
77
87
|
/** 每页数量,默认20,最大1000 */
|
|
@@ -93,6 +103,12 @@ export declare namespace UserDataService {
|
|
|
93
103
|
nickname?: string;
|
|
94
104
|
/** 会员等级 */
|
|
95
105
|
memberLevel?: string;
|
|
106
|
+
/** 电商累计消费金额范围(分)[最小值, 最大值] */
|
|
107
|
+
accumulatedConsumptionAmountRange?: number[];
|
|
108
|
+
/** 总累计消费金额范围(分)[最小值, 最大值] */
|
|
109
|
+
totalAccumulatedConsumptionAmountRange?: number[];
|
|
110
|
+
/** 酒旅累计消费金额范围(分)[最小值, 最大值] */
|
|
111
|
+
hotelTravelAccumulatedConsumptionAmountRange?: number[];
|
|
96
112
|
/** 页码,从0开始 */
|
|
97
113
|
pageIndex: number;
|
|
98
114
|
/** 每页数量,默认20,最大1000 */
|
|
@@ -353,6 +369,10 @@ export interface UserInfo {
|
|
|
353
369
|
lastWatchTime: string;
|
|
354
370
|
/** 累计消费金额(元) */
|
|
355
371
|
accumulatedConsumptionAmount: number;
|
|
372
|
+
/** 总累计消费金额(元) */
|
|
373
|
+
totalAccumulatedConsumptionAmount: number;
|
|
374
|
+
/** 酒旅累计消费金额(元) */
|
|
375
|
+
hotelTravelAccumulatedConsumptionAmount: number;
|
|
356
376
|
/** 累计退款金额(元) */
|
|
357
377
|
accumulatedRefundAmount: number;
|
|
358
378
|
/** 7天累计消费金额(元) */
|
|
@@ -398,6 +418,12 @@ export interface LiveRoomUserItem {
|
|
|
398
418
|
replayConsumeAmount: number;
|
|
399
419
|
/** 累计消费金额(支付总额 - 退款总额,元) */
|
|
400
420
|
totalConsumeAmount: number;
|
|
421
|
+
/** 电商累计消费金额(元) */
|
|
422
|
+
accumulatedConsumptionAmount: number;
|
|
423
|
+
/** 总累计消费金额(元) */
|
|
424
|
+
totalAccumulatedConsumptionAmount: number;
|
|
425
|
+
/** 酒旅累计消费金额(元) */
|
|
426
|
+
hotelTravelAccumulatedConsumptionAmount: number;
|
|
401
427
|
/** 首次进入直播间时间(毫秒时间戳) */
|
|
402
428
|
firstEnterTime: number;
|
|
403
429
|
/** 最后进入直播间时间(毫秒时间戳) */
|
package/package.json
CHANGED
package/utils/http.d.ts
CHANGED
package/utils/http.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.callApi = callApi;
|
|
7
|
+
exports.destroyHttpAgents = destroyHttpAgents;
|
|
7
8
|
const axios_1 = __importDefault(require("axios"));
|
|
8
9
|
const uuid_1 = require("uuid");
|
|
9
10
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
@@ -106,3 +107,7 @@ async function callApi(url, request) {
|
|
|
106
107
|
const responseData = response.data;
|
|
107
108
|
return responseData.data;
|
|
108
109
|
}
|
|
110
|
+
function destroyHttpAgents() {
|
|
111
|
+
httpAgent.destroy();
|
|
112
|
+
httpsAgent.destroy();
|
|
113
|
+
}
|