|
@@ -141,4 +141,38 @@ class BannerRepository
|
|
]);
|
|
]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function editStatus($request)
|
|
|
|
+ {
|
|
|
|
+ $banner_id = $this->banner->find($request['id']);
|
|
|
|
+ $banner_id->is_open = $request['is_open'];
|
|
|
|
+ $banner_id->updated_at = date('Y-m-d H:i:s');
|
|
|
|
+
|
|
|
|
+ $res = $banner_id->save();
|
|
|
|
+
|
|
|
|
+ if (!$res) {
|
|
|
|
+ throw new HttpException(500, '修改状态失败');
|
|
|
|
+ }
|
|
|
|
+ //banner关闭检测绑定楼层是否只有一个banner
|
|
|
|
+ if ($request['is_open'] == 0){
|
|
|
|
+ $request['banner_id'] = $res['id'];
|
|
|
|
+ $this->editFloorBind($request);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function editFloorBind($request)
|
|
|
|
+ {
|
|
|
|
+ try {
|
|
|
|
+ $url = config("customer.manage_service_url") . '/cms/v2/floorBind';
|
|
|
|
+ $array = [
|
|
|
|
+ 'json' => ['banner_id' => $request['banner_id']], 'query' => [], 'http_errors' => false, 'headers' => ['Authorization' => "Bearer " . JWTAuth::getToken()]
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ return http($url, $array, 'put');
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
+ return [];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|