Browse Source

修改title

duqinya 6 years ago
parent
commit
1b21122f17
1 changed files with 5 additions and 5 deletions
  1. 5 5
      app/Http/Repositories/CmsContentTemplateSetRepository.php

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

@@ -6,6 +6,7 @@ use App\Models\CmsContentTemplate;
 use App\Models\CmsContentTemplateSet;
 use App\Models\CmsSubjectProduct;
 use App\Models\CmsSubject;
+use Symfony\Component\HttpKernel\Exception\HttpException;
 
 class CmsContentTemplateSetRepository {
     public function __construct(CmsContentTemplateSet $cmsContentTemplateSet,CmsContentTemplate $cmsContentTemplate,CmsSubjectProduct $cmsSubjectProduct,CmsSubject $cmsSubject) {
@@ -25,19 +26,18 @@ class CmsContentTemplateSetRepository {
         $group_array = [];
         if ($request['type'] == 0){
             $group_array['apply_type'] ="group";
-            $group_array['title'] ="今日团购";
             $group_array['content'] =[];
         }else{//菜市场首页
             $group_array['apply_type'] ="market";
-            $group_array['title'] ="菜市场";
             $group_array['content'] =[];
         }
 
-        $group_array['content'][0]['area_type'] ="banner";
-        $temalates = $this->cmsContentTemplate->select('id')->where(['city_id'=>$request['city_id'],'apply_type'=>$request['type'],'is_open'=>0])->first();
+        $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, '没有找到对应模板');
+            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();
         $new_rule = [];