feat(command): 订单爬虫统计请求次数

订单爬虫统计请求次数
This commit is contained in:
liuyuhang 2024-07-11 17:16:04 +08:00
parent ab3df41fe5
commit d554661485
2 changed files with 13 additions and 0 deletions

View File

@ -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') {

View File

@ -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);