@pisell/pisellos 1.0.73 → 1.0.74
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.
|
@@ -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
|
}
|
|
@@ -2690,41 +2690,35 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2690
2690
|
|
|
2691
2691
|
// 与其他资源的时间段求交集
|
|
2692
2692
|
var _loop2 = function _loop2() {
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
});
|
|
2693
|
+
var currentResourceSlots = allTimeSlots[i];
|
|
2694
|
+
var intersections = [];
|
|
2695
|
+
|
|
2696
|
+
// 计算当前公共时间段与下一个资源时间段的交集
|
|
2697
|
+
commonSlots.forEach(function (commonSlot) {
|
|
2698
|
+
currentResourceSlots.forEach(function (currentSlot) {
|
|
2699
|
+
var overlapStart = commonSlot.start.isAfter(currentSlot.start) ? commonSlot.start : currentSlot.start;
|
|
2700
|
+
var overlapEnd = commonSlot.end.isBefore(currentSlot.end) ? commonSlot.end : currentSlot.end;
|
|
2701
|
+
|
|
2702
|
+
// 如果有重叠时间且重叠时间大于0
|
|
2703
|
+
if (overlapStart.isBefore(overlapEnd)) {
|
|
2704
|
+
intersections.push({
|
|
2705
|
+
start: overlapStart,
|
|
2706
|
+
end: overlapEnd
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2710
2709
|
});
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
};
|
|
2722
|
-
}
|
|
2723
|
-
},
|
|
2724
|
-
_ret2;
|
|
2710
|
+
});
|
|
2711
|
+
if (intersections.length === 0) {
|
|
2712
|
+
console.log("\u8D44\u6E90".concat(i, "\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90"));
|
|
2713
|
+
return 1; // continue
|
|
2714
|
+
}
|
|
2715
|
+
commonSlots = intersections;
|
|
2716
|
+
console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
|
|
2717
|
+
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
2718
|
+
}));
|
|
2719
|
+
};
|
|
2725
2720
|
for (var i = 1; i < allTimeSlots.length; i++) {
|
|
2726
|
-
|
|
2727
|
-
if (_ret2) return _ret2.v;
|
|
2721
|
+
if (_loop2()) continue;
|
|
2728
2722
|
}
|
|
2729
2723
|
|
|
2730
2724
|
// 格式化返回结果
|
|
@@ -2973,10 +2967,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2973
2967
|
}
|
|
2974
2968
|
});
|
|
2975
2969
|
},
|
|
2976
|
-
|
|
2970
|
+
_ret2;
|
|
2977
2971
|
for (var _i = 0, _Object$entries = Object.entries(itemsByResourceType); _i < _Object$entries.length; _i++) {
|
|
2978
|
-
|
|
2979
|
-
if (
|
|
2972
|
+
_ret2 = _loop3();
|
|
2973
|
+
if (_ret2) return _ret2.v;
|
|
2980
2974
|
}
|
|
2981
2975
|
|
|
2982
2976
|
// 如果有容量问题,找出限制最严格的资源类型,返回其总容量
|
|
@@ -3073,11 +3067,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3073
3067
|
};
|
|
3074
3068
|
}
|
|
3075
3069
|
},
|
|
3076
|
-
|
|
3070
|
+
_ret3;
|
|
3077
3071
|
for (var _i2 = 0, _Object$entries2 = Object.entries(cartItemsByTimeSlot); _i2 < _Object$entries2.length; _i2++) {
|
|
3078
|
-
|
|
3079
|
-
if (
|
|
3080
|
-
if (
|
|
3072
|
+
_ret3 = _loop4();
|
|
3073
|
+
if (_ret3 === 0) continue;
|
|
3074
|
+
if (_ret3) return _ret3.v;
|
|
3081
3075
|
}
|
|
3082
3076
|
|
|
3083
3077
|
// 全部通过检测,返回成功和最小可用数量
|
|
@@ -3404,10 +3398,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3404
3398
|
}
|
|
3405
3399
|
});
|
|
3406
3400
|
},
|
|
3407
|
-
|
|
3401
|
+
_ret4;
|
|
3408
3402
|
for (var _i3 = 0, _Object$entries3 = Object.entries(itemsByResourceType); _i3 < _Object$entries3.length; _i3++) {
|
|
3409
|
-
|
|
3410
|
-
if (
|
|
3403
|
+
_ret4 = _loop5();
|
|
3404
|
+
if (_ret4) return _ret4.v;
|
|
3411
3405
|
}
|
|
3412
3406
|
|
|
3413
3407
|
// 如果有容量问题,找出限制最严格的资源类型,返回其总容量
|
|
@@ -3504,11 +3498,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3504
3498
|
};
|
|
3505
3499
|
}
|
|
3506
3500
|
},
|
|
3507
|
-
|
|
3501
|
+
_ret5;
|
|
3508
3502
|
for (var _i4 = 0, _Object$entries4 = Object.entries(cartItemsByTimeSlot); _i4 < _Object$entries4.length; _i4++) {
|
|
3509
|
-
|
|
3510
|
-
if (
|
|
3511
|
-
if (
|
|
3503
|
+
_ret5 = _loop6();
|
|
3504
|
+
if (_ret5 === 0) continue;
|
|
3505
|
+
if (_ret5) return _ret5.v;
|
|
3512
3506
|
}
|
|
3513
3507
|
|
|
3514
3508
|
// 全部通过检测,返回成功和最小可用数量
|
|
@@ -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
|
}
|
|
@@ -1908,12 +1908,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
});
|
|
1910
1910
|
});
|
|
1911
|
+
if (intersections.length === 0) {
|
|
1912
|
+
console.log(`资源${i}与当前公共时间段无交集,跳过该资源`);
|
|
1913
|
+
continue;
|
|
1914
|
+
}
|
|
1911
1915
|
commonSlots = intersections;
|
|
1912
1916
|
console.log(`与资源${i}求交集后的公共时间段:`, commonSlots.map((slot) => `${slot.start.format("HH:mm")}-${slot.end.format("HH:mm")}`));
|
|
1913
|
-
if (commonSlots.length === 0) {
|
|
1914
|
-
console.log("没有找到公共时间段");
|
|
1915
|
-
return [];
|
|
1916
|
-
}
|
|
1917
1917
|
}
|
|
1918
1918
|
const result = commonSlots.map((slot) => ({
|
|
1919
1919
|
startTime: slot.start.format("HH:mm"),
|