user(); $is_real_approved = $user->is_real_approved; $other_user = $request->user?:null; if ($other_user&&!$is_real_approved) { $count = $user->chatMessageCountWithUser($other_user->id); if ($count >= 3&&$user->type=='signle') return $this->failv2('未真人认证聊天限制'); } } catch (\Exception $e) { $this->getError($e); } return $next($request); } }