From 7a3fb71615e851745733f5b31998c974d2f86b5a Mon Sep 17 00:00:00 2001 From: zorlan <285909184@qq.com> Date: Wed, 14 Sep 2022 23:11:29 +0800 Subject: [PATCH] 2.5.1 --- public/static/css/admin.css | 3 +++ vendor/skycaiji/app/admin/command/Collect.php | 9 +------ .../app/admin/controller/Collected.php | 16 +++++++++++-- .../skycaiji/app/admin/controller/Index.php | 4 ++++ vendor/skycaiji/app/admin/event/Cpattern.php | 24 +++++++++---------- vendor/skycaiji/app/admin/model/Collector.php | 11 +++++++-- .../app/admin/view/collected/clear_error.html | 16 +++++++++++++ .../app/admin/view/collected/list.html | 2 +- vendor/skycaiji/app/common.php | 2 +- vendor/skycaiji/app/install/data/check_db | 2 +- vendor/skycaiji/app/install/data/check_file | 2 +- 11 files changed, 63 insertions(+), 28 deletions(-) create mode 100644 vendor/skycaiji/app/admin/view/collected/clear_error.html diff --git a/public/static/css/admin.css b/public/static/css/admin.css index cff2b98..6b70c24 100644 --- a/public/static/css/admin.css +++ b/public/static/css/admin.css @@ -197,6 +197,9 @@ table.table thead .sorting_desc:after { -khtml-user-select:none; user-select:none; } +.coll-tab>li>a{ + border-bottom:0; +} /*请求头信息*/ .c-p-request-headers .delete-request-header{margin-top:8px;} .c-p-request-headers-img .delete-request-header-img{margin-top:8px;} diff --git a/vendor/skycaiji/app/admin/command/Collect.php b/vendor/skycaiji/app/admin/command/Collect.php index 4288f04..1aeb089 100644 --- a/vendor/skycaiji/app/admin/command/Collect.php +++ b/vendor/skycaiji/app/admin/command/Collect.php @@ -95,14 +95,7 @@ class Collect extends Command{ $this->error_msg('不是后台运行方式'); } - $url=$rootUrl.'/admin/api/collect'; - - try{ - - \util\Curl::get($url,null,array('timeout'=>3)); - }catch(\Exception $ex){ - - } + \skycaiji\admin\model\Collector::collect_run_auto($rootUrl); sleep(15); }while(1==1); diff --git a/vendor/skycaiji/app/admin/controller/Collected.php b/vendor/skycaiji/app/admin/controller/Collected.php index 8f11f53..d2def09 100644 --- a/vendor/skycaiji/app/admin/controller/Collected.php +++ b/vendor/skycaiji/app/admin/controller/Collected.php @@ -99,8 +99,20 @@ class Collected extends BaseController { } /*清理失败的数据*/ public function clearErrorAction(){ - model('Collected')->where("`error` is not null and `error`<>''")->delete(); - $this->success('清理完成','admin/collected/list'); + if(request()->isPost()){ + $release=input('release/a'); + init_array($release); + if(in_array('all', $release)){ + + model('Collected')->where("`error` is not null and `error`<>''")->delete(); + }else{ + + model('Collected')->where('release','in',$release)->where("`error` is not null and `error`<>''")->delete(); + } + $this->success('清理完成','admin/collected/list'); + }else{ + return $this->fetch('clear_error'); + } } /** * 操作 diff --git a/vendor/skycaiji/app/admin/controller/Index.php b/vendor/skycaiji/app/admin/controller/Index.php index 6175e5e..b48c9ae 100644 --- a/vendor/skycaiji/app/admin/controller/Index.php +++ b/vendor/skycaiji/app/admin/controller/Index.php @@ -464,6 +464,10 @@ class Index extends CollectController{ if(model('admin/Config')->server_is_cli()){ + if(!function_exists('proc_open')){ + $this->echo_msg_exit('php函数proc_open被禁用'); + } + $urlParams=input('param.','','trim'); if(!empty($urlParams)&&is_array($urlParams)){ $urlParams=base64_encode(json_encode(input('param.'))); diff --git a/vendor/skycaiji/app/admin/event/Cpattern.php b/vendor/skycaiji/app/admin/event/Cpattern.php index 11f0d1e..6b9119f 100644 --- a/vendor/skycaiji/app/admin/event/Cpattern.php +++ b/vendor/skycaiji/app/admin/event/Cpattern.php @@ -705,23 +705,23 @@ class Cpattern extends CpatternEvent{ $this->front_collected=true; if(!empty($this->config['front_urls'])){ - foreach ($this->config['front_urls'] as $v){ - if($this->cur_front_urls[$v['name']]){ + foreach ($this->config['front_urls'] as $fuv){ + if($this->cur_front_urls[$fuv['name']]){ - $frontUrl=$this->cur_front_urls[$v['name']]; + $frontUrl=$this->cur_front_urls[$fuv['name']]; }else{ - $frontUrl=$v['url']; + $frontUrl=$fuv['url']; if($frontUrl){ - $parentMatches=$this->parent_page_signs2matches($this->parent_page_signs('front_url',$v['name'],'url')); + $parentMatches=$this->parent_page_signs2matches($this->parent_page_signs('front_url',$fuv['name'],'url')); $frontUrl=$this->merge_match_signs($parentMatches, $frontUrl); - $this->cur_front_urls[$v['name']]=$frontUrl; + $this->cur_front_urls[$fuv['name']]=$frontUrl; } } if($frontUrl){ - $isFormPost=$this->page_is_post('front_url',$v['name'])?'[POST] ':''; - $this->echo_msg($isFormPost?array('采集前置页“%s”:%s',$v['name'],$isFormPost.$frontUrl):array('采集前置页“%s”:%s',$v['name'],$frontUrl,$frontUrl),'black'); - $htmlInfo=$this->get_page_html($frontUrl,'front_url',$v['name'],false,true); - if($v['use_cookie']||$v['use_cookie_img']){ + $isFormPost=$this->page_is_post('front_url',$fuv['name'])?'[POST] ':''; + $this->echo_msg($isFormPost?array('采集前置页“%s”:%s',$fuv['name'],$isFormPost.$frontUrl):array('采集前置页“%s”:%s',$fuv['name'],$frontUrl,$frontUrl),'black'); + $htmlInfo=$this->get_page_html($frontUrl,'front_url',$fuv['name'],false,true); + if($fuv['use_cookie']||$fuv['use_cookie_img']){ $mUseCookie=array(); if($htmlInfo['header']){ @@ -748,13 +748,13 @@ class Cpattern extends CpatternEvent{ } } } - if($v['use_cookie']){ + if($fuv['use_cookie']){ $gUseCookie=\util\Param::get_gsc_use_cookie(); init_array($gUseCookie); \util\Param::set_gsc_use_cookie(false,array_merge($gUseCookie,$mUseCookie)); $this->echo_msg('获取前置页cookie并在全局抓取页面时使用','black'); } - if($v['use_cookie_img']){ + if($fuv['use_cookie_img']){ $gUseCookieImg=\util\Param::get_gsc_use_cookie(true); init_array($gUseCookieImg); \util\Param::set_gsc_use_cookie(true,array_merge($gUseCookieImg,$mUseCookie)); diff --git a/vendor/skycaiji/app/admin/model/Collector.php b/vendor/skycaiji/app/admin/model/Collector.php index b89d75a..4678414 100644 --- a/vendor/skycaiji/app/admin/model/Collector.php +++ b/vendor/skycaiji/app/admin/model/Collector.php @@ -254,10 +254,17 @@ class Collector extends \skycaiji\common\model\BaseModel{ return $key; } /*触发运行自动采集*/ - public static function collect_run_auto(){ + public static function collect_run_auto($rootUrl=''){ try{ - get_html(url('admin/index/auto_collect?backstage_run=1&key='.self::collect_key(),null,false,true),null,array('timeout'=>3)); + $url=''; + if($rootUrl){ + $url=$rootUrl.'/admin/index/auto_collect'; + }else{ + $url=url('admin/index/auto_collect',null,false,true); + } + $url.=(strpos($url, '?')===false?'?':'&').'backstage_run=1&key='.self::collect_key(); + get_html($url,null,array('timeout'=>3)); }catch(\Exception $ex){} } diff --git a/vendor/skycaiji/app/admin/view/collected/clear_error.html b/vendor/skycaiji/app/admin/view/collected/clear_error.html new file mode 100644 index 0000000..489170c --- /dev/null +++ b/vendor/skycaiji/app/admin/view/collected/clear_error.html @@ -0,0 +1,16 @@ +
\ No newline at end of file diff --git a/vendor/skycaiji/app/admin/view/collected/list.html b/vendor/skycaiji/app/admin/view/collected/list.html index 2fd33ef..a0b8df9 100644 --- a/vendor/skycaiji/app/admin/view/collected/list.html +++ b/vendor/skycaiji/app/admin/view/collected/list.html @@ -8,7 +8,7 @@