diff --git a/app/store/controller/Shop.php b/app/store/controller/Shop.php index 8f8bb271..05a07ae1 100644 --- a/app/store/controller/Shop.php +++ b/app/store/controller/Shop.php @@ -59,6 +59,11 @@ class Shop extends Controller { // 获取门店详情 $detail = ShopModel::detail($shopId); + if (!empty($detail['shop_hours'])) { + $shop_hours = explode('-', $detail['shop_hours']); + $detail['shop_hours_start'] = $shop_hours[0]; + $detail['shop_hours_end'] = $shop_hours[1]; + } $file = UploadFile::whereIn('file_id', explode(',', $detail['shop_image_id']))->field('*')->select(); $detail['shop_image_url'] = $file; // 获取logoImage (这里不能用with因为编辑页需要logoImage对象) @@ -77,6 +82,8 @@ class Shop extends Controller $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']; + unset($data['shop_hours_start']); + unset($data['shop_hours_end']); } if ($model->add($data)) { return $this->renderSuccess('添加成功'); @@ -97,6 +104,8 @@ class Shop extends Controller $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']; + unset($data['shop_hours_start']); + unset($data['shop_hours_end']); } if ($model->edit($data)) { return $this->renderSuccess('更新成功');