diff --git a/config/define.php b/config/define.php index 4c13f71..2d2ebb7 100644 --- a/config/define.php +++ b/config/define.php @@ -49,6 +49,7 @@ define('WEIBO_IMG_URL', 'https://wx4.sinaimg.cn/mw690/%s.jpg'); + define('_RC_WEIBO_LOGIN_COOKIE', 'rc_weibo_login_cookie'); define('WEIBO_LOGIN_COOKIE', '_2A25FMHeEDeRhGeFH41MV8ibNyjSIHXVmTPVMrDV8PUNbmtAYLWLlkW9NekLV22uXkAnuAlCngnjVjozSXR5mujv7'); define('WEIBO_DETAIL_URL', 'https://zhishiku.yizherenxin.cn/weibo/show_detail/wid/%s'); diff --git a/control/weibo.php b/control/weibo.php index 99624b9..b93a462 100644 --- a/control/weibo.php +++ b/control/weibo.php @@ -110,4 +110,20 @@ class weibo extends publicBase { public function show_detail() { $this->view['wid'] = $this->get('wid') + 0; } + + public function ajax_update_cookie() { + $cookie = trim($this->get('cookie')); + $type = $this->get('type') + 0; + $obj = new mWeiboBehavior(); + $robj = $obj->initRedis(); + $robj->set(_RC_WEIBO_LOGIN_COOKIE, $cookie); + + if($type == 0){ + shell_exec("nohup /usr/bin/php /data1/www/zhishiku.yizherenxin.cn/queue/crontab/spider_behavior_data.php > /dev/null 2>&1 &"); + $this->ajax_json(true, '设置成功'); + } + + shell_exec("nohup /usr/bin/php /data1/www/zhishiku.yizherenxin.cn/queue/crontab/spider_behavior_delta.php > /dev/null 2>&1 &"); + $this->ajax_json(true, '设置成功'); + } } diff --git a/model/mSpider.php b/model/mSpider.php index d2fc5cc..47b6c3b 100644 --- a/model/mSpider.php +++ b/model/mSpider.php @@ -267,7 +267,7 @@ class mSpider extends mBase { $this->proxy_ip = $ipdata['ip']; $this->proxy_port = $ipdata['port']; - $cookie = WEIBO_LOGIN_COOKIE; + $cookie = $rdobj->get(_RC_WEIBO_LOGIN_COOKIE);; $url = "https://weibo.com/ajax/statuses/searchProfile?uid={$uid}&page={$page}&hasori=1"; $headers = array( "Cookie: SUB={$cookie}", @@ -378,7 +378,7 @@ class mSpider extends mBase { $this->proxy_ip = $ipdata['ip']; $this->proxy_port = $ipdata['port']; - $cookie = WEIBO_LOGIN_COOKIE; + $cookie = $rdobj->get(_RC_WEIBO_LOGIN_COOKIE);; $endtime = strtotime("tomorrow"); $url = "https://weibo.com/ajax/statuses/searchProfile?uid={$uid}&page={$page}&endtime={$endtime}&hasret=1&hastext=1&haspic=1&hasvideo=1&hasmusic=1"; $headers = array(