mirror of https://gitee.com/zorlan/skycaiji
169 lines
8.9 KiB
PHP
169 lines
8.9 KiB
PHP
{extend name="common:main" /}
|
||
{block name="cssjs"}
|
||
|
||
{/block}
|
||
{block name="content"}
|
||
<form id="form_set" method="post" ajax-submit="true" role="form" action="{:url('Admin/Setting/caiji')}">
|
||
<div class="nav-tabs-custom">
|
||
<ul class="nav nav-tabs">
|
||
<li class="active"><a href="{:url('Setting/Caiji')}">采集设置</a></li>
|
||
<li><a href="{:url('Setting/page_render')}">页面渲染设置</a></li>
|
||
<li><a href="{:url('Setting/Proxy')}">代理设置</a></li>
|
||
<li><a href="{:url('Setting/Translate')}">翻译设置</a></li>
|
||
</ul>
|
||
<div class="tab-content">
|
||
<div class="tab-pane active" style="padding:0px 5px;">
|
||
<div class="form-group">
|
||
<label>{$Think.lang.set_caiji_auto}</label>
|
||
<div class="input-group">
|
||
<label class="radio-inline"><input type="radio" name="auto" value="1">{$Think.lang.yes}</label>
|
||
<label class="radio-inline"><input type="radio" name="auto" value="0">{$Think.lang.no}</label>
|
||
</div>
|
||
<p class="help-block">此设置为总控制开关,如设置“否”则任务中的自动采集设置不生效</p>
|
||
</div>
|
||
<div class="form-group" id="set_caiji_server">
|
||
<label>采集运行模式</label>
|
||
<div class="input-group">
|
||
<label class="radio-inline"><input type="radio" name="server" value="">web服务器(默认)</label>
|
||
<label class="radio-inline"><input type="radio" name="server" value="cli">cli命令行(推荐)</label>
|
||
</div>
|
||
<p class="help-block server-">使用web服务器运行采集,会受web服务器运行超时影响导致采集中断,需修改web服务器的超时时间</p>
|
||
<p class="help-block server-cli" style="display:none;">使用php cli命令行模式运行采集,自动采集、后台采集可以稳定运行,需要web服务器拥有执行命令的权限</p>
|
||
</div>
|
||
<div class="form-group" id="set_caiji_run" style="display:none;">
|
||
<label>{$Think.lang.set_caiji_run}</label>
|
||
<select name="run" class="form-control">
|
||
<option value="backstage">后台运行(默认)</option>
|
||
<option value="visit">访问触发(推荐)</option>
|
||
</select>
|
||
<p class="help-block run-backstage">将在PHP后台开启一个持续进程用来运行采集,会占用一些服务器资源</p>
|
||
<p class="help-block run-visit" style="display:none;">
|
||
需在您的网站底部模板中加入一条html代码:<br/>
|
||
<em><b><script src="{:url('Admin/Index/caiji',null,false,true)}" async></script></b></em>
|
||
<br/>添加后,用户访问页面时即可触发采集,该方法不会额外消耗服务器资源
|
||
</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>{$Think.lang.set_caiji_num}</label>
|
||
<input type="number" name="num" class="form-control" value="{$caijiConfig['num']}">
|
||
<p class="help-block">每次采集的数据总量,留空或0表示采完为止</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>{$Think.lang.set_caiji_interval}(分钟)</label>
|
||
<input type="number" name="interval" class="form-control" value="{$caijiConfig['interval']}">
|
||
<p class="help-block">可轮询目标的数据更新且有效减轻服务器压力,强烈建议设置时间!留空或0表示不限制(采集量大会造成服务器过载)</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>{$Think.lang.set_caiji_timeout}(分钟)</label>
|
||
<input type="number" name="timeout" class="form-control" value="{$caijiConfig['timeout']}">
|
||
<p class="help-block">无论是否采集完毕,到达设置的时间则立刻终止采集,可防止采集太久造成服务器卡顿,留空或0表示不限制</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>页面抓取间隔(秒)</label>
|
||
<input type="number" name="html_interval" class="form-control" value="{$caijiConfig['html_interval']}">
|
||
<p class="help-block">可防止页面抓取频率太快造成目标网站响应超时或宕机,留空或0表示不限制</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>实时发布数据</label>
|
||
<div class="input-group">
|
||
<label class="radio-inline"><input type="radio" name="real_time" value="1">是</label>
|
||
<label class="radio-inline"><input type="radio" name="real_time" value="0">否</label>
|
||
</div>
|
||
<p class="help-block">采集一条发布一条数据,否则等采集完后再集中发布</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="panel panel-default">
|
||
<div class="panel-heading">
|
||
<h4 class="panel-title">图片本地化</h4>
|
||
</div>
|
||
<div class="panel-collapse collapse in">
|
||
<div class="panel-body" style="padding-bottom:0px;">
|
||
<div class="form-group">
|
||
<label>开启功能</label>
|
||
<div class="input-group">
|
||
<label class="radio-inline"><input type="radio" name="download_img" value="1">是</label>
|
||
<label class="radio-inline"><input type="radio" name="download_img" value="0">否</label>
|
||
</div>
|
||
<p class="help-block">将远程图片下载到本地服务器</p>
|
||
</div>
|
||
<div id="set_caiji_download_img" style="display:none;">
|
||
<div class="form-group">
|
||
<label>图片保存目录(绝对路径)</label>
|
||
<input type="text" name="img_path" class="form-control" placeholder="默认{:config('root_path')}\data\images" value="{$caijiConfig['img_path']}">
|
||
<p class="help-block">可设置为服务器中的任意文件夹(必须开启读写权限),如果保存到本程序中,目录必须在data文件夹里</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>图片链接地址(绝对地址)</label>
|
||
<input type="text" name="img_url" class="form-control" placeholder="默认{:config('root_website')}/data/images" value="{:htmlspecialchars($caijiConfig['img_url'],ENT_QUOTES)}">
|
||
<p class="help-block">网页中可访问的图片网址目录,请务必对应到图片保存目录,否则图片无法显示</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>图片名称</label>
|
||
<select name="img_name" class="form-control">
|
||
<option value="">按时间生成(方便日期归类)</option>
|
||
<option value="url">按网址生成(防止重复下载)</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>下载超时(秒)</label>
|
||
<input type="number" name="img_timeout" class="form-control" value="{$caijiConfig['img_timeout']}">
|
||
<p class="help-block">多少秒内未下载完,跳过下载该图片,留空或0表示不限制</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>下载间隔(秒)</label>
|
||
<input type="number" name="img_interval" class="form-control" value="{$caijiConfig['img_interval']}">
|
||
<p class="help-block">可防止下载太快造成目标网站响应超时或宕机,留空或0表示不限制</p>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>限制大小(MB)</label>
|
||
<input type="number" name="img_max" class="form-control" value="{$caijiConfig['img_max']}">
|
||
<p class="help-block">超过兆数的图片不下载,留空或0表示不限制</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button type="submit" class="btn btn-primary btn-block">{$Think.lang.save}</button>
|
||
</div>
|
||
</form>
|
||
|
||
<script type="text/javascript">
|
||
'use strict';//严格模式
|
||
$('#form_set [name="auto"]').bind('click',function(){
|
||
if($(this).val()>0){
|
||
$('#set_caiji_run').show();
|
||
}else{
|
||
$('#set_caiji_run').hide();
|
||
}
|
||
});
|
||
|
||
$('#form_set [name="run"]').bind('change',function(){
|
||
$('#set_caiji_run .help-block').hide();
|
||
$('#set_caiji_run .run-'+$(this).val()).show();
|
||
});
|
||
|
||
$('#form_set [name="server"]').bind('click',function(){
|
||
$('#set_caiji_server .help-block').hide();
|
||
$('#set_caiji_server .server-'+$(this).val()).show();
|
||
});
|
||
|
||
$('#form_set [name="download_img"]').bind('click',function(){
|
||
if($(this).val()>0){
|
||
$('#set_caiji_download_img').show();
|
||
}else{
|
||
$('#set_caiji_download_img').hide();
|
||
}
|
||
});
|
||
|
||
$('#form_set [name="auto"][value="{$caijiConfig["auto"]|intval}"]').trigger("click");
|
||
$('#form_set [name="run"]').val("{$caijiConfig['run']?$caijiConfig['run']:'backstage'}").trigger("change");
|
||
$('#form_set [name="server"][value="{$caijiConfig["server"]}"]').prop('checked',true).trigger("click");
|
||
|
||
$('#form_set [name="real_time"][value="{$caijiConfig["real_time"]|intval}"]').prop('checked',true);
|
||
$('#form_set [name="download_img"][value="{$caijiConfig["download_img"]|intval}"]').trigger("click");
|
||
$('#form_set [name="img_name"]').val('{$caijiConfig["img_name"]}');
|
||
</script>
|
||
{/block} |