@be-link/ecommerce-promotion-service-node-sdk 0.1.9 → 0.1.11

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 CHANGED
@@ -200,8 +200,12 @@ export declare namespace ENUM {
200
200
  enum STOCK_CHANGE_TYPE {
201
201
  /** 任务扣减 */
202
202
  TASK_DEDUCT = "TASK_DEDUCT",
203
+ /** 任务取消扣减 */
204
+ TASK_CANCEL_DEDUCT = "TASK_CANCEL_DEDUCT",
203
205
  /** 活动扣减 */
204
206
  ACTIVITY_DEDUCT = "ACTIVITY_DEDUCT",
207
+ /** 活动取消扣减 */
208
+ ACTIVITY_CANCEL_DEDUCT = "ACTIVITY_CANCEL_DEDUCT",
205
209
  /** 手动扣减 */
206
210
  MANUAL_DEDUCT = "MANUAL_DEDUCT",
207
211
  /** 批量手动扣减 */
package/enum.js CHANGED
@@ -231,8 +231,12 @@ var ENUM;
231
231
  (function (STOCK_CHANGE_TYPE) {
232
232
  /** 任务扣减 */
233
233
  STOCK_CHANGE_TYPE["TASK_DEDUCT"] = "TASK_DEDUCT";
234
+ /** 任务取消扣减 */
235
+ STOCK_CHANGE_TYPE["TASK_CANCEL_DEDUCT"] = "TASK_CANCEL_DEDUCT";
234
236
  /** 活动扣减 */
235
237
  STOCK_CHANGE_TYPE["ACTIVITY_DEDUCT"] = "ACTIVITY_DEDUCT";
238
+ /** 活动取消扣减 */
239
+ STOCK_CHANGE_TYPE["ACTIVITY_CANCEL_DEDUCT"] = "ACTIVITY_CANCEL_DEDUCT";
236
240
  /** 手动扣减 */
237
241
  STOCK_CHANGE_TYPE["MANUAL_DEDUCT"] = "MANUAL_DEDUCT";
238
242
  /** 批量手动扣减 */
@@ -4,6 +4,7 @@ declare class JobService extends BaseService implements Service.JobController {
4
4
  protected prefixUrl: string;
5
5
  expireCouponTemplateTask(): Promise<void>;
6
6
  cleanupCouponCacheTask(): Promise<void>;
7
+ syncLiveRoomLotteryWhiteList(): Promise<void>;
7
8
  }
8
9
  export declare const jobService: JobService;
9
10
  export default jobService;
@@ -24,6 +24,9 @@ let JobService = class JobService extends BaseService_1.default {
24
24
  cleanupCouponCacheTask() {
25
25
  return (0, http_1.callApi)(this.getApiUrl(this.cleanupCouponCacheTask));
26
26
  }
27
+ syncLiveRoomLotteryWhiteList() {
28
+ return (0, http_1.callApi)(this.getApiUrl(this.syncLiveRoomLotteryWhiteList));
29
+ }
27
30
  };
28
31
  __decorate([
29
32
  (0, tsoa_1.OperationId)('过期券模版清理任务'),
@@ -33,6 +36,10 @@ __decorate([
33
36
  (0, tsoa_1.OperationId)('定时清理券缓存任务'),
34
37
  (0, tsoa_1.Post)('cleanup-coupon-cache-task')
35
38
  ], JobService.prototype, "cleanupCouponCacheTask", null);
39
+ __decorate([
40
+ (0, tsoa_1.OperationId)('开播直播间同步抽奖白名单'),
41
+ (0, tsoa_1.Post)('sync-live-room-lottery-white-list')
42
+ ], JobService.prototype, "syncLiveRoomLotteryWhiteList", null);
36
43
  JobService = __decorate([
37
44
  (0, tsoa_1.Route)('job'),
38
45
  (0, tsoa_1.Tags)('Job')
@@ -1,4 +1,19 @@
1
1
  export declare namespace Service {
2
+ namespace Entity {
3
+ /** 抽奖活动信息 */
4
+ interface LotteryActivity {
5
+ Id: number;
6
+ Name: string;
7
+ AwardType: number;
8
+ AwardTheme: string;
9
+ AwardItemConfigs: AwardItemConfig[];
10
+ }
11
+ /** 抽奖活动奖品配置 */
12
+ interface AwardItemConfig {
13
+ AwardId: number;
14
+ AwardItemCount: number;
15
+ }
16
+ }
2
17
  namespace Request { }
3
18
  namespace Response { }
4
19
  interface JobController {
@@ -6,5 +21,7 @@ export declare namespace Service {
6
21
  expireCouponTemplateTask(): Promise<void>;
7
22
  /** 定时清理券缓存任务 */
8
23
  cleanupCouponCacheTask(): Promise<void>;
24
+ /** 开播直播间同步抽奖白名单 */
25
+ syncLiveRoomLotteryWhiteList(): Promise<void>;
9
26
  }
10
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/ecommerce-promotion-service-node-sdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "EcommercePromotionService Node.js SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -14,7 +14,8 @@
14
14
  "axios": "1.13.2",
15
15
  "axios-retry": "4.0.0",
16
16
  "uuid": "9.0.1",
17
- "tsoa": "^6.6.0"
17
+ "tsoa": "^6.6.0",
18
+ "safe-stable-stringify": "2.5.0"
18
19
  },
19
20
  "scripts": {
20
21
  "build": "rm -rf ./dist && tsc && cp package.json README.md ./dist/ 2>/dev/null || true",
package/utils/http.js CHANGED
@@ -41,6 +41,7 @@ const axios_1 = __importDefault(require("axios"));
41
41
  const uuid_1 = require("uuid");
42
42
  const axios_retry_1 = __importDefault(require("axios-retry"));
43
43
  const request_context_1 = require("@fastify/request-context");
44
+ const safe_stable_stringify_1 = __importDefault(require("safe-stable-stringify"));
44
45
  (0, axios_retry_1.default)(axios_1.default, {
45
46
  retries: 1,
46
47
  retryCondition(error) {
@@ -51,7 +52,7 @@ const request_context_1 = require("@fastify/request-context");
51
52
  return retryCount * 500;
52
53
  },
53
54
  onRetry(retryCount, error, requestConfig) {
54
- console.info(`retryCount: ${retryCount}, onRetry: ${error.message}, requestHeader: ${JSON.stringify(requestConfig.headers)}`);
55
+ console.info(`retryCount: ${retryCount}, onRetry: ${error.message}, requestHeader: ${(0, safe_stable_stringify_1.default)(requestConfig.headers)}`);
55
56
  },
56
57
  });
57
58
  async function callApi(url, request) {
@@ -60,7 +61,7 @@ async function callApi(url, request) {
60
61
  const beLinkUserId = request_context_1.requestContext.get('beLinkUserId') || '';
61
62
  const pandoraRoleId = request_context_1.requestContext.get('pandoraRoleId') || '';
62
63
  try {
63
- console.info(`准备发起ecommerce-promotion-service请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
64
+ console.info(`准备发起ecommerce-promotion-service请求[${requestId}]: ${url}, 参数: ${(0, safe_stable_stringify_1.default)(request)}`);
64
65
  const response = await axios_1.default.post(url, request || {}, {
65
66
  headers: {
66
67
  'x-request-id': requestId,
@@ -79,7 +80,7 @@ async function callApi(url, request) {
79
80
  const data = response.data;
80
81
  console.error(`ecommerce-promotion-service 异常: ${axiosError.message},requestId: ${requestId}`);
81
82
  console.info('响应信息', data.message);
82
- console.error('异常堆栈', JSON.stringify(error.stack));
83
+ console.error('异常堆栈', (0, safe_stable_stringify_1.default)(error.stack));
83
84
  throw error;
84
85
  }
85
86
  // 调用dns模块解析url
@@ -90,16 +91,16 @@ async function callApi(url, request) {
90
91
  console.error(err.message);
91
92
  reject(err);
92
93
  }
93
- console.info(`lookup: ${JSON.stringify(lookupRes)}`);
94
+ console.info(`lookup: ${(0, safe_stable_stringify_1.default)(lookupRes)}`);
94
95
  resolve(address);
95
96
  });
96
97
  });
97
98
  try {
98
99
  const address = await dnsPromise;
99
- console.info(`address: ${JSON.stringify(address)}`);
100
+ console.info(`address: ${(0, safe_stable_stringify_1.default)(address)}`);
100
101
  }
101
102
  catch (error) {
102
- console.info(`error: ${JSON.stringify(error)}`);
103
+ console.info(`error: ${(0, safe_stable_stringify_1.default)(error)}`);
103
104
  }
104
105
  console.error(`ecommerce-promotion-service 未知异常: ${axiosError.message}`, error.stack);
105
106
  throw error;