diff --git a/service/app/server/Douyin.php b/service/app/server/Douyin.php index 842d5e13..a0ad85cd 100644 --- a/service/app/server/Douyin.php +++ b/service/app/server/Douyin.php @@ -479,6 +479,12 @@ class Douyin public function _curl($url, $params, $method = 'GET') { + // 请求次数统计 + $key = sprintf("Douyin:ReqiestCount:%s", date('Y-m-d')); + $requestCount = Redis::incrBy($key, 1); + if ($requestCount == 1) { + Redis::expire($key, 604800); // 7天 + } $http = $this->gate . $url; if ($method == 'GET') { diff --git a/service/app/server/Meituan.php b/service/app/server/Meituan.php index b86e6111..1739dae6 100644 --- a/service/app/server/Meituan.php +++ b/service/app/server/Meituan.php @@ -119,6 +119,13 @@ class Meituan { public function _curl($url, $params, $method = 'GET') { + // 请求次数统计 + $key = sprintf("Meituan:ReqiestCount:%s", date('Y-m-d')); + $requestCount = Redis::incrBy($key, 1); + if ($requestCount == 1) { + Redis::expire($key, 604800); // 7天 + } + $http = $this->gate.$url; if($method == 'GET') { $http = $http.'?'. http_build_query($params);