浏览代码

去掉关闭模板限制

duqinya 6 年之前
父节点
当前提交
cf24afc5b6
共有 1 个文件被更改,包括 1 次插入12 次删除
  1. 1 12
      app/Repositories/CmsContentTemplateRepository.php

+ 1 - 12
app/Repositories/CmsContentTemplateRepository.php

@@ -35,7 +35,7 @@ class CmsContentTemplateRepository {
      */
     public function create($request)
     {
-        $where = ['city_id'=>$request['city_id'],'title'=>trim($request['title'])];
+        $where = ['city_id'=>$request['city_id'],'title'=>trim($request['title']),'apply_type'=>$request['apply_type']];
         $template = $this->cmsContentTemplate->where($where)->get();
         if (count($template) == 2){
             throw new HttpException(500, '每个城市只能存在两个相同的模版');
@@ -69,17 +69,6 @@ class CmsContentTemplateRepository {
         if ($request['city_id'] == 610100 && $request['is_open'] == 0){
             throw new HttpException(500, '西安的模板不允许手动关闭');
         }
-        if ($request['is_open']==0){
-            $where = [
-                'apply_type'=>$request['apply_type'],
-                'is_open'=>$request['is_open'],
-                'city_id'=>$request['city_id'],
-            ];
-            $template = $this->cmsContentTemplate->where($where)->get();
-            if (count($template)<1){
-                throw new HttpException(500, '同一城市同一模板必须有一个状态开启');
-            }
-        }
 
         $template_id = $this->cmsContentTemplate->find($request['id']);
         $template_id->is_open = $request['is_open'];