You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
57 lines
1.6 KiB
<?php
|
|
|
|
namespace App\Service\v3\Implementations;
|
|
|
|
use App\Model\v3\ShoppingCart;
|
|
use App\Model\v3\Store;
|
|
use App\Service\v3\Interfaces\AppointmentTimeServiceInterface;
|
|
use phpDocumentor\Reflection\Types\Object_;
|
|
|
|
class AppointmentTimeService implements AppointmentTimeServiceInterface
|
|
{
|
|
public function do()
|
|
{
|
|
return [
|
|
'尽快送达',
|
|
'08:30 - 09:00',
|
|
'09:00 - 09:30',
|
|
'09:30 - 10:00',
|
|
'10:00 - 10:30'
|
|
];
|
|
}
|
|
|
|
public function check()
|
|
{
|
|
// TODO: Implement check() method.
|
|
}
|
|
|
|
public function undo()
|
|
{
|
|
// TODO: Implement undo() method.
|
|
}
|
|
|
|
public function get($shopcartIds)
|
|
{
|
|
$shopcartIds = explode(',',$shopcartIds);
|
|
$sotreIds = ShoppingCart::query()->whereIn('id',$shopcartIds)->pluck('store_id');
|
|
$stores = Store::query()->whereIn('id',$sotreIds)->get()->toArray();
|
|
// return $stores;
|
|
$time1 = array_values(array_column($stores,'time1'));
|
|
$time2 = array_values(array_column($stores,'time2'));
|
|
$time3 = array_values(array_column($stores,'time3'));
|
|
$time4 = array_values(array_column($stores,'time4'));
|
|
$startTimeArr = array_merge($time1,$time3);
|
|
$endTimeArr = array_merge($time2,$time4);
|
|
array_filter($startTimeArr);
|
|
array_filter($endTimeArr);
|
|
$startTime = max($startTimeArr);
|
|
$endTime = min($endTimeArr);
|
|
// foreach ($stores as $store){
|
|
//
|
|
// }
|
|
return [
|
|
'start_time' => $startTimeArr,
|
|
'end_time' => $endTimeArr
|
|
];
|
|
}
|
|
}
|