|
@@ -22,6 +22,7 @@ use App\Service\RabbitMqUtil;
|
|
|
use App\Traits\PostTrait;
|
|
|
use App\Traits\UserTrait;
|
|
|
use Illuminate\Database\QueryException;
|
|
|
+use Illuminate\Support\Carbon;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -58,6 +59,11 @@ class PostRepositories
|
|
|
Log::info('获取用户信息失败');
|
|
|
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'];
|
|
|
$detectionTextResult = $this->detectionService->checkText($detectionText);
|
|
@@ -166,6 +172,12 @@ class PostRepositories
|
|
|
return jsonError('获取用户信息失败');
|
|
|
}
|
|
|
|
|
|
+ $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
|
|
|
+ $oneHourCommentCount = $this->postComment->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
|
|
|
+ if($oneHourCommentCount > 59){
|
|
|
+ return jsonError('回复了这么多,休息休息,喝口水吧!');
|
|
|
+ }
|
|
|
+
|
|
|
$detectionTextResult = $this->detectionService->checkText($request['content']);
|
|
|
if ($detectionTextResult['code']<0) {
|
|
|
return jsonError('内容违规,请修正哦');
|