Browse Source

发布内容限制

wzq 5 years ago
parent
commit
be08598312
1 changed files with 5 additions and 5 deletions
  1. 5 5
      app/Repositories/PostRepositories.php

+ 5 - 5
app/Repositories/PostRepositories.php

@@ -81,11 +81,11 @@ class PostRepositories
         if($userInfo['strength']){
         if($userInfo['strength']){
             $isValid = 1;
             $isValid = 1;
         }
         }
-//        $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
-//        $oneHourPostCount = $this->post->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
-//        if($oneHourPostCount > 5){
-//            return jsonError('创作欲望太强啦,休息一下,看看其他用户的内容吧!');
-//        }
+        $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
+        $oneHourPostCount = $this->post->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
+        if($oneHourPostCount > 5){
+            return jsonError('创作欲望太强啦,休息一下,看看其他用户的内容吧!');
+        }
 
 
         $detectionText = $request['title'] .','. $request['content'];
         $detectionText = $request['title'] .','. $request['content'];
         $detectionTextResult = $this->detectionService->checkText($detectionText);
         $detectionTextResult = $this->detectionService->checkText($detectionText);