Parcourir la source

删除真实评论数

wzq il y a 5 ans
Parent
commit
8fa5b166d3

+ 0 - 2
app/Repositories/Post/PostRepository.php

@@ -107,7 +107,6 @@ class PostRepository
                 'share_count' => 0,
                 'share_real_count' => 0,
                 'comment_count' => 0,
-                'comment_real_count' => 0,
                 'collect_count' => 0,
                 'collect_real_count' => 0,
                 'available_bean' => $this->availableBean(),
@@ -266,7 +265,6 @@ class PostRepository
         try{
             $this->postComment->create($data);
             $post->data->comment_count += 1;
-            $post->data->comment_real_count += 1;
             $post->data->save();
 
             DB::commit();

+ 30 - 0
database/migrations/2019_06_14_090938_drop_comment_real_count_from_post_data.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class DropCommentRealCountFromPostData extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        DB::statement("ALTER TABLE post_data DROP COLUMN comment_real_count");
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('post_data', function (Blueprint $table) {
+            //
+        });
+    }
+}