|
|
@ -12,8 +12,8 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller; |
|
|
|
namespace app\api\controller; |
|
|
|
|
|
|
|
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
use app\api\model\store\Shop as ShopModel; |
|
|
|
use app\api\model\store\Shop as ShopModel; |
|
|
|
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 门店列表 |
|
|
|
* 门店列表 |
|
|
@ -46,4 +46,43 @@ class Shop extends Controller |
|
|
|
$detail = ShopModel::detail($shopId, ['logoImage']); |
|
|
|
$detail = ShopModel::detail($shopId, ['logoImage']); |
|
|
|
return $this->renderSuccess(compact('detail')); |
|
|
|
return $this->renderSuccess(compact('detail')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function stopTimes(): Json |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$data = []; |
|
|
|
|
|
|
|
$shopId = intval($this->request->post('shop_id')); |
|
|
|
|
|
|
|
if (!$shopId) { |
|
|
|
|
|
|
|
return $this->renderError('缺少必要参数'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$detail = ShopModel::detail($shopId); |
|
|
|
|
|
|
|
if (!empty($detail['shop_hours'])) { |
|
|
|
|
|
|
|
$shop_hours = explode('-', $detail['shop_hours']); |
|
|
|
|
|
|
|
if (count($shop_hours) == 2) { |
|
|
|
|
|
|
|
$array = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; |
|
|
|
|
|
|
|
for ($i = 0; $i < 3; $i++) { |
|
|
|
|
|
|
|
$start_time = date('Y-m-d', strtotime('+' . $i . ' day', time())) . ' ' . $shop_hours[0]; |
|
|
|
|
|
|
|
$end_time = date('Y-m-d', strtotime('+' . $i . ' day', time())) . ' ' . $shop_hours[1]; |
|
|
|
|
|
|
|
$timeOne = strtotime($start_time); |
|
|
|
|
|
|
|
$timeTwo = strtotime($end_time); |
|
|
|
|
|
|
|
$times = []; |
|
|
|
|
|
|
|
while ($timeOne < $timeTwo) { |
|
|
|
|
|
|
|
$status = 0; |
|
|
|
|
|
|
|
if ($timeOne > time()) { |
|
|
|
|
|
|
|
$status = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$times[] = [ |
|
|
|
|
|
|
|
'value' => date('H:i', $timeOne), |
|
|
|
|
|
|
|
'status' => $status, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$timeOne = $timeOne + 30 * 60; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$data[] = [ |
|
|
|
|
|
|
|
'name' => $array[date("w", strtotime($start_time))], |
|
|
|
|
|
|
|
'list' => $times, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderSuccess($data); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |