소스 검색

新增字段

duqinya 6 년 전
부모
커밋
7d0e6be4cf

+ 2 - 2
app/Repositories/CmsContentTemplateSetRepository.php

@@ -25,7 +25,7 @@ class CmsContentTemplateSetRepository
      */
     public function preview($request)
     {
-        $temalates = $this->cmsContentTemplate->select('title', 'id')->where(['city_id' => $request['city_id'], 'apply_type' => $request['type'], 'is_open' => 1])->orderBy('id','desc')->first();
+        $temalates = $this->cmsContentTemplate->select('title', 'id')->where(['city_id' => $request['city_id'], 'apply_type' => $request['type'], 'is_open' => 1,'status'=>1])->orderBy('id','desc')->first();
         if (!$temalates) {
             throw new HttpException(500, '没有找到对应模板');
         }
@@ -116,7 +116,7 @@ class CmsContentTemplateSetRepository
 
     public function getTemplate($cityId)
     {
-        return $this->cmsContentTemplate->select('title', 'apply_type')->where(['city_id' => $cityId, 'is_open' => 1])->orderBy('apply_type', 'asc')->get();
+        return $this->cmsContentTemplate->where(['city_id' => $cityId, 'is_open' => 1,'status'=>1])->select('id','title', 'apply_type')->orderBy('apply_type', 'asc')->get();
     }
 
     public function productList($request)

+ 32 - 0
database/migrations/2019_05_22_085041_add_status_to_cms_content_template_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddStatusToCmsContentTemplateTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('cms_content_template', function (Blueprint $table) {
+            $table->tinyInteger('status')->default(0)->comment('状态:0:草稿;1:发布');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('cms_content_template', function (Blueprint $table) {
+            //
+        });
+    }
+}