@pisell/pisellos 2.2.83 → 2.2.84
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/dist/server/modules/products/index.d.ts +2 -2
- package/dist/server/modules/products/index.js +47 -59
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/server/modules/products/index.d.ts +2 -2
- package/lib/server/modules/products/index.js +18 -22
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -202,9 +202,9 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
202
202
|
*
|
|
203
203
|
* product 模块:
|
|
204
204
|
* - operation === 'delete' → 本地删除
|
|
205
|
-
* - 有 body(无 price change_types) → body 完整数据直接覆盖本地
|
|
206
205
|
* - change_types 包含 price → SSE 增量拉取 + 刷新报价单价格缓存
|
|
207
|
-
* -
|
|
206
|
+
* - 有 body → body 完整数据直接覆盖本地
|
|
207
|
+
|
|
208
208
|
*
|
|
209
209
|
* product_collection / product_category / product_quotation:
|
|
210
210
|
* - 按 relation_product_ids SSE 拉取受影响商品
|
|
@@ -1472,10 +1472,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1472
1472
|
*
|
|
1473
1473
|
* product 模块:
|
|
1474
1474
|
* - operation === 'delete' → 本地删除
|
|
1475
|
-
* - 有 body(无 price change_types) → body 完整数据直接覆盖本地
|
|
1476
1475
|
* - change_types 包含 price → SSE 增量拉取 + 刷新报价单价格缓存
|
|
1477
|
-
* -
|
|
1478
|
-
|
|
1476
|
+
* - 有 body → body 完整数据直接覆盖本地
|
|
1477
|
+
*
|
|
1479
1478
|
* product_collection / product_category / product_quotation:
|
|
1480
1479
|
* - 按 relation_product_ids SSE 拉取受影响商品
|
|
1481
1480
|
* - product_quotation 额外刷新报价单价格缓存
|
|
@@ -1486,7 +1485,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1486
1485
|
key: "processProductSyncMessages",
|
|
1487
1486
|
value: (function () {
|
|
1488
1487
|
var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1489
|
-
var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, _iterator6, _step6, msg, channelKey, _msg$change_types, _msg$
|
|
1488
|
+
var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, _iterator6, _step6, msg, channelKey, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _msg$relation_product, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, sseHandledSet, remainingPriceIds;
|
|
1490
1489
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1491
1490
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1492
1491
|
case 0:
|
|
@@ -1510,13 +1509,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1510
1509
|
_iterator6.s();
|
|
1511
1510
|
case 12:
|
|
1512
1511
|
if ((_step6 = _iterator6.n()).done) {
|
|
1513
|
-
_context18.next =
|
|
1512
|
+
_context18.next = 34;
|
|
1514
1513
|
break;
|
|
1515
1514
|
}
|
|
1516
1515
|
msg = _step6.value;
|
|
1517
1516
|
channelKey = msg._channelKey || msg.module || 'product';
|
|
1518
1517
|
if (!(channelKey === 'product')) {
|
|
1519
|
-
_context18.next =
|
|
1518
|
+
_context18.next = 31;
|
|
1520
1519
|
break;
|
|
1521
1520
|
}
|
|
1522
1521
|
if (!(msg.operation === 'delete' || msg.action === 'delete')) {
|
|
@@ -1524,45 +1523,34 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1524
1523
|
break;
|
|
1525
1524
|
}
|
|
1526
1525
|
if ((_msg$ids = msg.ids) !== null && _msg$ids !== void 0 && _msg$ids.length) deleteIds.push.apply(deleteIds, _toConsumableArray(msg.ids));else if (msg.id) deleteIds.push(msg.id);
|
|
1527
|
-
return _context18.abrupt("continue",
|
|
1526
|
+
return _context18.abrupt("continue", 32);
|
|
1528
1527
|
case 19:
|
|
1529
|
-
if (!((_msg$change_types = msg.change_types) !== null && _msg$change_types !== void 0 && _msg$change_types.
|
|
1530
|
-
|
|
1531
|
-
}))) {
|
|
1532
|
-
_context18.next = 22;
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
|
-
this.logInfo('跳过仅库存变更', {
|
|
1536
|
-
ids: msg.ids
|
|
1537
|
-
});
|
|
1538
|
-
return _context18.abrupt("continue", 35);
|
|
1539
|
-
case 22:
|
|
1540
|
-
if (!((_msg$change_types2 = msg.change_types) !== null && _msg$change_types2 !== void 0 && _msg$change_types2.includes('price'))) {
|
|
1541
|
-
_context18.next = 27;
|
|
1528
|
+
if (!((_msg$change_types = msg.change_types) !== null && _msg$change_types !== void 0 && _msg$change_types.includes('price'))) {
|
|
1529
|
+
_context18.next = 24;
|
|
1542
1530
|
break;
|
|
1543
1531
|
}
|
|
1544
1532
|
ids = msg.ids || (msg.id ? [msg.id] : []);
|
|
1545
1533
|
sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(ids));
|
|
1546
1534
|
priceRefreshIds.push.apply(priceRefreshIds, _toConsumableArray(ids));
|
|
1547
|
-
return _context18.abrupt("continue",
|
|
1548
|
-
case
|
|
1535
|
+
return _context18.abrupt("continue", 32);
|
|
1536
|
+
case 24:
|
|
1549
1537
|
if (!msg.body) {
|
|
1550
|
-
_context18.next =
|
|
1538
|
+
_context18.next = 28;
|
|
1551
1539
|
break;
|
|
1552
1540
|
}
|
|
1553
1541
|
bodyId = msg.body.id || msg.id;
|
|
1554
1542
|
if (bodyId) bodyUpdates.set(bodyId, msg.body);
|
|
1555
|
-
return _context18.abrupt("continue",
|
|
1556
|
-
case
|
|
1543
|
+
return _context18.abrupt("continue", 32);
|
|
1544
|
+
case 28:
|
|
1557
1545
|
// 5. 其他情况(有 ids 无 body 无 change_types)→ SSE 拉取
|
|
1558
1546
|
if ((_msg$ids2 = msg.ids) !== null && _msg$ids2 !== void 0 && _msg$ids2.length) {
|
|
1559
1547
|
sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.ids));
|
|
1560
1548
|
} else if (msg.id) {
|
|
1561
1549
|
sseRefreshIds.push(msg.id);
|
|
1562
1550
|
}
|
|
1563
|
-
_context18.next =
|
|
1551
|
+
_context18.next = 32;
|
|
1564
1552
|
break;
|
|
1565
|
-
case
|
|
1553
|
+
case 31:
|
|
1566
1554
|
if (['product_collection', 'product_category', 'product_quotation'].includes(channelKey)) {
|
|
1567
1555
|
if ((_msg$relation_product = msg.relation_product_ids) !== null && _msg$relation_product !== void 0 && _msg$relation_product.length) {
|
|
1568
1556
|
sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.relation_product_ids));
|
|
@@ -1572,73 +1560,73 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1572
1560
|
}
|
|
1573
1561
|
}
|
|
1574
1562
|
}
|
|
1575
|
-
case
|
|
1563
|
+
case 32:
|
|
1576
1564
|
_context18.next = 12;
|
|
1577
1565
|
break;
|
|
1578
|
-
case
|
|
1579
|
-
_context18.next =
|
|
1566
|
+
case 34:
|
|
1567
|
+
_context18.next = 39;
|
|
1580
1568
|
break;
|
|
1581
|
-
case
|
|
1582
|
-
_context18.prev =
|
|
1569
|
+
case 36:
|
|
1570
|
+
_context18.prev = 36;
|
|
1583
1571
|
_context18.t0 = _context18["catch"](10);
|
|
1584
1572
|
_iterator6.e(_context18.t0);
|
|
1585
|
-
case
|
|
1586
|
-
_context18.prev =
|
|
1573
|
+
case 39:
|
|
1574
|
+
_context18.prev = 39;
|
|
1587
1575
|
_iterator6.f();
|
|
1588
|
-
return _context18.finish(
|
|
1589
|
-
case
|
|
1576
|
+
return _context18.finish(39);
|
|
1577
|
+
case 42:
|
|
1590
1578
|
uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
|
|
1591
1579
|
uniqueSSEIds = _toConsumableArray(new Set(sseRefreshIds));
|
|
1592
1580
|
uniquePriceIds = _toConsumableArray(new Set(priceRefreshIds)); // 1. 处理删除
|
|
1593
1581
|
if (!(uniqueDeleteIds.length > 0)) {
|
|
1594
|
-
_context18.next =
|
|
1582
|
+
_context18.next = 48;
|
|
1595
1583
|
break;
|
|
1596
1584
|
}
|
|
1597
|
-
_context18.next =
|
|
1585
|
+
_context18.next = 48;
|
|
1598
1586
|
return this.removeProductsByIds(uniqueDeleteIds);
|
|
1599
|
-
case
|
|
1587
|
+
case 48:
|
|
1600
1588
|
if (!(bodyUpdates.size > 0)) {
|
|
1601
|
-
_context18.next =
|
|
1589
|
+
_context18.next = 51;
|
|
1602
1590
|
break;
|
|
1603
1591
|
}
|
|
1604
|
-
_context18.next =
|
|
1592
|
+
_context18.next = 51;
|
|
1605
1593
|
return this.applyBodyUpdatesToStore(bodyUpdates);
|
|
1606
|
-
case
|
|
1594
|
+
case 51:
|
|
1607
1595
|
if (!(uniqueSSEIds.length > 0)) {
|
|
1608
|
-
_context18.next =
|
|
1596
|
+
_context18.next = 61;
|
|
1609
1597
|
break;
|
|
1610
1598
|
}
|
|
1611
|
-
_context18.next =
|
|
1599
|
+
_context18.next = 54;
|
|
1612
1600
|
return this.fetchProductsBySSE(uniqueSSEIds);
|
|
1613
|
-
case
|
|
1601
|
+
case 54:
|
|
1614
1602
|
freshProducts = _context18.sent;
|
|
1615
1603
|
if (!(freshProducts.length > 0)) {
|
|
1616
|
-
_context18.next =
|
|
1604
|
+
_context18.next = 60;
|
|
1617
1605
|
break;
|
|
1618
1606
|
}
|
|
1619
|
-
_context18.next =
|
|
1607
|
+
_context18.next = 58;
|
|
1620
1608
|
return this.mergeProductsToStore(freshProducts);
|
|
1621
|
-
case
|
|
1622
|
-
_context18.next =
|
|
1609
|
+
case 58:
|
|
1610
|
+
_context18.next = 60;
|
|
1623
1611
|
return this.updatePriceCacheForProducts(freshProducts);
|
|
1624
|
-
case
|
|
1612
|
+
case 60:
|
|
1625
1613
|
this.logInfo('processProductSyncMessages: SSE 增量更新完成', {
|
|
1626
1614
|
requestedCount: uniqueSSEIds.length,
|
|
1627
1615
|
receivedCount: freshProducts.length
|
|
1628
1616
|
});
|
|
1629
|
-
case
|
|
1617
|
+
case 61:
|
|
1630
1618
|
// 4. 处理报价单价格刷新(排除已被第3步 SSE 处理过的 id,避免重复请求)
|
|
1631
1619
|
sseHandledSet = new Set(uniqueSSEIds);
|
|
1632
1620
|
remainingPriceIds = uniquePriceIds.filter(function (id) {
|
|
1633
1621
|
return !sseHandledSet.has(id);
|
|
1634
1622
|
});
|
|
1635
1623
|
if (!(remainingPriceIds.length > 0)) {
|
|
1636
|
-
_context18.next =
|
|
1624
|
+
_context18.next = 66;
|
|
1637
1625
|
break;
|
|
1638
1626
|
}
|
|
1639
|
-
_context18.next =
|
|
1627
|
+
_context18.next = 66;
|
|
1640
1628
|
return this.updateProductPriceByIds(remainingPriceIds);
|
|
1641
|
-
case
|
|
1629
|
+
case 66:
|
|
1642
1630
|
this.logInfo('processProductSyncMessages: 处理完成', {
|
|
1643
1631
|
deleteCount: uniqueDeleteIds.length,
|
|
1644
1632
|
bodyUpdateCount: bodyUpdates.size,
|
|
@@ -1648,19 +1636,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1648
1636
|
|
|
1649
1637
|
// 如果都没有变更,则不触发 onProductsSyncCompleted
|
|
1650
1638
|
if (!(uniqueDeleteIds.length === 0 && bodyUpdates.size === 0 && uniqueSSEIds.length === 0 && uniquePriceIds.length === 0)) {
|
|
1651
|
-
_context18.next =
|
|
1639
|
+
_context18.next = 70;
|
|
1652
1640
|
break;
|
|
1653
1641
|
}
|
|
1654
1642
|
this.logInfo('processProductSyncMessages: 没有变更,不触发 onProductsSyncCompleted');
|
|
1655
1643
|
return _context18.abrupt("return");
|
|
1656
|
-
case
|
|
1657
|
-
_context18.next =
|
|
1644
|
+
case 70:
|
|
1645
|
+
_context18.next = 72;
|
|
1658
1646
|
return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, null);
|
|
1659
|
-
case
|
|
1647
|
+
case 72:
|
|
1660
1648
|
case "end":
|
|
1661
1649
|
return _context18.stop();
|
|
1662
1650
|
}
|
|
1663
|
-
}, _callee18, this, [[10, 39, 42
|
|
1651
|
+
}, _callee18, this, [[10, 36, 39, 42]]);
|
|
1664
1652
|
}));
|
|
1665
1653
|
function processProductSyncMessages() {
|
|
1666
1654
|
return _processProductSyncMessages.apply(this, arguments);
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|
|
@@ -202,9 +202,9 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
202
202
|
*
|
|
203
203
|
* product 模块:
|
|
204
204
|
* - operation === 'delete' → 本地删除
|
|
205
|
-
* - 有 body(无 price change_types) → body 完整数据直接覆盖本地
|
|
206
205
|
* - change_types 包含 price → SSE 增量拉取 + 刷新报价单价格缓存
|
|
207
|
-
* -
|
|
206
|
+
* - 有 body → body 完整数据直接覆盖本地
|
|
207
|
+
|
|
208
208
|
*
|
|
209
209
|
* product_collection / product_category / product_quotation:
|
|
210
210
|
* - 按 relation_product_ids SSE 拉取受影响商品
|
|
@@ -849,22 +849,22 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
849
849
|
this.logInfo("setupProductSync: pubsub 订阅已建立");
|
|
850
850
|
}
|
|
851
851
|
/**
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
852
|
+
* 处理防抖后的同步消息批次
|
|
853
|
+
*
|
|
854
|
+
* product 模块:
|
|
855
|
+
* - operation === 'delete' → 本地删除
|
|
856
|
+
* - change_types 包含 price → SSE 增量拉取 + 刷新报价单价格缓存
|
|
857
|
+
* - 有 body → body 完整数据直接覆盖本地
|
|
858
|
+
|
|
859
|
+
*
|
|
860
|
+
* product_collection / product_category / product_quotation:
|
|
861
|
+
* - 按 relation_product_ids SSE 拉取受影响商品
|
|
862
|
+
* - product_quotation 额外刷新报价单价格缓存
|
|
863
|
+
*
|
|
864
|
+
* 处理完成后 emit onProductsSyncCompleted 通知 Server 层
|
|
865
|
+
*/
|
|
866
866
|
async processProductSyncMessages() {
|
|
867
|
-
var _a, _b, _c, _d
|
|
867
|
+
var _a, _b, _c, _d;
|
|
868
868
|
const messages = [...this.pendingSyncMessages];
|
|
869
869
|
this.pendingSyncMessages = [];
|
|
870
870
|
if (messages.length === 0)
|
|
@@ -884,11 +884,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
884
884
|
deleteIds.push(msg.id);
|
|
885
885
|
continue;
|
|
886
886
|
}
|
|
887
|
-
if ((
|
|
888
|
-
this.logInfo("跳过仅库存变更", { ids: msg.ids });
|
|
889
|
-
continue;
|
|
890
|
-
}
|
|
891
|
-
if ((_c = msg.change_types) == null ? void 0 : _c.includes("price")) {
|
|
887
|
+
if ((_b = msg.change_types) == null ? void 0 : _b.includes("price")) {
|
|
892
888
|
const ids = msg.ids || (msg.id ? [msg.id] : []);
|
|
893
889
|
sseRefreshIds.push(...ids);
|
|
894
890
|
priceRefreshIds.push(...ids);
|
|
@@ -900,13 +896,13 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
900
896
|
bodyUpdates.set(bodyId, msg.body);
|
|
901
897
|
continue;
|
|
902
898
|
}
|
|
903
|
-
if ((
|
|
899
|
+
if ((_c = msg.ids) == null ? void 0 : _c.length) {
|
|
904
900
|
sseRefreshIds.push(...msg.ids);
|
|
905
901
|
} else if (msg.id) {
|
|
906
902
|
sseRefreshIds.push(msg.id);
|
|
907
903
|
}
|
|
908
904
|
} else if (["product_collection", "product_category", "product_quotation"].includes(channelKey)) {
|
|
909
|
-
if ((
|
|
905
|
+
if ((_d = msg.relation_product_ids) == null ? void 0 : _d.length) {
|
|
910
906
|
sseRefreshIds.push(...msg.relation_product_ids);
|
|
911
907
|
if (channelKey === "product_quotation") {
|
|
912
908
|
this.clearPriceCache();
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|