Forráskód Böngészése

Merge branch 'develop' of http://git.caihongxingqiu.net/rainbow/community-manage into develop

xielin 5 éve
szülő
commit
f689a29800

+ 1 - 0
app/Transformers/DetailTopicTransformer.php

@@ -31,6 +31,7 @@ class DetailTopicTransformer extends TransformerAbstract{
             'page_count' => 0,
             'created_at' => Carbon::parse($topic['created_at'])->toDateTimeString(),
             'category_list'=>$category,
+            'base_count'=>$topic['base_count'],
         ];
     }
 }

+ 0 - 59
database/migrations/2019_06_14_155026_create_table_feed.php

@@ -1,59 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateTableFeed extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('feed', function (Blueprint $table) {
-            $table->bigIncrements('id');
-
-            $table->integer('uid')
-                ->index('uid')
-                ->comment('uid');
-
-            $table->integer('follow_uid')
-                ->comment('关注人uid');
-
-            $table->string('follow_username')
-                ->default('')
-                ->comment('关注人昵称');
-
-            $table->string('follow_avatar')
-                ->default('')
-                ->comment('关注人头像');
-
-            $table->string('type', 32)
-                ->default('post_create')
-                ->comment('类型');
-
-            $table->integer('relate_id')
-                ->default(0)
-                ->comment('相关id');
-
-            $table->string('content', 1000)
-                ->default('')
-                ->comment('内容');
-
-            $table->timestamps();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('feed');
-    }
-}

+ 60 - 0
database/migrations/2019_07_29_095032_create_table_feeds.php

@@ -0,0 +1,60 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableFeeds extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        for($i = 0; $i < 10; $i++){
+            Schema::create('feed_'.$i, function (Blueprint $table) {
+                $table->bigIncrements('id');
+
+                $table->integer('uid')
+                    ->comment('uid');
+
+                $table->integer('follow_uid')
+                    ->comment('关注人uid');
+
+                $table->string('follow_username')
+                    ->default('')
+                    ->comment('关注人昵称');
+
+                $table->string('follow_avatar')
+                    ->default('')
+                    ->comment('关注人头像');
+
+                $table->string('type', 32)
+                    ->default('post_create')
+                    ->comment('类型');
+
+                $table->integer('relate_id')
+                    ->default(0)
+                    ->comment('相关id');
+
+                $table->string('content', 1000)
+                    ->default('')
+                    ->comment('内容');
+                
+                $table->timestamps();
+            });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('feed');
+    }
+}

+ 34 - 0
database/migrations/2019_07_29_103631_add_index_to_table_feeds.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddIndexToTableFeeds extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        for($i = 0; $i < 10; $i++){
+            Schema::table('feed_'.$i, function (Blueprint $table) {
+                $table->index(['uid', 'follow_uid', 'type', 'relate_id'],'idx_search');
+            });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('table_feeds', function (Blueprint $table) {
+            //
+        });
+    }
+}