From 5ea36cb545324e4853fd8f0059d743aac7b9b43a Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 16 Sep 2020 17:52:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=95=86=E5=AE=B6=E7=99=BB=E5=BD=95=20?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/StoreLoginService.php | 8 +++++++- app/Service/v3/Implementations/UserAddressService.php | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Service/v3/Implementations/StoreLoginService.php b/app/Service/v3/Implementations/StoreLoginService.php index abbed09..0aa7e4e 100644 --- a/app/Service/v3/Implementations/StoreLoginService.php +++ b/app/Service/v3/Implementations/StoreLoginService.php @@ -11,7 +11,13 @@ class StoreLoginService implements StoreLoginServiceInterface { public function do($account,$password) { - $storeUsersModel = StoreUsers::query()->where('username',$account)->first(); + $storeUsersModel = StoreUsers::query()->where([ + ['username','=',$account], + ['status','=',2] + ])->first(); + if(empty($storeUsersModel)){ + throw new ErrorCodeException(ErrorCode::STORE_NOT_AVAILABLE); + } $password = $this->stringHash($password,$storeUsersModel->salt); if($storeUsersModel->password === $password){ return $storeUsersModel; diff --git a/app/Service/v3/Implementations/UserAddressService.php b/app/Service/v3/Implementations/UserAddressService.php index ed5cadc..ebfc46f 100644 --- a/app/Service/v3/Implementations/UserAddressService.php +++ b/app/Service/v3/Implementations/UserAddressService.php @@ -87,6 +87,7 @@ class UserAddressService implements UserAddressServiceInterface $market = Market::query()->select('lng','lat')->find($marketId); $distance = $this->locationService->getDistanceByTencent($address['address']->lng,$address['address']->lat,$market->lng,$market->lat); $distributionPrice = $this->distributionPriceService->do($distance); + var_dump($distance); $res['address'] = $address; $res['delivery_distance'] = $distance; $res['distribution_price'] = $distributionPrice; From a096885e0c5454a00dda2084878746328382f882 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 16 Sep 2020 19:21:13 +0800 Subject: [PATCH 2/3] =?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 --- .../v3/Implementations/AppointmentTimeService.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php index 09cc205..a3b546c 100644 --- a/app/Service/v3/Implementations/AppointmentTimeService.php +++ b/app/Service/v3/Implementations/AppointmentTimeService.php @@ -77,14 +77,13 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface $res = []; $time1Max = max($time1Arr); $time2Min = min($time2Arr); - if($time2Min > $nowTime+60*30) { + if($time2Min > $nowTime) { $res = array_merge($res,$this->calculateTime($time1Max, $time2Min)); } if(!empty($time3Arr) && !empty($time4Arr)){ - var_dump($time3Arr,$time4Arr); $time3Max = max($time3Arr); $time4Min = min($time4Arr); - if($time4Min > $nowTime+60*30) { + if($time4Min > $nowTime) { $res = array_merge($res,$this->calculateTime($time3Max, $time4Min)); } } @@ -102,7 +101,11 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface $peakPeriod = strtotime('16:00'); $peakPeriodEnd = strtotime('18:00'); //取得订单下所有店铺时间段 交集 并计算时间段横跨单位区间长度 - $length = ceil(($endTime - $startTime) / (30*60)); + if($endTime == $startTime){ + $length = 1; + }else{ + $length = ceil(($endTime - $startTime) / (30*60)); + } for ($i=1;$i<=$length;$i++){ $addTime = $startTime + (30*60*$i); if($addTime >= $peakPeriod && $addTime < $peakPeriodEnd){ From be1f64175f2cf8e78f0e0980a92600dad3db6cc3 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 16 Sep 2020 19:25:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/LocationService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Service/v3/Implementations/LocationService.php b/app/Service/v3/Implementations/LocationService.php index bfcaaae..2e7eb18 100644 --- a/app/Service/v3/Implementations/LocationService.php +++ b/app/Service/v3/Implementations/LocationService.php @@ -160,8 +160,8 @@ class LocationService implements LocationServiceInterface $resultArr = json_decode($response,true); if($resultArr['status'] > 0) { - //return 1000; - throw new ErrorCodeException(ErrorCode::LOCATION_ERROR,$resultArr['message']); + return 1000; + //throw new ErrorCodeException(ErrorCode::LOCATION_ERROR,$resultArr['message']); } $distance = $resultArr['result']['routes'][0]['distance']; return $distance;