浏览代码

待收获彩虹豆

wzq 5 年之前
父节点
当前提交
1f82104bab
共有 4 个文件被更改,包括 7 次插入18 次删除
  1. 0 3
      app/Http/Controllers/Post/PostController.php
  2. 4 2
      app/Repositories/Post/PostRepository.php
  3. 0 6
      app/Traits/PostTrait.php
  4. 3 7
      composer.json

+ 0 - 3
app/Http/Controllers/Post/PostController.php

@@ -122,9 +122,6 @@ class PostController extends Controller
      */
     public function hide(Request $request)
     {
-        $h = date('h');
-        $H = date('H');
-        return intval($h);
         $validator = Validator::make($request->all(), [
             'id' => 'required|integer',
         ]);

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

@@ -15,6 +15,7 @@ use App\Models\PostData;
 use App\Models\PostImgs;
 use App\Models\PostLog;
 use App\Models\Topic;
+use App\Traits\PostTrait;
 use Illuminate\Database\QueryException;
 use Dingo\Api\Http\Response;
 use Illuminate\Support\Facades\DB;
@@ -25,6 +26,7 @@ use Tymon\JWTAuth\Facades\JWTAuth;
 
 class PostRepository
 {
+    use PostTrait;
 
     public function __construct(Post $post,
                                 PostData $postData,
@@ -97,8 +99,8 @@ class PostRepository
                 'comment_real_count' => 0,
                 'collect_count' => 0,
                 'collect_real_count' => 0,
-                'available_bean' => 0,
-                'will_collect_bean' => 0,
+                'available_bean' => $this->availableBean(),
+                'will_collect_bean' => rand(100, 200),
                 'collect_bean' => 0,
                 'weight' => 0
             ]);

+ 0 - 6
app/Traits/PostTrait.php

@@ -31,10 +31,4 @@ trait PostTrait
         }
         return intval($num * $t);
     }
-
-    //待收获彩虹豆数
-    public function willCollectBean()
-    {
-        return 22;
-    }
 }

+ 3 - 7
composer.json

@@ -14,6 +14,8 @@
         "laravel/lumen-framework": "5.8.*",
         "vlucas/phpdotenv": "^3.3",
         "multilinguals/apollo-client": "^0.1.2",
+        "illuminate/redis": "^5.8",
+        "predis/predis": "^1.1",
         "tymon/jwt-auth": "1.0.0-rc.4.1"
     },
     "require-dev": {
@@ -49,11 +51,5 @@
         "optimize-autoloader": true
     },
     "minimum-stability": "dev",
-    "prefer-stable": true,
-    "repositories": {
-        "packagist": {
-            "type": "composer",
-            "url": "https://packagist.laravel-china.org"
-        }
-    }
+    "prefer-stable": true
 }