uid(); $key = md5($request->rule()->getRule() . $uid. json_encode($request->param())); if (!CacheService::setMutex($key)) { throw new ApiException('请求太过频繁,请稍后再试'); } $response = $next($request); $this->after($response, $key); return $response; } /** * @param $response * @param $key * @author 等风来 * @email 136327134@qq.com * @date 2022/11/22 */ public function after($response, $key) { CacheService::delMutex($key); } }