@pisell/pisellos 2.1.36 → 2.1.38
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/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +41 -47
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +4 -4
- package/package.json +1 -1
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
};
|
|
343
343
|
setOtherData(key: string, value: any): void;
|
|
344
344
|
getOtherData(key: string): any;
|
|
345
|
-
getProductTypeById(id: number): Promise<"
|
|
345
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
346
346
|
/**
|
|
347
347
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
348
348
|
*
|
|
@@ -2686,41 +2686,35 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2686
2686
|
|
|
2687
2687
|
// 与其他资源的时间段求交集
|
|
2688
2688
|
var _loop2 = function _loop2() {
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
});
|
|
2689
|
+
var currentResourceSlots = allTimeSlots[i];
|
|
2690
|
+
var intersections = [];
|
|
2691
|
+
|
|
2692
|
+
// 计算当前公共时间段与下一个资源时间段的交集
|
|
2693
|
+
commonSlots.forEach(function (commonSlot) {
|
|
2694
|
+
currentResourceSlots.forEach(function (currentSlot) {
|
|
2695
|
+
var overlapStart = commonSlot.start.isAfter(currentSlot.start) ? commonSlot.start : currentSlot.start;
|
|
2696
|
+
var overlapEnd = commonSlot.end.isBefore(currentSlot.end) ? commonSlot.end : currentSlot.end;
|
|
2697
|
+
|
|
2698
|
+
// 如果有重叠时间且重叠时间大于0
|
|
2699
|
+
if (overlapStart.isBefore(overlapEnd)) {
|
|
2700
|
+
intersections.push({
|
|
2701
|
+
start: overlapStart,
|
|
2702
|
+
end: overlapEnd
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2706
2705
|
});
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
};
|
|
2718
|
-
}
|
|
2719
|
-
},
|
|
2720
|
-
_ret2;
|
|
2706
|
+
});
|
|
2707
|
+
if (intersections.length === 0) {
|
|
2708
|
+
console.log("\u8D44\u6E90".concat(i, "\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90"));
|
|
2709
|
+
return 1; // continue
|
|
2710
|
+
}
|
|
2711
|
+
commonSlots = intersections;
|
|
2712
|
+
console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
|
|
2713
|
+
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
2714
|
+
}));
|
|
2715
|
+
};
|
|
2721
2716
|
for (var i = 1; i < allTimeSlots.length; i++) {
|
|
2722
|
-
|
|
2723
|
-
if (_ret2) return _ret2.v;
|
|
2717
|
+
if (_loop2()) continue;
|
|
2724
2718
|
}
|
|
2725
2719
|
|
|
2726
2720
|
// 格式化返回结果
|
|
@@ -2969,10 +2963,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2969
2963
|
}
|
|
2970
2964
|
});
|
|
2971
2965
|
},
|
|
2972
|
-
|
|
2966
|
+
_ret2;
|
|
2973
2967
|
for (var _i = 0, _Object$entries = Object.entries(itemsByResourceType); _i < _Object$entries.length; _i++) {
|
|
2974
|
-
|
|
2975
|
-
if (
|
|
2968
|
+
_ret2 = _loop3();
|
|
2969
|
+
if (_ret2) return _ret2.v;
|
|
2976
2970
|
}
|
|
2977
2971
|
|
|
2978
2972
|
// 如果有容量问题,找出限制最严格的资源类型,返回其总容量
|
|
@@ -3069,11 +3063,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3069
3063
|
};
|
|
3070
3064
|
}
|
|
3071
3065
|
},
|
|
3072
|
-
|
|
3066
|
+
_ret3;
|
|
3073
3067
|
for (var _i2 = 0, _Object$entries2 = Object.entries(cartItemsByTimeSlot); _i2 < _Object$entries2.length; _i2++) {
|
|
3074
|
-
|
|
3075
|
-
if (
|
|
3076
|
-
if (
|
|
3068
|
+
_ret3 = _loop4();
|
|
3069
|
+
if (_ret3 === 0) continue;
|
|
3070
|
+
if (_ret3) return _ret3.v;
|
|
3077
3071
|
}
|
|
3078
3072
|
|
|
3079
3073
|
// 全部通过检测,返回成功和最小可用数量
|
|
@@ -3400,10 +3394,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3400
3394
|
}
|
|
3401
3395
|
});
|
|
3402
3396
|
},
|
|
3403
|
-
|
|
3397
|
+
_ret4;
|
|
3404
3398
|
for (var _i3 = 0, _Object$entries3 = Object.entries(itemsByResourceType); _i3 < _Object$entries3.length; _i3++) {
|
|
3405
|
-
|
|
3406
|
-
if (
|
|
3399
|
+
_ret4 = _loop5();
|
|
3400
|
+
if (_ret4) return _ret4.v;
|
|
3407
3401
|
}
|
|
3408
3402
|
|
|
3409
3403
|
// 如果有容量问题,找出限制最严格的资源类型,返回其总容量
|
|
@@ -3500,11 +3494,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3500
3494
|
};
|
|
3501
3495
|
}
|
|
3502
3496
|
},
|
|
3503
|
-
|
|
3497
|
+
_ret5;
|
|
3504
3498
|
for (var _i4 = 0, _Object$entries4 = Object.entries(cartItemsByTimeSlot); _i4 < _Object$entries4.length; _i4++) {
|
|
3505
|
-
|
|
3506
|
-
if (
|
|
3507
|
-
if (
|
|
3499
|
+
_ret5 = _loop6();
|
|
3500
|
+
if (_ret5 === 0) continue;
|
|
3501
|
+
if (_ret5) return _ret5.v;
|
|
3508
3502
|
}
|
|
3509
3503
|
|
|
3510
3504
|
// 全部通过检测,返回成功和最小可用数量
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
};
|
|
343
343
|
setOtherData(key: string, value: any): void;
|
|
344
344
|
getOtherData(key: string): any;
|
|
345
|
-
getProductTypeById(id: number): Promise<"
|
|
345
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
346
346
|
/**
|
|
347
347
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
348
348
|
*
|
|
@@ -1904,12 +1904,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1904
1904
|
}
|
|
1905
1905
|
});
|
|
1906
1906
|
});
|
|
1907
|
+
if (intersections.length === 0) {
|
|
1908
|
+
console.log(`资源${i}与当前公共时间段无交集,跳过该资源`);
|
|
1909
|
+
continue;
|
|
1910
|
+
}
|
|
1907
1911
|
commonSlots = intersections;
|
|
1908
1912
|
console.log(`与资源${i}求交集后的公共时间段:`, commonSlots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`));
|
|
1909
|
-
if (commonSlots.length === 0) {
|
|
1910
|
-
console.log("没有找到公共时间段");
|
|
1911
|
-
return [];
|
|
1912
|
-
}
|
|
1913
1913
|
}
|
|
1914
1914
|
const result = commonSlots.map((slot) => ({
|
|
1915
1915
|
startTime: slot.start.format("HH:mm"),
|