From fdc43d7f3367e618502e55207919568d623fc511 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 14 Sep 2020 14:58:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=80=81=E8=BE=BE=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppointmentTimeService.php | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php index 43a9bf8..18b8ad8 100644 --- a/app/Service/v3/Implementations/AppointmentTimeService.php +++ b/app/Service/v3/Implementations/AppointmentTimeService.php @@ -41,9 +41,11 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface $time4Arr = []; $nowTime = time(); foreach($stores as $store){ + //店铺手动 点击歇业 if($store['is_rest'] == 1){ return $store['name'].'店铺已打烊'; } + //当前时间小于 开始营业时间 $time1 = strtotime(($store['time1'])); if($nowTime < $time1){ return $store['name'].'店铺已打烊'; @@ -64,28 +66,39 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface array_push($time1Arr,$time1); array_push($time2Arr,$time2); } + $res = []; $time1Max = max($time1Arr); - if($nowTime > $time1Max){ - $time1Max = ceil($nowTime / 1800) * 1800; - } $time2Min = min($time2Arr); - $length = ceil(($time2Min - $time1Max) / 1800); - for ($i=1;$i<=$length;$i++){ - $addTime = $time1Max + (30*60*$i); - $res[] = date('h:i',$addTime); - } + array_push($res,$this->calculateTime($time1Max,$time2Min)); if(!empty($time3Arr) && !empty($time4Arr)){ - $time3Max = max($time3Arr); - if($nowTime > $time3Max){ - $time3Max = ceil($nowTime / 1800) * 1800; - } - $time4Min = min($time4Arr); - $length = ceil(($time4Min - $time3Max) / 1800); - for ($i=1;$i<=$length;$i++){ - $addTime = $time3Max + (30*60*$i); - $res[] = date('H:i',$addTime); - } + $time3Max = max($time3Arr); + $time4Min = min($time4Arr); + array_push($res,$this->calculateTime($time3Max,$time4Min)); } return $res; } + + function calculateTime($startTime,$endTime) + { + $nowTime = time(); + //如果开始时间小于当前时间则取当前时间 + if($nowTime > $startTime){ + $startTime = ceil($nowTime / (30*60)) * (30*60); + } + //高峰段 区间 + $peakPeriod = strtotime('16:00'); + $peakPeriodEnd = strtotime('18:00'); + $span = ($peakPeriodEnd - $peakPeriod)/(30*60); + //取得订单下所有店铺时间段 交集 并计算时间段横跨单位区间长度 + $length = ceil(($endTime - $startTime) / (30*60)); + for ($i=1;$i<=$length;$i++){ + $addTime = $startTime + (30*60*$i); + if($addTime >= $peakPeriod && $addTime < $peakPeriodEnd){ + $i+=$span; + $addTime = $startTime + (30*60*$i); + } + $res[] = date('H:i',$addTime) . ' - ' . date('H:i',$addTime + (30*60)); + } + return $res; + } } \ No newline at end of file From 1879a8cda068388c9d9c8d2c0a0110998b85dc4e Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 14 Sep 2020 15:11:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=80=BC=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/v3/OrderOnlineController.php | 2 +- app/Service/v3/Implementations/StoreService.php | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/Controller/v3/OrderOnlineController.php b/app/Controller/v3/OrderOnlineController.php index 0f2e1fe..80f38db 100644 --- a/app/Controller/v3/OrderOnlineController.php +++ b/app/Controller/v3/OrderOnlineController.php @@ -103,7 +103,7 @@ class OrderOnlineController extends BaseController $res['coupon'] = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId); //增值服务接口 $res['value_added_service'] = [ - 'text' => '买鸡买鸭,免费帮杀;买瓜买黇,包熟包甜', + 'text' => '勾选本条款视为您同意接受懒族生活为您提供增值服务的费用,包括但不仅限于洗菜,切菜,装菜所产生的打包费用,送货上门等增值服务', 'select' => 1, 'price' => 3.50, 'original_price' => 0.00 diff --git a/app/Service/v3/Implementations/StoreService.php b/app/Service/v3/Implementations/StoreService.php index 3cf5a14..ba84527 100644 --- a/app/Service/v3/Implementations/StoreService.php +++ b/app/Service/v3/Implementations/StoreService.php @@ -25,14 +25,15 @@ class StoreService implements StoreServiceInterface ->first(); if(!empty($store)){ $nowTime = time(); - $time1 = strtotime(($store->time1)); - $time2 = strtotime(($store->time2)); - if($time1 < $nowTime && $nowTime < $time2){ - return true; + $startTime = strtotime(($store->time1)); + if(!empty($store->time3) && !empty($store->time4)){ + $time4 = strtotime(($store->time4)); + $endTime = $time4; + }else{ + $time2 = strtotime(($store->time2)); + $endTime = $time2; } - $time3 = strtotime(($store->time3)); - $time4 = strtotime(($store->time4)); - if($time3 < $nowTime && $nowTime < $time4){ + if($nowTime > $startTime && $nowTime < $endTime){ return true; } } From cbdf18b1a9e336f75ddb826d5ef2abb548c5cd23 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 14 Sep 2020 17:24:00 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8F=90=E7=8E=B0=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/v3/WithdrawalType.php | 33 +++++++++++++++++++++++++++++ app/Model/v3/StoreWithdrawal.php | 9 +++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 app/Constants/v3/WithdrawalType.php diff --git a/app/Constants/v3/WithdrawalType.php b/app/Constants/v3/WithdrawalType.php new file mode 100644 index 0000000..7358f7a --- /dev/null +++ b/app/Constants/v3/WithdrawalType.php @@ -0,0 +1,33 @@ +attributes['created_at']); } + + public function getPayTypeTextAttribute() + { + return '提现到'.WithdrawalType::getMessage($this->attributes['type']); + } } \ No newline at end of file From 910dcae30e4b4b45c25b68e49596aa75b77b6a75 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 14 Sep 2020 17:40:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=80=81=E8=BE=BE=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/AppointmentTimeService.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php index 18b8ad8..89c35cf 100644 --- a/app/Service/v3/Implementations/AppointmentTimeService.php +++ b/app/Service/v3/Implementations/AppointmentTimeService.php @@ -69,11 +69,15 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface $res = []; $time1Max = max($time1Arr); $time2Min = min($time2Arr); - array_push($res,$this->calculateTime($time1Max,$time2Min)); + if($time2Min > $nowTime) { + array_push($res, $this->calculateTime($time1Max, $time2Min)); + } if(!empty($time3Arr) && !empty($time4Arr)){ $time3Max = max($time3Arr); $time4Min = min($time4Arr); - array_push($res,$this->calculateTime($time3Max,$time4Min)); + if($time4Min > $nowTime) { + array_push($res, $this->calculateTime($time3Max, $time4Min)); + } } return $res; }