Przeglądaj źródła

转态统一调整

duqinya 6 lat temu
rodzic
commit
80be7010e0

+ 9 - 4
app/Repositories/CmsContentTemplateSetRepository.php

@@ -8,8 +8,6 @@ use App\Models\CmsContentTemplate;
 use App\Models\CmsContentTemplateSet;
 use App\Models\CmsSubjectProduct;
 use Symfony\Component\HttpKernel\Exception\HttpException;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\QueryException;
 
 class CmsContentTemplateSetRepository {
     public function __construct(CmsContentTemplateSet $cmsContentTemplateSet,CmsContentTemplate $cmsContentTemplate,CmsSubjectProduct $cmsSubjectProduct,CmsSubject $cmsSubject) {
@@ -141,21 +139,28 @@ class CmsContentTemplateSetRepository {
      */
     public function preview($request)
     {
+
+        $temalates = $this->cmsContentTemplate->select('title')->where(['id'=>$request['tpl_id']])->first();
+        if (!$temalates){
+            throw new HttpException(500, '没有找到对应模板');
+        }
+
         //团购首页
         $group_array = [];
         if ($request['type'] == 0){
             $group_array['apply_type'] ="group";
-            $group_array['title'] ="今日团购";
+            $group_array['title'] = $temalates->title;
             $group_array['content'] =[];
         }else{//菜市场首页
             $group_array['apply_type'] ="market";
-            $group_array['title'] ="菜市场";
+            $group_array['title'] = $temalates->title;
             $group_array['content'] =[];
         }
 
         $group_array['content'][0]['area_type'] ="banner";
         $banner_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>0])->get();
         $new_rule = [];
+
         foreach ($banner_rule->toArray() as $k=>$v){
             $new_rule[] = $v;
         }

+ 1 - 1
database/migrations/2019_04_28_022240_create_table_subject_table.php

@@ -19,7 +19,7 @@ class CreateTableSubjectTable extends Migration
             $table->string('city_name',20)->comment('城市名称'); //城市名称
             $table->string('title',70)->comment('专题名称');
             $table->tinyInteger('show_type')->default(0)->comment('商品展示方式:0:左图右字;1:通栏大图;2:左右滑动');
-            $table->tinyInteger('is_open')->default(0)->comment('是否启用:0:开启;1:关闭');
+            $table->tinyInteger('is_open')->default(1)->comment('是否启用:0:关闭;1:开启');
             $table->timestamps();
             $table->softDeletes();
         });

+ 1 - 1
database/migrations/2019_04_28_025655_create_cms_content_template_table.php

@@ -19,7 +19,7 @@ class CreateCmsContentTemplateTable extends Migration
             $table->string('city_name',20)->comment('城市名称');
             $table->string('title',200)->comment('模板名称');
             $table->tinyInteger('apply_type')->default(1)->comment('对应模板:0:团购首页;1:菜市场首页');
-            $table->tinyInteger('is_open')->default(1)->comment('是否启用:0:启用;1:禁用');
+            $table->tinyInteger('is_open')->default(0)->comment('是否启用:0:禁用;1:启用');
             $table->timestamps();
         });
     }