pull/1/head
wanghousheng 12 months ago
parent 2d798decc8
commit 786998525c
  1. 8
      app/api/controller/Recovery.php
  2. 41
      app/api/controller/Shop.php
  3. 8
      app/common/model/RecoveryOrder.php

@ -152,6 +152,14 @@ class Recovery extends Controller
}
$info['images_list'] = $arr;
unset($info['images']);
//回收信息
$info['recovery_image'] = '';
$recoveryInfo = ServerRecovery::detail(['recovery_id' => $info['recovery_id']], ['image']);
if (!empty($recoveryInfo['recovery_image'])) {
$info['recovery_image'] = $recoveryInfo['recovery_image'];
}
//门店信息
$info['shop_info'] = \app\api\model\store\Shop::detail($info['shop_id'], ['logoImage']);
}
return $this->renderSuccess(['detail' => $info]);
}

@ -12,8 +12,8 @@ declare (strict_types=1);
namespace app\api\controller;
use think\response\Json;
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']);
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);
}
}

@ -4,10 +4,12 @@ declare (strict_types=1);
namespace app\common\model;
use app\api\model\Server\ServerRecovery;
use app\api\model\store\Shop;
use app\common\enum\RecoveryStatusEnum;
use app\common\enum\RecoveryTypeEnum;
use cores\BaseModel;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
class RecoveryOrder extends BaseModel
{
@ -69,4 +71,10 @@ class RecoveryOrder extends BaseModel
return static::get($where, $with);
}
public function shop(): HasOne
{
return $this->hasOne(Shop::class, 'shop_id', 'shop_id');
}
}
Loading…
Cancel
Save