| xqd
@@ -90,24 +90,41 @@ class ManufacturerController extends Controller
|
|
|
*/
|
|
|
private function _updateSave() {
|
|
|
$data = (array) request('data');
|
|
|
- if(!empty($data['avatar']))
|
|
|
+ $saveData = AlbumManufacturerModel::where('store_id', $this->getStoreId())->first();
|
|
|
+ if (!empty($data['avatar'])) {
|
|
|
$data['avatar'] = $this->formatImgUrl($data['avatar']);
|
|
|
+ $this->deleteUrl($saveData->avatar);
|
|
|
+ }
|
|
|
+ if (!empty($data['background_pic'])) {
|
|
|
+ $data['background_pic'] = $this->formatImgUrl($data['background_pic']);
|
|
|
+ $this->deleteUrl($saveData->background_pic);
|
|
|
+ }
|
|
|
+ if (!empty($data['advertising_pic'])) {
|
|
|
+ $data['advertising_pic'] = $this->formatImgUrl($data['advertising_pic']);
|
|
|
+ $this->deleteUrl($saveData->advertising_pic);
|
|
|
+ }
|
|
|
+ if (!empty($data['notice_icon'])) {
|
|
|
+ $data['notice_icon'] = $this->formatImgUrl($data['notice_icon']);
|
|
|
+ $this->deleteUrl($saveData->notice_icon);
|
|
|
+ }
|
|
|
+ if (!empty($data['furniture_ads_pic'])) {
|
|
|
+ $data['furniture_ads_pic'] = $this->formatImgUrl($data['furniture_ads_pic']);
|
|
|
+ $this->deleteUrl($saveData->furniture_ads_pic);
|
|
|
+ }
|
|
|
+
|
|
|
if (!empty($data['banner']['url'])) {
|
|
|
foreach ($data['banner']['url'] as $key => $val) {
|
|
|
$data['banner']['url'][$key] = $this->formatImgUrl($val);
|
|
|
}
|
|
|
$data['banner'] = json_encode($data['banner']['url']);
|
|
|
+ $banner = json_decode($data['banner'], true);
|
|
|
+ foreach ($banner as $val) {
|
|
|
+ $this->deleteUrl($val);
|
|
|
+ }
|
|
|
}
|
|
|
- if(!empty($data['background_pic']))
|
|
|
- $data['background_pic'] = $this->formatImgUrl($data['background_pic']);
|
|
|
- if(!empty($data['advertising_pic']))
|
|
|
- $data['advertising_pic'] = $this->formatImgUrl($data['advertising_pic']);
|
|
|
- if(!empty($data['notice_icon']))
|
|
|
- $data['notice_icon'] = $this->formatImgUrl($data['notice_icon']);
|
|
|
- if(!empty($data['furniture_ads_pic']))
|
|
|
- $data['furniture_ads_pic'] = $this->formatImgUrl($data['furniture_ads_pic']);
|
|
|
|
|
|
- $id = AlbumManufacturerModel::where('store_id',$this->getStoreId())->first()->id;
|
|
|
+
|
|
|
+ $id = $saveData->id;
|
|
|
$ok = $this->repository->update($id,$data);
|
|
|
if($ok) {
|
|
|
return $this->showMessage('操作成功');
|