duqinya 6 роки тому
батько
коміт
43874107f5

+ 7 - 5
app/Http/Repositories/CmsContentTemplateSetRepository.php

@@ -22,21 +22,23 @@ class CmsContentTemplateSetRepository {
      */
     public function preview($request)
     {
+        $temalates = $this->cmsContentTemplate->select('title','id')->where(['city_id'=>$request['city_id'],'apply_type'=>$request['type'],'is_open'=>0])->first();
+        if (!$temalates){
+            throw new HttpException(500, '没有找到对应模板');
+        }
+
         //团购首页
         $group_array = [];
         if ($request['type'] == 0){
             $group_array['apply_type'] ="group";
+            $group_array['title'] =$temalates->title;
             $group_array['content'] =[];
         }else{//菜市场首页
             $group_array['apply_type'] ="market";
+            $group_array['title'] =$temalates->title;
             $group_array['content'] =[];
         }
 
-        $temalates = $this->cmsContentTemplate->select('title','id')->where(['city_id'=>$request['city_id'],'apply_type'=>$request['type'],'is_open'=>0])->first();
-        if (!$temalates){
-            throw new HttpException(500, '没有找到对应模板');
-        }
-        $group_array['title'] =$temalates->title;
         $group_array['content'][0]['area_type'] ="banner";
 
         $banner_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$temalates->id,'area_type'=>0])->get();