From 8b947033dc544fdbf3d601a93665638107f7320d Mon Sep 17 00:00:00 2001 From: longchao <1432334894@qq.com> Date: Wed, 16 Jul 2025 10:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=B8=AD=E5=A2=9E=E5=8A=A0re?= =?UTF-8?q?dis=E8=AE=BE=E7=BD=AE=E7=BB=93=E6=9E=9C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- queue/deal/spider_weibo_comment.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/queue/deal/spider_weibo_comment.php b/queue/deal/spider_weibo_comment.php index bed66a9..91d8821 100644 --- a/queue/deal/spider_weibo_comment.php +++ b/queue/deal/spider_weibo_comment.php @@ -19,20 +19,20 @@ class spiderWeiboComment extends dealBase { $cookie_json = $rdobj->get(_RC_WEIBO_LOGIN_COOKIE2); $baselog = PROC_CODE . "|"; if(empty($cookie_json)) { - if($rdobj->llen($this->task_key) + 0 > 0) $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, 'cookie为空:'.$baselog); + if($rdobj->llen(_RQ_SPIDER_WEIBO_COMMENT) + 0 > 0) $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, 'cookie为空:'.$baselog); exit; } $cookie_data = json_decode($cookie_json, true); $cookie = $cookie_data[PROC_CODE]; if(empty($cookie)) { - if($rdobj->llen($this->task_key) + 0 > 0) $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, '未设置该进程cookie:'.$baselog.'|'.$cookie_json); + if($rdobj->llen(_RQ_SPIDER_WEIBO_COMMENT) + 0 > 0) $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, '未设置该进程cookie:'.$baselog.'|'.$cookie_json); exit; } $ipinfo = $rdobj->get(_RC_SPIDER_WEIBO_COMMENT_USE_IP); $ipdata = json_decode($ipinfo, true); - if (!$ipinfo && PROC_CODE == 0 && ($rdobj->llen($this->task_key) + 0 > 0 || !$this->is_while)) $ipdata = $obj->getZmhttpIp(_RC_SPIDER_WEIBO_COMMENT_USE_IP); + if (!$ipinfo && PROC_CODE == 0 && ($rdobj->llen(_RQ_SPIDER_WEIBO_COMMENT) + 0 > 0 || !$this->is_while)) $ipdata = $obj->getZmhttpIp(_RC_SPIDER_WEIBO_COMMENT_USE_IP); if (empty($ipdata)) { sleep(2); return false; @@ -41,7 +41,7 @@ class spiderWeiboComment extends dealBase { $obj->proxy_ip = $ipdata['ip']; $obj->proxy_port = $ipdata['port']; - $rq_data = $rdobj->rpop($this->task_key); + $rq_data = $rdobj->rpop(_RQ_SPIDER_WEIBO_COMMENT); if(empty($rq_data)) exit(); $rq_data = json_decode($rq_data, true); @@ -71,7 +71,7 @@ class spiderWeiboComment extends dealBase { if($error == 'cookie失效') { sleep(30); $rdobj = $obj->initRedis(); - $rds = $rdobj->rpush($this->task_key, json_encode($rq_data)); + $rds = $rdobj->rpush(_RQ_SPIDER_WEIBO_COMMENT, json_encode($rq_data)); $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, '队列评论抓取失败,重试中:'.$error.'|'.$baselog.'|redis:'.$rds); @@ -86,7 +86,7 @@ class spiderWeiboComment extends dealBase { sleep(30); $rdobj = $obj->initRedis(); - $rds = $rdobj->rpush($this->task_key, json_encode($rq_data)); + $rds = $rdobj->rpush(_RQ_SPIDER_WEIBO_COMMENT, json_encode($rq_data)); $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, '队列评论抓取失败,重试中:'.$error.'|'.$baselog.'|redis:'.$rds); if ($obj->is_change_ip && PROC_CODE == 0) $rdobj->del(_RC_SPIDER_WEIBO_COMMENT_USE_IP); @@ -107,7 +107,7 @@ class spiderWeiboComment extends dealBase { if(!$res['is_load_all']) { sleep(10); $rdobj = $obj->initRedis(); - $rds = $rdobj->rpush($this->task_key, json_encode($res)); + $rds = $rdobj->rpush(_RQ_SPIDER_WEIBO_COMMENT, json_encode($res)); $obj->writeLog(ZHISHIKU_SPIDER_LOG, ZHISHIKU_SPIDER_COMMENT, '抓取下一页:'.$baselog.'|redis:'.$rds); return true;