|
|
@ -12,11 +12,10 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
namespace app\store\controller; |
|
|
|
namespace app\store\controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\model\store\ShopParking as ParkingModel; |
|
|
|
use app\common\model\UploadFile; |
|
|
|
use app\common\model\UploadFile; |
|
|
|
use app\common\library\helper; |
|
|
|
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
use app\store\model\store\Shop as ShopModel; |
|
|
|
use app\store\model\store\Shop as ShopModel; |
|
|
|
use app\common\model\store\ShopParking as ParkingModel; |
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 门店管理 |
|
|
|
* 门店管理 |
|
|
@ -60,7 +59,7 @@ class Shop extends Controller |
|
|
|
{ |
|
|
|
{ |
|
|
|
// 获取门店详情 |
|
|
|
// 获取门店详情 |
|
|
|
$detail = ShopModel::detail($shopId); |
|
|
|
$detail = ShopModel::detail($shopId); |
|
|
|
$file = UploadFile::whereIn('file_id',explode(',',$detail['shop_image_id']))->field('*')->select(); |
|
|
|
$file = UploadFile::whereIn('file_id', explode(',', $detail['shop_image_id']))->field('*')->select(); |
|
|
|
$detail['shop_image_url'] = $file; |
|
|
|
$detail['shop_image_url'] = $file; |
|
|
|
// 获取logoImage (这里不能用with因为编辑页需要logoImage对象) |
|
|
|
// 获取logoImage (这里不能用with因为编辑页需要logoImage对象) |
|
|
|
!empty($detail) && $detail['logoImage']; |
|
|
|
!empty($detail) && $detail['logoImage']; |
|
|
@ -75,7 +74,11 @@ class Shop extends Controller |
|
|
|
{ |
|
|
|
{ |
|
|
|
// 新增记录 |
|
|
|
// 新增记录 |
|
|
|
$model = new ShopModel; |
|
|
|
$model = new ShopModel; |
|
|
|
if ($model->add($this->postForm())) { |
|
|
|
$data = $this->postForm(); |
|
|
|
|
|
|
|
if (!empty($data['shop_hours_start']) && !empty($data['shop_hours_end'])) { |
|
|
|
|
|
|
|
$data['shop_hours'] = $data['shop_hours_start'] . '-' . $data['shop_hours_end']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($model->add($data)) { |
|
|
|
return $this->renderSuccess('添加成功'); |
|
|
|
return $this->renderSuccess('添加成功'); |
|
|
|
} |
|
|
|
} |
|
|
|
return $this->renderError($model->getError() ?: '添加失败'); |
|
|
|
return $this->renderError($model->getError() ?: '添加失败'); |
|
|
@ -91,7 +94,11 @@ class Shop extends Controller |
|
|
|
// 门店详情 |
|
|
|
// 门店详情 |
|
|
|
$model = ShopModel::detail($shopId); |
|
|
|
$model = ShopModel::detail($shopId); |
|
|
|
// 新增记录 |
|
|
|
// 新增记录 |
|
|
|
if ($model->edit($this->postForm())) { |
|
|
|
$data = $this->postForm(); |
|
|
|
|
|
|
|
if (!empty($data['shop_hours_start']) && !empty($data['shop_hours_end'])) { |
|
|
|
|
|
|
|
$data['shop_hours'] = $data['shop_hours_start'] . '-' . $data['shop_hours_end']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($model->edit($data)) { |
|
|
|
return $this->renderSuccess('更新成功'); |
|
|
|
return $this->renderSuccess('更新成功'); |
|
|
|
} |
|
|
|
} |
|
|
|
return $this->renderError($model->getError() ?: '更新失败'); |
|
|
|
return $this->renderError($model->getError() ?: '更新失败'); |
|
|
@ -133,7 +140,8 @@ class Shop extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//添加,编辑门店停车场 |
|
|
|
//添加,编辑门店停车场 |
|
|
|
public function editParking(){ |
|
|
|
public function editParking() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$model = new ParkingModel(); |
|
|
|
$model = new ParkingModel(); |
|
|
|
if ($model->edit($this->request->param())) { |
|
|
|
if ($model->edit($this->request->param())) { |
|
|
@ -142,7 +150,8 @@ class Shop extends Controller |
|
|
|
return $this->renderError($model->getError() ?: '失败'); |
|
|
|
return $this->renderError($model->getError() ?: '失败'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function test(int $shopId) { |
|
|
|
public function test(int $shopId) |
|
|
|
|
|
|
|
{ |
|
|
|
// 门店详情 |
|
|
|
// 门店详情 |
|
|
|
$model = ShopModel::detail($shopId); |
|
|
|
$model = ShopModel::detail($shopId); |
|
|
|
dd($model['logoImage']->toArray()); |
|
|
|
dd($model['logoImage']->toArray()); |
|
|
|