@pisell/pisellos 2.2.83 → 2.2.85
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 +51 -60
- 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 -19
- 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, _msg$relation_product, bodyId, _msg$relation_product2, 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 = 35;
|
|
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 = 32;
|
|
1520
1519
|
break;
|
|
1521
1520
|
}
|
|
1522
1521
|
if (!(msg.operation === 'delete' || msg.action === 'delete')) {
|
|
@@ -1524,47 +1523,39 @@ 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", 33);
|
|
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", 33);
|
|
1536
|
+
case 24:
|
|
1549
1537
|
if (!msg.body) {
|
|
1550
|
-
_context18.next =
|
|
1538
|
+
_context18.next = 29;
|
|
1551
1539
|
break;
|
|
1552
1540
|
}
|
|
1553
1541
|
bodyId = msg.body.id || msg.id;
|
|
1554
1542
|
if (bodyId) bodyUpdates.set(bodyId, msg.body);
|
|
1555
|
-
|
|
1556
|
-
|
|
1543
|
+
if ((_msg$relation_product = msg.relation_product_ids) !== null && _msg$relation_product !== void 0 && _msg$relation_product.length) {
|
|
1544
|
+
sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.relation_product_ids));
|
|
1545
|
+
}
|
|
1546
|
+
return _context18.abrupt("continue", 33);
|
|
1547
|
+
case 29:
|
|
1557
1548
|
// 5. 其他情况(有 ids 无 body 无 change_types)→ SSE 拉取
|
|
1558
1549
|
if ((_msg$ids2 = msg.ids) !== null && _msg$ids2 !== void 0 && _msg$ids2.length) {
|
|
1559
1550
|
sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.ids));
|
|
1560
1551
|
} else if (msg.id) {
|
|
1561
1552
|
sseRefreshIds.push(msg.id);
|
|
1562
1553
|
}
|
|
1563
|
-
_context18.next =
|
|
1554
|
+
_context18.next = 33;
|
|
1564
1555
|
break;
|
|
1565
|
-
case
|
|
1556
|
+
case 32:
|
|
1566
1557
|
if (['product_collection', 'product_category', 'product_quotation'].includes(channelKey)) {
|
|
1567
|
-
if ((_msg$
|
|
1558
|
+
if ((_msg$relation_product2 = msg.relation_product_ids) !== null && _msg$relation_product2 !== void 0 && _msg$relation_product2.length) {
|
|
1568
1559
|
sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.relation_product_ids));
|
|
1569
1560
|
if (channelKey === 'product_quotation') {
|
|
1570
1561
|
this.clearPriceCache();
|
|
@@ -1572,73 +1563,73 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1572
1563
|
}
|
|
1573
1564
|
}
|
|
1574
1565
|
}
|
|
1575
|
-
case
|
|
1566
|
+
case 33:
|
|
1576
1567
|
_context18.next = 12;
|
|
1577
1568
|
break;
|
|
1578
|
-
case
|
|
1579
|
-
_context18.next =
|
|
1569
|
+
case 35:
|
|
1570
|
+
_context18.next = 40;
|
|
1580
1571
|
break;
|
|
1581
|
-
case
|
|
1582
|
-
_context18.prev =
|
|
1572
|
+
case 37:
|
|
1573
|
+
_context18.prev = 37;
|
|
1583
1574
|
_context18.t0 = _context18["catch"](10);
|
|
1584
1575
|
_iterator6.e(_context18.t0);
|
|
1585
|
-
case
|
|
1586
|
-
_context18.prev =
|
|
1576
|
+
case 40:
|
|
1577
|
+
_context18.prev = 40;
|
|
1587
1578
|
_iterator6.f();
|
|
1588
|
-
return _context18.finish(
|
|
1589
|
-
case
|
|
1579
|
+
return _context18.finish(40);
|
|
1580
|
+
case 43:
|
|
1590
1581
|
uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
|
|
1591
1582
|
uniqueSSEIds = _toConsumableArray(new Set(sseRefreshIds));
|
|
1592
1583
|
uniquePriceIds = _toConsumableArray(new Set(priceRefreshIds)); // 1. 处理删除
|
|
1593
1584
|
if (!(uniqueDeleteIds.length > 0)) {
|
|
1594
|
-
_context18.next =
|
|
1585
|
+
_context18.next = 49;
|
|
1595
1586
|
break;
|
|
1596
1587
|
}
|
|
1597
|
-
_context18.next =
|
|
1588
|
+
_context18.next = 49;
|
|
1598
1589
|
return this.removeProductsByIds(uniqueDeleteIds);
|
|
1599
|
-
case
|
|
1590
|
+
case 49:
|
|
1600
1591
|
if (!(bodyUpdates.size > 0)) {
|
|
1601
|
-
_context18.next =
|
|
1592
|
+
_context18.next = 52;
|
|
1602
1593
|
break;
|
|
1603
1594
|
}
|
|
1604
|
-
_context18.next =
|
|
1595
|
+
_context18.next = 52;
|
|
1605
1596
|
return this.applyBodyUpdatesToStore(bodyUpdates);
|
|
1606
|
-
case
|
|
1597
|
+
case 52:
|
|
1607
1598
|
if (!(uniqueSSEIds.length > 0)) {
|
|
1608
|
-
_context18.next =
|
|
1599
|
+
_context18.next = 62;
|
|
1609
1600
|
break;
|
|
1610
1601
|
}
|
|
1611
|
-
_context18.next =
|
|
1602
|
+
_context18.next = 55;
|
|
1612
1603
|
return this.fetchProductsBySSE(uniqueSSEIds);
|
|
1613
|
-
case
|
|
1604
|
+
case 55:
|
|
1614
1605
|
freshProducts = _context18.sent;
|
|
1615
1606
|
if (!(freshProducts.length > 0)) {
|
|
1616
|
-
_context18.next =
|
|
1607
|
+
_context18.next = 61;
|
|
1617
1608
|
break;
|
|
1618
1609
|
}
|
|
1619
|
-
_context18.next =
|
|
1610
|
+
_context18.next = 59;
|
|
1620
1611
|
return this.mergeProductsToStore(freshProducts);
|
|
1621
|
-
case
|
|
1622
|
-
_context18.next =
|
|
1612
|
+
case 59:
|
|
1613
|
+
_context18.next = 61;
|
|
1623
1614
|
return this.updatePriceCacheForProducts(freshProducts);
|
|
1624
|
-
case
|
|
1615
|
+
case 61:
|
|
1625
1616
|
this.logInfo('processProductSyncMessages: SSE 增量更新完成', {
|
|
1626
1617
|
requestedCount: uniqueSSEIds.length,
|
|
1627
1618
|
receivedCount: freshProducts.length
|
|
1628
1619
|
});
|
|
1629
|
-
case
|
|
1620
|
+
case 62:
|
|
1630
1621
|
// 4. 处理报价单价格刷新(排除已被第3步 SSE 处理过的 id,避免重复请求)
|
|
1631
1622
|
sseHandledSet = new Set(uniqueSSEIds);
|
|
1632
1623
|
remainingPriceIds = uniquePriceIds.filter(function (id) {
|
|
1633
1624
|
return !sseHandledSet.has(id);
|
|
1634
1625
|
});
|
|
1635
1626
|
if (!(remainingPriceIds.length > 0)) {
|
|
1636
|
-
_context18.next =
|
|
1627
|
+
_context18.next = 67;
|
|
1637
1628
|
break;
|
|
1638
1629
|
}
|
|
1639
|
-
_context18.next =
|
|
1630
|
+
_context18.next = 67;
|
|
1640
1631
|
return this.updateProductPriceByIds(remainingPriceIds);
|
|
1641
|
-
case
|
|
1632
|
+
case 67:
|
|
1642
1633
|
this.logInfo('processProductSyncMessages: 处理完成', {
|
|
1643
1634
|
deleteCount: uniqueDeleteIds.length,
|
|
1644
1635
|
bodyUpdateCount: bodyUpdates.size,
|
|
@@ -1648,19 +1639,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1648
1639
|
|
|
1649
1640
|
// 如果都没有变更,则不触发 onProductsSyncCompleted
|
|
1650
1641
|
if (!(uniqueDeleteIds.length === 0 && bodyUpdates.size === 0 && uniqueSSEIds.length === 0 && uniquePriceIds.length === 0)) {
|
|
1651
|
-
_context18.next =
|
|
1642
|
+
_context18.next = 71;
|
|
1652
1643
|
break;
|
|
1653
1644
|
}
|
|
1654
1645
|
this.logInfo('processProductSyncMessages: 没有变更,不触发 onProductsSyncCompleted');
|
|
1655
1646
|
return _context18.abrupt("return");
|
|
1656
|
-
case
|
|
1657
|
-
_context18.next =
|
|
1647
|
+
case 71:
|
|
1648
|
+
_context18.next = 73;
|
|
1658
1649
|
return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, null);
|
|
1659
|
-
case
|
|
1650
|
+
case 73:
|
|
1660
1651
|
case "end":
|
|
1661
1652
|
return _context18.stop();
|
|
1662
1653
|
}
|
|
1663
|
-
}, _callee18, this, [[10,
|
|
1654
|
+
}, _callee18, this, [[10, 37, 40, 43]]);
|
|
1664
1655
|
}));
|
|
1665
1656
|
function processProductSyncMessages() {
|
|
1666
1657
|
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,20 +849,20 @@ 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
867
|
var _a, _b, _c, _d, _e;
|
|
868
868
|
const messages = [...this.pendingSyncMessages];
|
|
@@ -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);
|
|
@@ -898,6 +894,9 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
898
894
|
const bodyId = msg.body.id || msg.id;
|
|
899
895
|
if (bodyId)
|
|
900
896
|
bodyUpdates.set(bodyId, msg.body);
|
|
897
|
+
if ((_c = msg.relation_product_ids) == null ? void 0 : _c.length) {
|
|
898
|
+
sseRefreshIds.push(...msg.relation_product_ids);
|
|
899
|
+
}
|
|
901
900
|
continue;
|
|
902
901
|
}
|
|
903
902
|
if ((_d = msg.ids) == null ? void 0 : _d.length) {
|
|
@@ -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 客户状态
|