skycaiji/SkycaijiApp/admin/view/setting/caiji.html

152 lines
7.9 KiB
PHP
Raw Normal View History

2019-02-19 09:52:13 +00:00
{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_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>&lt;script src="{:url('Admin/Index/caiji',null,false,true)}"&gt;&lt;/script&gt;</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">
$('#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="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="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}