mirror of https://gitee.com/zorlan/skycaiji
2.5.1
parent
6d6ce85a44
commit
7a3fb71615
|
@ -197,6 +197,9 @@ table.table thead .sorting_desc:after {
|
||||||
-khtml-user-select:none;
|
-khtml-user-select:none;
|
||||||
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 .delete-request-header{margin-top:8px;}
|
||||||
.c-p-request-headers-img .delete-request-header-img{margin-top:8px;}
|
.c-p-request-headers-img .delete-request-header-img{margin-top:8px;}
|
||||||
|
|
|
@ -95,14 +95,7 @@ class Collect extends Command{
|
||||||
$this->error_msg('不是后台运行方式');
|
$this->error_msg('不是后台运行方式');
|
||||||
}
|
}
|
||||||
|
|
||||||
$url=$rootUrl.'/admin/api/collect';
|
\skycaiji\admin\model\Collector::collect_run_auto($rootUrl);
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
\util\Curl::get($url,null,array('timeout'=>3));
|
|
||||||
}catch(\Exception $ex){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep(15);
|
sleep(15);
|
||||||
}while(1==1);
|
}while(1==1);
|
||||||
|
|
|
@ -99,8 +99,20 @@ class Collected extends BaseController {
|
||||||
}
|
}
|
||||||
/*清理失败的数据*/
|
/*清理失败的数据*/
|
||||||
public function clearErrorAction(){
|
public function clearErrorAction(){
|
||||||
model('Collected')->where("`error` is not null and `error`<>''")->delete();
|
if(request()->isPost()){
|
||||||
$this->success('清理完成','admin/collected/list');
|
$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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 操作
|
* 操作
|
||||||
|
|
|
@ -464,6 +464,10 @@ class Index extends CollectController{
|
||||||
|
|
||||||
if(model('admin/Config')->server_is_cli()){
|
if(model('admin/Config')->server_is_cli()){
|
||||||
|
|
||||||
|
if(!function_exists('proc_open')){
|
||||||
|
$this->echo_msg_exit('php函数proc_open被禁用');
|
||||||
|
}
|
||||||
|
|
||||||
$urlParams=input('param.','','trim');
|
$urlParams=input('param.','','trim');
|
||||||
if(!empty($urlParams)&&is_array($urlParams)){
|
if(!empty($urlParams)&&is_array($urlParams)){
|
||||||
$urlParams=base64_encode(json_encode(input('param.')));
|
$urlParams=base64_encode(json_encode(input('param.')));
|
||||||
|
|
|
@ -705,23 +705,23 @@ class Cpattern extends CpatternEvent{
|
||||||
$this->front_collected=true;
|
$this->front_collected=true;
|
||||||
|
|
||||||
if(!empty($this->config['front_urls'])){
|
if(!empty($this->config['front_urls'])){
|
||||||
foreach ($this->config['front_urls'] as $v){
|
foreach ($this->config['front_urls'] as $fuv){
|
||||||
if($this->cur_front_urls[$v['name']]){
|
if($this->cur_front_urls[$fuv['name']]){
|
||||||
|
|
||||||
$frontUrl=$this->cur_front_urls[$v['name']];
|
$frontUrl=$this->cur_front_urls[$fuv['name']];
|
||||||
}else{
|
}else{
|
||||||
$frontUrl=$v['url'];
|
$frontUrl=$fuv['url'];
|
||||||
if($frontUrl){
|
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);
|
$frontUrl=$this->merge_match_signs($parentMatches, $frontUrl);
|
||||||
$this->cur_front_urls[$v['name']]=$frontUrl;
|
$this->cur_front_urls[$fuv['name']]=$frontUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($frontUrl){
|
if($frontUrl){
|
||||||
$isFormPost=$this->page_is_post('front_url',$v['name'])?'[POST] ':'';
|
$isFormPost=$this->page_is_post('front_url',$fuv['name'])?'[POST] ':'';
|
||||||
$this->echo_msg($isFormPost?array('采集前置页“%s”:%s',$v['name'],$isFormPost.$frontUrl):array('采集前置页“%s”:<a href="%s" target="_blank">%s</a>',$v['name'],$frontUrl,$frontUrl),'black');
|
$this->echo_msg($isFormPost?array('采集前置页“%s”:%s',$fuv['name'],$isFormPost.$frontUrl):array('采集前置页“%s”:<a href="%s" target="_blank">%s</a>',$fuv['name'],$frontUrl,$frontUrl),'black');
|
||||||
$htmlInfo=$this->get_page_html($frontUrl,'front_url',$v['name'],false,true);
|
$htmlInfo=$this->get_page_html($frontUrl,'front_url',$fuv['name'],false,true);
|
||||||
if($v['use_cookie']||$v['use_cookie_img']){
|
if($fuv['use_cookie']||$fuv['use_cookie_img']){
|
||||||
|
|
||||||
$mUseCookie=array();
|
$mUseCookie=array();
|
||||||
if($htmlInfo['header']){
|
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();
|
$gUseCookie=\util\Param::get_gsc_use_cookie();
|
||||||
init_array($gUseCookie);
|
init_array($gUseCookie);
|
||||||
\util\Param::set_gsc_use_cookie(false,array_merge($gUseCookie,$mUseCookie));
|
\util\Param::set_gsc_use_cookie(false,array_merge($gUseCookie,$mUseCookie));
|
||||||
$this->echo_msg('获取前置页cookie并在全局抓取页面时使用','black');
|
$this->echo_msg('获取前置页cookie并在全局抓取页面时使用','black');
|
||||||
}
|
}
|
||||||
if($v['use_cookie_img']){
|
if($fuv['use_cookie_img']){
|
||||||
$gUseCookieImg=\util\Param::get_gsc_use_cookie(true);
|
$gUseCookieImg=\util\Param::get_gsc_use_cookie(true);
|
||||||
init_array($gUseCookieImg);
|
init_array($gUseCookieImg);
|
||||||
\util\Param::set_gsc_use_cookie(true,array_merge($gUseCookieImg,$mUseCookie));
|
\util\Param::set_gsc_use_cookie(true,array_merge($gUseCookieImg,$mUseCookie));
|
||||||
|
|
|
@ -254,10 +254,17 @@ class Collector extends \skycaiji\common\model\BaseModel{
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
/*触发运行自动采集*/
|
/*触发运行自动采集*/
|
||||||
public static function collect_run_auto(){
|
public static function collect_run_auto($rootUrl=''){
|
||||||
try{
|
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){}
|
}catch(\Exception $ex){}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<form id="win_form_clear" ajax-submit="true" method="post" role="form" action="{:url('admin/collected/clearError')}">
|
||||||
|
{:html_usertoken()}
|
||||||
|
<div class="well" style="padding-bottom:0;">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>发布方式</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<label class="checkbox-inline"><input type="checkbox" name="release[]" value="all"> 所有</label>
|
||||||
|
{foreach name="Think.config.release_modules" item="rele_module"}
|
||||||
|
<label class="checkbox-inline"><input type="checkbox" name="release[]" value="{$rele_module}"> {:lang('collected_rele_'.$rele_module)}</label>
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
<p class="help-block" style="margin-bottom:0;">清理所选发布方式的失败数据</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary btn-block">清理</button>
|
||||||
|
</form>
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="alert alert-warning alert-dismissible" style="padding-top:7px;padding-bottom:7px;line-height:20px;">
|
<div class="alert alert-warning alert-dismissible" style="padding-top:7px;padding-bottom:7px;line-height:20px;">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" style="top:1px;">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" style="top:1px;">×</button>
|
||||||
已采集网址可防止重复采集,如无必要,请勿删除!
|
已采集网址可防止重复采集,如无必要,请勿删除!
|
||||||
<button type="button" id="btn_clear_error" class="btn btn-sm btn-warning" style="padding:2px 10px;">一键清理失败的数据</button>
|
<button type="button" id="btn_clear_error" class="btn btn-sm btn-warning" style="padding:2px 10px;">清理失败的数据</button>
|
||||||
</div>
|
</div>
|
||||||
<form id="form_list" method="post" ajax-submit="true" action="{:url('collected/op')}">
|
<form id="form_list" method="post" ajax-submit="true" action="{:url('collected/op')}">
|
||||||
{:html_usertoken()}
|
{:html_usertoken()}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
define('SKYCAIJI_VERSION', '2.5');
|
define('SKYCAIJI_VERSION', '2.5.1');
|
||||||
\think\Loader::addNamespace('plugin', realpath(SKYCAIJI_PATH.'plugin'));
|
\think\Loader::addNamespace('plugin', realpath(SKYCAIJI_PATH.'plugin'));
|
||||||
\think\Loader::addNamespace('util',realpath(APP_PATH.'extend/util'));
|
\think\Loader::addNamespace('util',realpath(APP_PATH.'extend/util'));
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue