@pisell/pisellos 0.0.567 → 0.0.569
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/core/index.js +6 -9
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -7
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +26 -6
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -12
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +35 -17
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5437 -608
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +508 -874
- package/dist/modules/Payment/types.d.ts +40 -16
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.js +48 -34
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +184 -74
- package/dist/modules/ProductList/types.d.ts +17 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +219 -114
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +803 -163
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +78 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6137 -714
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2326 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1397 -540
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +289 -86
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +105 -84
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +137 -114
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -3
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4006 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2506 -445
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +36 -34
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +26 -18
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +199 -277
- package/dist/solution/Checkout/utils/index.js +8 -20
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +509 -454
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +6 -11
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +34 -20
- package/dist/solution/VenueBooking/index.js +630 -505
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +11 -1
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +383 -232
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +654 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +26 -49
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +331 -244
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +37 -67
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +270 -154
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +133 -113
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +81 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +3834 -489
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +78 -33
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1247 -345
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +542 -502
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +53 -49
- package/lib/modules/Payment/walletpass.js +231 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +160 -118
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +123 -89
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +1286 -894
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +130 -71
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +738 -250
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +345 -171
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +139 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +245 -57
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4668 -713
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +106 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1463 -316
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +117 -32
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +288 -146
- package/lib/server/modules/order/utils/filterOrders.js +318 -64
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +969 -383
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +220 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +269 -214
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +158 -132
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +197 -140
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1459 -160
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +101 -66
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +85 -80
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -80
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +103 -95
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1461 -1169
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -159
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +495 -470
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +495 -220
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +908 -904
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +457 -344
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +34 -20
- package/lib/solution/VenueBooking/index.js +982 -950
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +96 -108
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +124 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.d.ts +11 -1
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -1,51 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/modules/Schedule/getDateIsInSchedule.ts
|
|
30
|
-
var getDateIsInSchedule_exports = {};
|
|
31
|
-
__export(getDateIsInSchedule_exports, {
|
|
32
|
-
getDateIsInSchedule: () => getDateIsInSchedule,
|
|
33
|
-
getScheduleStartEndTimePoints: () => getScheduleStartEndTimePoints
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
34
5
|
});
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
6
|
+
exports.getScheduleStartEndTimePoints = exports.getDateIsInSchedule = void 0;
|
|
7
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
|
+
var _isSameOrAfter = _interopRequireDefault(require("dayjs/plugin/isSameOrAfter"));
|
|
9
|
+
var _isSameOrBefore = _interopRequireDefault(require("dayjs/plugin/isSameOrBefore"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
_dayjs.default.extend(_isSameOrAfter.default);
|
|
12
|
+
_dayjs.default.extend(_isSameOrBefore.default);
|
|
13
|
+
|
|
14
|
+
// 获取时间是否在日程范围内
|
|
15
|
+
const getDateIsInSchedule = (dateTime, scheduleList) => {
|
|
42
16
|
if (!dateTime || !scheduleList || scheduleList.length === 0) {
|
|
43
17
|
return false;
|
|
44
18
|
}
|
|
45
|
-
const targetDate = (0,
|
|
19
|
+
const targetDate = (0, _dayjs.default)(dateTime);
|
|
46
20
|
if (!targetDate.isValid()) {
|
|
47
21
|
return false;
|
|
48
22
|
}
|
|
23
|
+
|
|
24
|
+
// 遍历所有日程项
|
|
49
25
|
for (const schedule of scheduleList) {
|
|
50
26
|
if (isTimeInScheduleItem(dateTime, schedule)) {
|
|
51
27
|
return true;
|
|
@@ -53,173 +29,270 @@ var getDateIsInSchedule = (dateTime, scheduleList) => {
|
|
|
53
29
|
}
|
|
54
30
|
return false;
|
|
55
31
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
|
|
33
|
+
// 判断时间是否在单个日程项范围内
|
|
34
|
+
exports.getDateIsInSchedule = getDateIsInSchedule;
|
|
35
|
+
const isTimeInScheduleItem = (dateTime, schedule) => {
|
|
36
|
+
const targetDate = (0, _dayjs.default)(dateTime);
|
|
37
|
+
const targetDateString = dateTime.split(' ')[0]; // YYYY-MM-DD
|
|
38
|
+
const targetTimeString = dateTime.split(' ')[1] || '00:00:00'; // HH:mm:ss
|
|
39
|
+
|
|
60
40
|
switch (schedule.type) {
|
|
61
|
-
case
|
|
41
|
+
case 'standard':
|
|
62
42
|
return isInStandardSchedule(targetDate, targetDateString, targetTimeString, schedule);
|
|
63
|
-
case
|
|
43
|
+
case 'time-slots':
|
|
64
44
|
return isInTimeSlotsSchedule(targetDate, targetDateString, targetTimeString, schedule);
|
|
65
|
-
case
|
|
45
|
+
case 'designation':
|
|
66
46
|
return isInDesignationSchedule(targetDate, targetDateString, targetTimeString, schedule);
|
|
67
47
|
default:
|
|
68
48
|
return false;
|
|
69
49
|
}
|
|
70
50
|
};
|
|
71
|
-
|
|
51
|
+
|
|
52
|
+
// 处理标准类型日程
|
|
53
|
+
const isInStandardSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
72
54
|
if (!schedule.start_time || !schedule.end_time) {
|
|
73
55
|
return false;
|
|
74
56
|
}
|
|
75
|
-
const startDate = (0,
|
|
76
|
-
const endDate = (0,
|
|
57
|
+
const startDate = (0, _dayjs.default)(schedule.start_time);
|
|
58
|
+
const endDate = (0, _dayjs.default)(schedule.end_time);
|
|
59
|
+
|
|
60
|
+
// 先检查是否在基础时间范围内(不考虑重复),end 为开区间
|
|
77
61
|
const isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate);
|
|
78
|
-
if (schedule.repeat_type ===
|
|
62
|
+
if (schedule.repeat_type === 'none') {
|
|
79
63
|
return isInBasicRange;
|
|
80
64
|
}
|
|
65
|
+
|
|
66
|
+
// 处理重复日程
|
|
81
67
|
return isInRepeatingSchedule(targetDate, targetDateString, targetTimeString, schedule, startDate, endDate);
|
|
82
68
|
};
|
|
83
|
-
|
|
69
|
+
|
|
70
|
+
// 处理时间段类型日程
|
|
71
|
+
const isInTimeSlotsSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
84
72
|
if (!schedule.start_time) {
|
|
85
73
|
return false;
|
|
86
74
|
}
|
|
87
|
-
const scheduleStartDate = (0,
|
|
75
|
+
const scheduleStartDate = (0, _dayjs.default)(schedule.start_time.split(' ')[0]);
|
|
76
|
+
|
|
77
|
+
// 检查日期是否在日程的有效范围内(包含 daily / weekly 重复规则)
|
|
88
78
|
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
89
79
|
return false;
|
|
90
80
|
}
|
|
81
|
+
|
|
82
|
+
// 检查是否在任一时间段内
|
|
91
83
|
for (const timeSlot of schedule.time_slot) {
|
|
92
|
-
const slotStart =
|
|
93
|
-
const slotEnd =
|
|
94
|
-
|
|
84
|
+
const slotStart = `${targetDateString} ${timeSlot.start_time}:00`;
|
|
85
|
+
const slotEnd = `${targetDateString} ${timeSlot.end_time}:00`;
|
|
86
|
+
const slotStartDate = (0, _dayjs.default)(slotStart);
|
|
87
|
+
const slotEndDate = (0, _dayjs.default)(slotEnd);
|
|
88
|
+
if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
|
|
95
89
|
return true;
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
92
|
return false;
|
|
99
93
|
};
|
|
100
|
-
|
|
94
|
+
|
|
95
|
+
// 处理指定类型日程
|
|
96
|
+
const isInDesignationSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
101
97
|
if (!schedule.designation) {
|
|
102
98
|
return false;
|
|
103
99
|
}
|
|
100
|
+
|
|
101
|
+
// @ts-ignore
|
|
104
102
|
for (const designation of schedule.designation) {
|
|
105
103
|
const startDateTime = `${designation.start_date} ${designation.start_time}:00`;
|
|
106
104
|
const endDateTime = `${designation.end_date} ${designation.end_time}:00`;
|
|
107
|
-
const startDate = (0,
|
|
108
|
-
const endDate = (0,
|
|
109
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
105
|
+
const startDate = (0, _dayjs.default)(startDateTime);
|
|
106
|
+
const endDate = (0, _dayjs.default)(endDateTime);
|
|
107
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate)) {
|
|
110
108
|
return true;
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
return false;
|
|
114
112
|
};
|
|
115
|
-
|
|
113
|
+
|
|
114
|
+
// 处理重复日程逻辑
|
|
115
|
+
const isInRepeatingSchedule = (targetDate, targetDateString, targetTimeString, schedule, startDate, endDate) => {
|
|
116
116
|
if (!schedule.repeat_rule) {
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
|
-
const {
|
|
120
|
-
|
|
119
|
+
const {
|
|
120
|
+
repeat_rule,
|
|
121
|
+
repeat_type
|
|
122
|
+
} = schedule;
|
|
123
|
+
const targetDateOnly = (0, _dayjs.default)(targetDateString); // 只取日期部分
|
|
124
|
+
|
|
125
|
+
// 首先检查是否在包含日期中(包含日期是额外增加的有效日期)
|
|
121
126
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
122
127
|
for (const includedDate of repeat_rule.included_date) {
|
|
123
|
-
const includeStartDate = (0,
|
|
124
|
-
const includeEndDate = (0,
|
|
125
|
-
if (targetDateOnly.isSameOrAfter(includeStartDate,
|
|
128
|
+
const includeStartDate = (0, _dayjs.default)(includedDate.start);
|
|
129
|
+
const includeEndDate = (0, _dayjs.default)(includedDate.end);
|
|
130
|
+
if (targetDateOnly.isSameOrAfter(includeStartDate, 'day') && targetDateOnly.isSameOrBefore(includeEndDate, 'day')) {
|
|
131
|
+
// 在包含日期中,直接返回true,无需检查其他条件
|
|
126
132
|
return true;
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
135
|
}
|
|
136
|
+
|
|
137
|
+
// 检查是否在排除日期中
|
|
130
138
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
131
|
-
const excludeStartDate = (0,
|
|
132
|
-
const excludeEndDate = (0,
|
|
133
|
-
|
|
139
|
+
const excludeStartDate = (0, _dayjs.default)(excludedDate.start);
|
|
140
|
+
const excludeEndDate = (0, _dayjs.default)(excludedDate.end);
|
|
141
|
+
// 检查目标日期是否在排除范围内(包含边界)
|
|
142
|
+
if (targetDateOnly.isSameOrAfter(excludeStartDate, 'day') && targetDateOnly.isSameOrBefore(excludeEndDate, 'day')) {
|
|
134
143
|
return false;
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
|
|
147
|
+
// 检查重复规则的结束条件
|
|
148
|
+
if (repeat_rule.end.type === 'date' && repeat_rule.end.end_date) {
|
|
149
|
+
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
139
150
|
if (targetDate.isAfter(ruleEndDate)) {
|
|
140
151
|
return false;
|
|
141
152
|
}
|
|
142
153
|
}
|
|
154
|
+
|
|
155
|
+
// 根据重复类型检查
|
|
143
156
|
switch (repeat_type) {
|
|
144
|
-
case
|
|
157
|
+
case 'daily':
|
|
145
158
|
return isInDailyRepeat(targetDate, startDate, endDate, repeat_rule);
|
|
146
|
-
case
|
|
159
|
+
case 'weekly':
|
|
147
160
|
return isInWeeklyRepeat(targetDate, startDate, endDate, repeat_rule);
|
|
148
161
|
default:
|
|
149
162
|
return false;
|
|
163
|
+
// 不支持月和年重复
|
|
150
164
|
}
|
|
151
165
|
};
|
|
152
|
-
|
|
153
|
-
|
|
166
|
+
|
|
167
|
+
// 每日重复逻辑
|
|
168
|
+
const isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
169
|
+
const daysDiff = targetDate.diff(startDate, 'day');
|
|
154
170
|
if (daysDiff < 0) {
|
|
155
171
|
return false;
|
|
156
172
|
}
|
|
173
|
+
|
|
174
|
+
// 检查频率
|
|
157
175
|
if (daysDiff % repeatRule.frequency !== 0) {
|
|
158
176
|
return false;
|
|
159
177
|
}
|
|
178
|
+
|
|
179
|
+
// 检查时间是否在日程的时间范围内
|
|
160
180
|
const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
161
181
|
const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
162
182
|
const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
163
|
-
|
|
183
|
+
|
|
184
|
+
// 每日重复:每天都在相同的时间段内有效
|
|
185
|
+
// 例如:01:00:00 - 16:00:00,每天都是这个时间段
|
|
186
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
164
187
|
};
|
|
165
|
-
|
|
166
|
-
|
|
188
|
+
|
|
189
|
+
// 每周重复逻辑
|
|
190
|
+
const isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
191
|
+
const targetDayOfWeek = targetDate.day(); // 0=周日, 1=周一, ..., 6=周六
|
|
192
|
+
|
|
193
|
+
// 检查是否在指定的星期几内
|
|
167
194
|
if (!repeatRule.frequency_date.includes(targetDayOfWeek)) {
|
|
168
195
|
return false;
|
|
169
196
|
}
|
|
170
|
-
|
|
197
|
+
|
|
198
|
+
// 计算周差
|
|
199
|
+
const weeksDiff = targetDate.diff(startDate, 'week');
|
|
171
200
|
if (weeksDiff < 0) {
|
|
172
201
|
return false;
|
|
173
202
|
}
|
|
203
|
+
|
|
204
|
+
// 检查频率
|
|
174
205
|
if (weeksDiff % repeatRule.frequency !== 0) {
|
|
175
206
|
return false;
|
|
176
207
|
}
|
|
208
|
+
|
|
209
|
+
// 检查时间是否在日程的时间范围内
|
|
177
210
|
const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
178
211
|
const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
179
212
|
const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
180
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
213
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
181
214
|
};
|
|
182
|
-
|
|
215
|
+
|
|
216
|
+
// 日程时间段类型
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* 获取当前日期日程时间点
|
|
220
|
+
* @param date 日期 YYYY-MM-DD
|
|
221
|
+
* @param scheduleList 日程列表
|
|
222
|
+
* @returns 当前日期日程时间点 结构,数组 [{
|
|
223
|
+
*
|
|
224
|
+
* // HH:mm
|
|
225
|
+
* end_time: string,
|
|
226
|
+
* // HH:mm
|
|
227
|
+
* start_time: string,
|
|
228
|
+
* // 日期时间
|
|
229
|
+
* // YYYY-MM-DD HH:mm:ss
|
|
230
|
+
* end_at: Dayjs,
|
|
231
|
+
* // YYYY-MM-DD HH:mm:ss
|
|
232
|
+
* start_at: Dayjs,
|
|
233
|
+
*
|
|
234
|
+
* }]
|
|
235
|
+
*/
|
|
236
|
+
const getScheduleStartEndTimePoints = (date, scheduleList) => {
|
|
183
237
|
if (!date || !scheduleList || scheduleList.length === 0) {
|
|
184
238
|
return [];
|
|
185
239
|
}
|
|
186
|
-
const targetDate = (0,
|
|
240
|
+
const targetDate = (0, _dayjs.default)(date);
|
|
187
241
|
if (!targetDate.isValid()) {
|
|
188
242
|
return [];
|
|
189
243
|
}
|
|
190
244
|
const timeSlots = [];
|
|
245
|
+
|
|
246
|
+
// 遍历所有日程
|
|
191
247
|
for (const schedule of scheduleList) {
|
|
192
248
|
const slots = extractTimeSlotsFromSchedule(date, schedule);
|
|
193
249
|
timeSlots.push(...slots);
|
|
194
250
|
}
|
|
251
|
+
|
|
252
|
+
// 去重并排序时间段
|
|
195
253
|
return mergeAndSortTimeSlots(timeSlots);
|
|
196
254
|
};
|
|
197
|
-
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* 从单个日程中提取指定日期的时间段
|
|
258
|
+
*/
|
|
259
|
+
exports.getScheduleStartEndTimePoints = getScheduleStartEndTimePoints;
|
|
260
|
+
const extractTimeSlotsFromSchedule = (date, schedule) => {
|
|
198
261
|
switch (schedule.type) {
|
|
199
|
-
case
|
|
262
|
+
case 'standard':
|
|
200
263
|
return extractStandardScheduleTimeSlots(date, schedule);
|
|
201
|
-
case
|
|
264
|
+
case 'time-slots':
|
|
202
265
|
return extractTimeSlotsScheduleTimeSlots(date, schedule);
|
|
203
|
-
case
|
|
266
|
+
case 'designation':
|
|
204
267
|
return extractDesignationScheduleTimeSlots(date, schedule);
|
|
205
268
|
default:
|
|
206
269
|
return [];
|
|
207
270
|
}
|
|
208
271
|
};
|
|
209
|
-
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* 提取标准类型日程的时间段
|
|
275
|
+
*/
|
|
276
|
+
const extractStandardScheduleTimeSlots = (date, schedule) => {
|
|
210
277
|
if (!schedule.start_time || !schedule.end_time) {
|
|
211
278
|
return [];
|
|
212
279
|
}
|
|
213
|
-
const targetDate = (0,
|
|
214
|
-
const startDate = (0,
|
|
215
|
-
const endDate = (0,
|
|
280
|
+
const targetDate = (0, _dayjs.default)(date);
|
|
281
|
+
const startDate = (0, _dayjs.default)(schedule.start_time);
|
|
282
|
+
const endDate = (0, _dayjs.default)(schedule.end_time);
|
|
283
|
+
|
|
284
|
+
// 检查日期是否在日程范围内
|
|
216
285
|
if (!isDateInStandardSchedule(targetDate, schedule, startDate, endDate)) {
|
|
217
286
|
return [];
|
|
218
287
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
const
|
|
288
|
+
|
|
289
|
+
// 提取时间部分
|
|
290
|
+
const startTime = startDate.format('HH:mm');
|
|
291
|
+
const endTime = endDate.format('HH:mm');
|
|
292
|
+
|
|
293
|
+
// 构造完整的日期时间
|
|
294
|
+
const startAt = (0, _dayjs.default)(`${date} ${startTime}:00`);
|
|
295
|
+
const endAt = (0, _dayjs.default)(`${date} ${endTime}:00`);
|
|
223
296
|
return [{
|
|
224
297
|
start_time: startTime,
|
|
225
298
|
end_time: endTime,
|
|
@@ -227,22 +300,30 @@ var extractStandardScheduleTimeSlots = (date, schedule) => {
|
|
|
227
300
|
end_at: endAt
|
|
228
301
|
}];
|
|
229
302
|
};
|
|
230
|
-
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 提取时间段类型日程的时间段
|
|
306
|
+
*/
|
|
307
|
+
const extractTimeSlotsScheduleTimeSlots = (date, schedule) => {
|
|
231
308
|
if (!schedule.start_time || !schedule.time_slot || schedule.time_slot.length === 0) {
|
|
232
309
|
return [];
|
|
233
310
|
}
|
|
234
|
-
const targetDate = (0,
|
|
235
|
-
const scheduleStartDate = (0,
|
|
311
|
+
const targetDate = (0, _dayjs.default)(date);
|
|
312
|
+
const scheduleStartDate = (0, _dayjs.default)(schedule.start_time.split(' ')[0]);
|
|
313
|
+
|
|
314
|
+
// 检查日期是否在日程的有效范围内(考虑重复规则)
|
|
236
315
|
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
237
316
|
return [];
|
|
238
317
|
}
|
|
239
318
|
const slots = [];
|
|
319
|
+
|
|
320
|
+
// 提取所有时间段
|
|
240
321
|
for (const timeSlot of schedule.time_slot) {
|
|
241
322
|
if (!timeSlot.start_time || !timeSlot.end_time) {
|
|
242
323
|
continue;
|
|
243
324
|
}
|
|
244
|
-
const startAt = (0,
|
|
245
|
-
const endAt = (0,
|
|
325
|
+
const startAt = (0, _dayjs.default)(`${date} ${timeSlot.start_time}:00`);
|
|
326
|
+
const endAt = (0, _dayjs.default)(`${date} ${timeSlot.end_time}:00`);
|
|
246
327
|
slots.push({
|
|
247
328
|
start_time: timeSlot.start_time,
|
|
248
329
|
end_time: timeSlot.end_time,
|
|
@@ -252,63 +333,90 @@ var extractTimeSlotsScheduleTimeSlots = (date, schedule) => {
|
|
|
252
333
|
}
|
|
253
334
|
return slots;
|
|
254
335
|
};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* 检查日期是否在时间段类型日程范围内
|
|
339
|
+
*/
|
|
340
|
+
const isDateInTimeSlotsSchedule = (targetDate, schedule, scheduleStartDate) => {
|
|
341
|
+
// 不重复的日程
|
|
342
|
+
if (schedule.repeat_type === 'none') {
|
|
343
|
+
// 只在 start_time 的日期有效
|
|
344
|
+
return targetDate.isSame(scheduleStartDate, 'day');
|
|
258
345
|
}
|
|
346
|
+
|
|
347
|
+
// 重复的日程,需要检查重复规则
|
|
259
348
|
if (!schedule.repeat_rule) {
|
|
260
349
|
return false;
|
|
261
350
|
}
|
|
262
|
-
const {
|
|
351
|
+
const {
|
|
352
|
+
repeat_rule,
|
|
353
|
+
repeat_type
|
|
354
|
+
} = schedule;
|
|
355
|
+
|
|
356
|
+
// 检查是否在包含日期中(优先级最高)
|
|
263
357
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
264
358
|
for (const includedDate of repeat_rule.included_date) {
|
|
265
|
-
const includeStartDate = (0,
|
|
266
|
-
const includeEndDate = (0,
|
|
267
|
-
if (targetDate.isSameOrAfter(includeStartDate,
|
|
359
|
+
const includeStartDate = (0, _dayjs.default)(includedDate.start);
|
|
360
|
+
const includeEndDate = (0, _dayjs.default)(includedDate.end);
|
|
361
|
+
if (targetDate.isSameOrAfter(includeStartDate, 'day') && targetDate.isSameOrBefore(includeEndDate, 'day')) {
|
|
268
362
|
return true;
|
|
269
363
|
}
|
|
270
364
|
}
|
|
271
365
|
}
|
|
366
|
+
|
|
367
|
+
// 检查是否在排除日期中
|
|
272
368
|
if (repeat_rule.excluded_date && repeat_rule.excluded_date.length > 0) {
|
|
273
369
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
274
|
-
const excludeStartDate = (0,
|
|
275
|
-
const excludeEndDate = (0,
|
|
276
|
-
if (targetDate.isSameOrAfter(excludeStartDate,
|
|
370
|
+
const excludeStartDate = (0, _dayjs.default)(excludedDate.start);
|
|
371
|
+
const excludeEndDate = (0, _dayjs.default)(excludedDate.end);
|
|
372
|
+
if (targetDate.isSameOrAfter(excludeStartDate, 'day') && targetDate.isSameOrBefore(excludeEndDate, 'day')) {
|
|
277
373
|
return false;
|
|
278
374
|
}
|
|
279
375
|
}
|
|
280
376
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
377
|
+
|
|
378
|
+
// 检查重复规则的结束条件
|
|
379
|
+
if (repeat_rule.end.type === 'date' && repeat_rule.end.end_date) {
|
|
380
|
+
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
381
|
+
if (targetDate.isAfter(ruleEndDate, 'day')) {
|
|
284
382
|
return false;
|
|
285
383
|
}
|
|
286
384
|
}
|
|
287
|
-
|
|
385
|
+
|
|
386
|
+
// 检查是否在开始日期之前
|
|
387
|
+
if (targetDate.isBefore(scheduleStartDate, 'day')) {
|
|
288
388
|
return false;
|
|
289
389
|
}
|
|
390
|
+
|
|
391
|
+
// 根据重复类型检查
|
|
290
392
|
switch (repeat_type) {
|
|
291
|
-
case
|
|
393
|
+
case 'daily':
|
|
292
394
|
return isDateInDailyRepeat(targetDate, scheduleStartDate, repeat_rule);
|
|
293
|
-
case
|
|
395
|
+
case 'weekly':
|
|
294
396
|
return isDateInWeeklyRepeat(targetDate, scheduleStartDate, repeat_rule);
|
|
295
397
|
default:
|
|
296
398
|
return false;
|
|
297
399
|
}
|
|
298
400
|
};
|
|
299
|
-
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* 提取指定日期类型日程的时间段
|
|
404
|
+
*/
|
|
405
|
+
const extractDesignationScheduleTimeSlots = (date, schedule) => {
|
|
300
406
|
if (!schedule.designation) {
|
|
301
407
|
return [];
|
|
302
408
|
}
|
|
303
|
-
const targetDate = (0,
|
|
409
|
+
const targetDate = (0, _dayjs.default)(date);
|
|
304
410
|
const designations = Array.isArray(schedule.designation) ? schedule.designation : [schedule.designation];
|
|
305
411
|
const slots = [];
|
|
306
412
|
for (const designation of designations) {
|
|
307
|
-
const startDate = (0,
|
|
308
|
-
const endDate = (0,
|
|
413
|
+
const startDate = (0, _dayjs.default)(designation.start_date);
|
|
414
|
+
const endDate = (0, _dayjs.default)(designation.end_date);
|
|
415
|
+
|
|
416
|
+
// 检查日期是否在指定范围内(考虑重复规则)
|
|
309
417
|
if (isDateInDesignationSchedule(targetDate, schedule, designation, startDate, endDate)) {
|
|
310
|
-
const startAt = (0,
|
|
311
|
-
const endAt = (0,
|
|
418
|
+
const startAt = (0, _dayjs.default)(`${date} ${designation.start_time}:00`);
|
|
419
|
+
const endAt = (0, _dayjs.default)(`${date} ${designation.end_time}:00`);
|
|
312
420
|
slots.push({
|
|
313
421
|
start_time: designation.start_time,
|
|
314
422
|
end_time: designation.end_time,
|
|
@@ -319,125 +427,196 @@ var extractDesignationScheduleTimeSlots = (date, schedule) => {
|
|
|
319
427
|
}
|
|
320
428
|
return slots;
|
|
321
429
|
};
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* 检查日期是否在指定日期类型日程范围内
|
|
433
|
+
*/
|
|
434
|
+
const isDateInDesignationSchedule = (targetDate, schedule, designation, startDate, endDate) => {
|
|
435
|
+
// 不重复的日程
|
|
436
|
+
if (schedule.repeat_type === 'none') {
|
|
437
|
+
// 检查日期是否在指定的日期范围内
|
|
438
|
+
return targetDate.isSameOrAfter(startDate, 'day') && targetDate.isSameOrBefore(endDate, 'day');
|
|
325
439
|
}
|
|
440
|
+
|
|
441
|
+
// 重复的日程,需要检查重复规则
|
|
326
442
|
if (!schedule.repeat_rule) {
|
|
327
443
|
return false;
|
|
328
444
|
}
|
|
329
|
-
const {
|
|
445
|
+
const {
|
|
446
|
+
repeat_rule,
|
|
447
|
+
repeat_type
|
|
448
|
+
} = schedule;
|
|
449
|
+
|
|
450
|
+
// 检查是否在包含日期中(优先级最高)
|
|
330
451
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
331
452
|
for (const includedDate of repeat_rule.included_date) {
|
|
332
|
-
const includeStartDate = (0,
|
|
333
|
-
const includeEndDate = (0,
|
|
334
|
-
if (targetDate.isSameOrAfter(includeStartDate,
|
|
453
|
+
const includeStartDate = (0, _dayjs.default)(includedDate.start);
|
|
454
|
+
const includeEndDate = (0, _dayjs.default)(includedDate.end);
|
|
455
|
+
if (targetDate.isSameOrAfter(includeStartDate, 'day') && targetDate.isSameOrBefore(includeEndDate, 'day')) {
|
|
335
456
|
return true;
|
|
336
457
|
}
|
|
337
458
|
}
|
|
338
459
|
}
|
|
460
|
+
|
|
461
|
+
// 检查是否在排除日期中
|
|
339
462
|
if (repeat_rule.excluded_date && repeat_rule.excluded_date.length > 0) {
|
|
340
463
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
341
|
-
const excludeStartDate = (0,
|
|
342
|
-
const excludeEndDate = (0,
|
|
343
|
-
if (targetDate.isSameOrAfter(excludeStartDate,
|
|
464
|
+
const excludeStartDate = (0, _dayjs.default)(excludedDate.start);
|
|
465
|
+
const excludeEndDate = (0, _dayjs.default)(excludedDate.end);
|
|
466
|
+
if (targetDate.isSameOrAfter(excludeStartDate, 'day') && targetDate.isSameOrBefore(excludeEndDate, 'day')) {
|
|
344
467
|
return false;
|
|
345
468
|
}
|
|
346
469
|
}
|
|
347
470
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
471
|
+
|
|
472
|
+
// 检查重复规则的结束条件
|
|
473
|
+
if (repeat_rule.end.type === 'date' && repeat_rule.end.end_date) {
|
|
474
|
+
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
475
|
+
if (targetDate.isAfter(ruleEndDate, 'day')) {
|
|
351
476
|
return false;
|
|
352
477
|
}
|
|
353
478
|
}
|
|
354
|
-
|
|
355
|
-
|
|
479
|
+
|
|
480
|
+
// 检查是否在基本日期范围内
|
|
481
|
+
if (!targetDate.isSameOrAfter(startDate, 'day') || !targetDate.isSameOrBefore(endDate, 'day')) {
|
|
482
|
+
// 对于重复日程,如果不在基本范围内,还需要检查是否符合重复规则
|
|
483
|
+
// 只要在 startDate 之后,并且符合重复规则即可
|
|
484
|
+
if (targetDate.isBefore(startDate, 'day')) {
|
|
356
485
|
return false;
|
|
357
486
|
}
|
|
358
487
|
}
|
|
488
|
+
|
|
489
|
+
// 根据重复类型检查
|
|
359
490
|
switch (repeat_type) {
|
|
360
|
-
case
|
|
491
|
+
case 'daily':
|
|
361
492
|
return isDateInDailyRepeat(targetDate, startDate, repeat_rule);
|
|
362
|
-
case
|
|
493
|
+
case 'weekly':
|
|
363
494
|
return isDateInWeeklyRepeat(targetDate, startDate, repeat_rule);
|
|
364
495
|
default:
|
|
365
496
|
return false;
|
|
366
497
|
}
|
|
367
498
|
};
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* 检查日期是否在标准日程范围内
|
|
502
|
+
*/
|
|
503
|
+
const isDateInStandardSchedule = (targetDate, schedule, startDate, endDate) => {
|
|
504
|
+
const targetDateString = targetDate.format('YYYY-MM-DD');
|
|
505
|
+
|
|
506
|
+
// 不重复的日程
|
|
507
|
+
if (schedule.repeat_type === 'none') {
|
|
508
|
+
// 检查日期是否在范围内
|
|
509
|
+
const scheduleStartDate = startDate.format('YYYY-MM-DD');
|
|
510
|
+
const scheduleEndDate = endDate.format('YYYY-MM-DD');
|
|
511
|
+
return targetDate.isSameOrAfter(scheduleStartDate, 'day') && targetDate.isSameOrBefore(scheduleEndDate, 'day');
|
|
374
512
|
}
|
|
513
|
+
|
|
514
|
+
// 重复的日程,需要检查重复规则
|
|
375
515
|
if (!schedule.repeat_rule) {
|
|
376
516
|
return false;
|
|
377
517
|
}
|
|
378
|
-
const {
|
|
518
|
+
const {
|
|
519
|
+
repeat_rule,
|
|
520
|
+
repeat_type
|
|
521
|
+
} = schedule;
|
|
522
|
+
|
|
523
|
+
// 检查是否在包含日期中
|
|
379
524
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
380
525
|
for (const includedDate of repeat_rule.included_date) {
|
|
381
|
-
const includeStartDate = (0,
|
|
382
|
-
const includeEndDate = (0,
|
|
383
|
-
if (targetDate.isSameOrAfter(includeStartDate,
|
|
526
|
+
const includeStartDate = (0, _dayjs.default)(includedDate.start);
|
|
527
|
+
const includeEndDate = (0, _dayjs.default)(includedDate.end);
|
|
528
|
+
if (targetDate.isSameOrAfter(includeStartDate, 'day') && targetDate.isSameOrBefore(includeEndDate, 'day')) {
|
|
384
529
|
return true;
|
|
385
530
|
}
|
|
386
531
|
}
|
|
387
532
|
}
|
|
533
|
+
|
|
534
|
+
// 检查是否在排除日期中
|
|
388
535
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
389
|
-
const excludeStartDate = (0,
|
|
390
|
-
const excludeEndDate = (0,
|
|
391
|
-
if (targetDate.isSameOrAfter(excludeStartDate,
|
|
536
|
+
const excludeStartDate = (0, _dayjs.default)(excludedDate.start);
|
|
537
|
+
const excludeEndDate = (0, _dayjs.default)(excludedDate.end);
|
|
538
|
+
if (targetDate.isSameOrAfter(excludeStartDate, 'day') && targetDate.isSameOrBefore(excludeEndDate, 'day')) {
|
|
392
539
|
return false;
|
|
393
540
|
}
|
|
394
541
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
542
|
+
|
|
543
|
+
// 检查重复规则的结束条件
|
|
544
|
+
if (repeat_rule.end.type === 'date' && repeat_rule.end.end_date) {
|
|
545
|
+
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
546
|
+
if (targetDate.isAfter(ruleEndDate, 'day')) {
|
|
398
547
|
return false;
|
|
399
548
|
}
|
|
400
549
|
}
|
|
401
|
-
|
|
550
|
+
|
|
551
|
+
// 检查是否在开始日期之前
|
|
552
|
+
if (targetDate.isBefore(startDate, 'day')) {
|
|
402
553
|
return false;
|
|
403
554
|
}
|
|
555
|
+
|
|
556
|
+
// 根据重复类型检查
|
|
404
557
|
switch (repeat_type) {
|
|
405
|
-
case
|
|
558
|
+
case 'daily':
|
|
406
559
|
return isDateInDailyRepeat(targetDate, startDate, repeat_rule);
|
|
407
|
-
case
|
|
560
|
+
case 'weekly':
|
|
408
561
|
return isDateInWeeklyRepeat(targetDate, startDate, repeat_rule);
|
|
409
562
|
default:
|
|
410
563
|
return false;
|
|
411
564
|
}
|
|
412
565
|
};
|
|
413
|
-
|
|
414
|
-
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* 检查日期是否符合每日重复规则
|
|
569
|
+
*/
|
|
570
|
+
const isDateInDailyRepeat = (targetDate, startDate, repeatRule) => {
|
|
571
|
+
const daysDiff = targetDate.diff(startDate, 'day');
|
|
415
572
|
if (daysDiff < 0) {
|
|
416
573
|
return false;
|
|
417
574
|
}
|
|
575
|
+
|
|
576
|
+
// 检查频率
|
|
418
577
|
return daysDiff % repeatRule.frequency === 0;
|
|
419
578
|
};
|
|
420
|
-
|
|
421
|
-
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* 检查日期是否符合每周重复规则
|
|
582
|
+
*/
|
|
583
|
+
const isDateInWeeklyRepeat = (targetDate, startDate, repeatRule) => {
|
|
584
|
+
const targetDayOfWeek = targetDate.day(); // 0=周日, 1=周一, ..., 6=周六
|
|
585
|
+
|
|
586
|
+
// 检查是否在指定的星期几内
|
|
422
587
|
if (!repeatRule.frequency_date.includes(targetDayOfWeek)) {
|
|
423
588
|
return false;
|
|
424
589
|
}
|
|
425
|
-
|
|
590
|
+
|
|
591
|
+
// 计算周差
|
|
592
|
+
const weeksDiff = targetDate.diff(startDate, 'week');
|
|
426
593
|
if (weeksDiff < 0) {
|
|
427
594
|
return false;
|
|
428
595
|
}
|
|
596
|
+
|
|
597
|
+
// 检查频率
|
|
429
598
|
return weeksDiff % repeatRule.frequency === 0;
|
|
430
599
|
};
|
|
431
|
-
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* 对时间段去重并排序
|
|
603
|
+
* 只移除开始时间和结束时间完全相同的重复时间段
|
|
604
|
+
*/
|
|
605
|
+
const mergeAndSortTimeSlots = slots => {
|
|
432
606
|
if (slots.length === 0) {
|
|
433
607
|
return [];
|
|
434
608
|
}
|
|
609
|
+
|
|
610
|
+
// 按开始时间排序
|
|
435
611
|
const sorted = [...slots].sort((a, b) => {
|
|
436
612
|
return a.start_at.valueOf() - b.start_at.valueOf();
|
|
437
613
|
});
|
|
614
|
+
|
|
615
|
+
// 去重:移除开始和结束时间完全相同的时间段
|
|
438
616
|
const unique = [];
|
|
439
|
-
const seenKeys =
|
|
617
|
+
const seenKeys = new Set();
|
|
440
618
|
for (const slot of sorted) {
|
|
619
|
+
// 使用开始时间和结束时间作为唯一键
|
|
441
620
|
const key = `${slot.start_time}-${slot.end_time}`;
|
|
442
621
|
if (!seenKeys.has(key)) {
|
|
443
622
|
seenKeys.add(key);
|
|
@@ -445,9 +624,4 @@ var mergeAndSortTimeSlots = (slots) => {
|
|
|
445
624
|
}
|
|
446
625
|
}
|
|
447
626
|
return unique;
|
|
448
|
-
};
|
|
449
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
450
|
-
0 && (module.exports = {
|
|
451
|
-
getDateIsInSchedule,
|
|
452
|
-
getScheduleStartEndTimePoints
|
|
453
|
-
});
|
|
627
|
+
};
|