duqinya пре 6 година
родитељ
комит
8bb859add1
1 измењених фајлова са 3 додато и 7 уклоњено
  1. 3 7
      app/Repositories/CmsContentTemplateRepository.php

+ 3 - 7
app/Repositories/CmsContentTemplateRepository.php

@@ -71,16 +71,12 @@ class CmsContentTemplateRepository {
     public function edit($request)
     {
         $template_id = $this->cmsContentTemplate->find($request['id']);
-        $where = ['city_id'=>$template_id->city_id,'apply_type'=>$template_id->apply_type];
-        $template = $this->cmsContentTemplate->where($where)->get();
-        foreach ($template->toArray() as $v){
-            if ($v['is_open'] == 1 && $request['is_open'] == 0){
-                throw new HttpException(500, '请先关闭该城市模块下已开启的模板后操作');
-            }
-        }
         if ($request['city_id'] == 610100 && $request['is_open'] == 0){
             throw new HttpException(500, '城市为西安的模板不允许手动关闭');
         }
+        if ($request['is_open'] == 1 && $template_id->status == 0){
+            throw new HttpException(500, '请先配置模板并发布之后再开启');
+        }
 
         $template_id->is_open = $request['is_open'];
         $template_id->updated_at = date('Y-m-d H:i:s');