@pisell/pisellos 2.2.3 → 2.2.4

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.
@@ -129,7 +129,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
129
129
  }, {
130
130
  cache: {
131
131
  mode: RequestModeENUM.REMOTE_LOCAL,
132
- updateCache: true,
133
132
  type: "indexDB"
134
133
  }
135
134
  });
@@ -212,37 +211,51 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
212
211
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
213
212
  while (1) switch (_context4.prev = _context4.next) {
214
213
  case 0:
215
- _context4.next = 2;
214
+ _context4.prev = 0;
215
+ _context4.next = 3;
216
216
  return this.getProducts();
217
- case 2:
217
+ case 3:
218
218
  allProducts = _context4.sent;
219
- _context4.next = 5;
219
+ console.log("[ProductsModule] \uD83C\uDF10 \u5F00\u59CB\u83B7\u53D6\u5546\u54C1\u62A5\u4EF7\u5355\u4EF7\u683C");
220
+ // 2. 获取价格数据
221
+ _context4.next = 7;
220
222
  return this.loadProductsPrice({
221
223
  ids: allProducts.map(function (product) {
222
224
  return product.id;
223
225
  }),
224
226
  schedule_date: schedule_date
225
227
  });
226
- case 5:
228
+ case 7:
227
229
  priceData = _context4.sent;
230
+ console.log("[ProductsModule] \uD83C\uDF10 \u83B7\u53D6\u5546\u54C1\u62A5\u4EF7\u5355\u4EF7\u683C\u6210\u529F", priceData);
228
231
  // 3. 构建上下文(包含价格数据,合并外部传入的额外上下文)
229
232
  context = _objectSpread({
230
233
  schedule_date: schedule_date,
231
234
  priceData: priceData
232
- }, extraContext); // 4. 通过格式化器流程处理商品(包括价格应用、字段扩展等)
233
- _context4.next = 9;
235
+ }, extraContext);
236
+ console.log("[ProductsModule] \uD83C\uDF10 \u901A\u8FC7\u683C\u5F0F\u5316\u5668\u6D41\u7A0B\u5904\u7406\u5546\u54C1\uFF08\u5305\u62EC\u4EF7\u683C\u5E94\u7528\u3001\u5B57\u6BB5\u6269\u5C55\u7B49\uFF09");
237
+ // 4. 通过格式化器流程处理商品(包括价格应用、字段扩展等)
238
+ _context4.next = 13;
234
239
  return this.applyFormatters(allProducts, context);
235
- case 9:
240
+ case 13:
236
241
  processedProducts = _context4.sent;
237
- _context4.next = 12;
242
+ console.log("[ProductsModule] \uD83C\uDF10 \u901A\u8FC7\u683C\u5F0F\u5316\u5668\u6D41\u7A0B\u5904\u7406\u5546\u54C1\uFF08\u5305\u62EC\u4EF7\u683C\u5E94\u7528\u3001\u5B57\u6BB5\u6269\u5C55\u7B49\uFF09\u6210\u529F", processedProducts);
243
+ // 5. 触发钩子事件(用于外部监听)
244
+ _context4.next = 17;
238
245
  return this.core.effects.emit(ProductsHooks.onProductsPriceApplied, processedProducts);
239
- case 12:
246
+ case 17:
240
247
  return _context4.abrupt("return", processedProducts);
241
- case 13:
248
+ case 20:
249
+ _context4.prev = 20;
250
+ _context4.t0 = _context4["catch"](0);
251
+ console.log("[ProductsModule] \uD83C\uDF10 ERROR", _context4.t0);
252
+ case 23:
253
+ return _context4.abrupt("return", []);
254
+ case 24:
242
255
  case "end":
243
256
  return _context4.stop();
244
257
  }
245
- }, _callee4, this);
258
+ }, _callee4, this, [[0, 20]]);
246
259
  }));
247
260
  function prepareProductsWithPrice(_x6, _x7) {
248
261
  return _prepareProductsWithPrice.apply(this, arguments);
@@ -90,7 +90,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
90
90
  {
91
91
  cache: {
92
92
  mode: import_plugins.RequestModeENUM.REMOTE_LOCAL,
93
- updateCache: true,
94
93
  type: "indexDB"
95
94
  }
96
95
  }
@@ -126,23 +125,32 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
126
125
  * @private
127
126
  */
128
127
  async prepareProductsWithPrice(schedule_date, extraContext) {
129
- const allProducts = await this.getProducts();
130
- const priceData = await this.loadProductsPrice({
131
- ids: allProducts.map((product) => product.id),
132
- schedule_date
133
- });
134
- const context = {
135
- schedule_date,
136
- priceData,
137
- ...extraContext
138
- // 合并 Server 层传入的额外数据(如 scheduleList)
139
- };
140
- const processedProducts = await this.applyFormatters(allProducts, context);
141
- await this.core.effects.emit(
142
- import_types.ProductsHooks.onProductsPriceApplied,
143
- processedProducts
144
- );
145
- return processedProducts;
128
+ try {
129
+ const allProducts = await this.getProducts();
130
+ console.log(`[ProductsModule] 🌐 开始获取商品报价单价格`);
131
+ const priceData = await this.loadProductsPrice({
132
+ ids: allProducts.map((product) => product.id),
133
+ schedule_date
134
+ });
135
+ console.log(`[ProductsModule] 🌐 获取商品报价单价格成功`, priceData);
136
+ const context = {
137
+ schedule_date,
138
+ priceData,
139
+ ...extraContext
140
+ // 合并 Server 层传入的额外数据(如 scheduleList)
141
+ };
142
+ console.log(`[ProductsModule] 🌐 通过格式化器流程处理商品(包括价格应用、字段扩展等)`);
143
+ const processedProducts = await this.applyFormatters(allProducts, context);
144
+ console.log(`[ProductsModule] 🌐 通过格式化器流程处理商品(包括价格应用、字段扩展等)成功`, processedProducts);
145
+ await this.core.effects.emit(
146
+ import_types.ProductsHooks.onProductsPriceApplied,
147
+ processedProducts
148
+ );
149
+ return processedProducts;
150
+ } catch (err) {
151
+ console.log(`[ProductsModule] 🌐 ERROR`, err);
152
+ }
153
+ return [];
146
154
  }
147
155
  /**
148
156
  * 应用所有已注册的格式化器
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.3",
4
+ "version": "2.2.4",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",