TaoLer/app/admin/view/seo/index.html

478 lines
16 KiB
HTML
Raw Normal View History

2022-04-17 17:09:19 +08:00
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid" id="component-tabs">
2022-04-17 17:09:19 +08:00
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-card" lay-filter="seo-tabs-brief">
<ul class="layui-tab-title">
<li lay-id="config"><span style="color:red">* </span>接口配置</li>
<li class="layui-this" lay-id="push">百度推送</li>
<li lay-id="map">站点地图</li>
2022-04-17 17:09:19 +08:00
<li lay-id="robots">robots</li>
2022-08-02 18:46:05 +08:00
<li lay-id="push_js">自动提交</li>
2022-08-16 15:29:04 +08:00
<li lay-id="tag_link">TagLink</li>
2022-08-02 18:48:31 +08:00
<li lay-id="search_show">蜘蛛分析</li>
</ul>
2022-04-17 17:09:19 +08:00
<div class="layui-tab-content">
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="config">
<div class="layui-form-item">
<label class="layui-form-label">key</label>
<div class="layui-input-inline">
<input type="text" name="client_id" value="{:config('taoler.baidu.client_id')}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">百度分词API Key</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">secret</label>
<div class="layui-input-inline">
<input type="text" name="client_secret" value="{:config('taoler.baidu.client_secret')}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">百度分词Secret Key</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">推送接口</label>
<div class="layui-input-inline">
<input type="text" name="push_api" value="{:config('taoler.baidu.push_api')}" placeholder="http://完整的接口地址" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">接口调用地址:http://data.zz.baidu.com/urls?site=https://www.youurl.com&token=yuotoken</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="baidu_config">确认保存</button>
</div>
</div>
</div>
</div>
2022-04-17 17:09:19 +08:00
<div class="layui-tab-item layui-show">
<div class="layui-form" wid100 lay-filter="push">
<div class="layui-form-item">
<label class="layui-form-label">推送范围</label>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" name="start_id" value="" placeholder="开始ID" class="layui-input" >
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" name="end_id" placeholder="结束ID" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">帖子ID范围,如果不填,默认全站提交</div>
2022-08-02 18:47:24 +08:00
</div>
<div class="layui-form-item">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-inline">
<select name="time" lay-verify="required">
<option value="today">今天</option>
<option value="yesterday">昨天</option>
<option value="week">本周</option>
<option value="month">本月</option>
<option value="''">全部</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">推送至API</label>
<div class="layui-input-block">
{if condition="checkRuleButton('Seo/push')"}
<button class="layui-btn" lay-submit lay-filter="search_push">提交推送</button>
{else /}
<button class="layui-btn layui-btn-disabled">提交推送</button>
{/if}
</div>
2022-04-17 17:09:19 +08:00
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="map">
<div class="layui-form-item">
<label class="layui-form-label">限定数量</label>
<div class="layui-input-inline">
<input type="text" name="map_num" value="{:config('taoler.sitemap.map_num')}" placeholder="推荐5000" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">单个map文件xml数量</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">更新频率</label>
<div class="layui-input-inline">
<input type="text" name="map_time" value="" placeholder="daily" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">每天或定时</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">优先级</label>
<div class="layui-input-inline">
<input type="text" name="map_level" value="" placeholder="默认0.5" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">0.0-1.0之间</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="map_xml">生成</button>
</div>
</div>
2022-08-02 18:46:05 +08:00
<hr>
<div class="layui-form-item">
<div class="layui-input-block">
<textarea type="text" class="layui-textarea" style="height: 300px;">{$xml}</textarea>
</div>
</div>
2022-04-17 17:09:19 +08:00
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="robots">
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
2022-08-02 18:46:05 +08:00
<textarea type="text" name="robots" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 400px;">{$robots}</textarea>
2022-04-17 17:09:19 +08:00
<div class="layui-form-mid layui-word-aux">会自动写入sitemap的链接</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="robots_submit">生成</button>
</div>
</div>
</div>
2022-08-02 18:46:05 +08:00
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="push_js">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" required placeholder="请正确填写js平台名称" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">js自动收录平台</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS代码</label>
<div class="layui-input-block">
<textarea type="text" name="jscode" required placeholder="请正确填写robots内容" class="layui-textarea" style="height: 200px;"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="push_jscode_submit">新增</button>
</div>
</div>
</div>
{volist name="jscode" id="vo"}
<hr>
<div class="layui-form" wid100>
<div class="layui-form-item">
<label class="layui-form-label">{$vo.name}</label>
<div class="layui-input-block">
<textarea type="text" name="jscode" placeholder="请正确填写robots内容" class="layui-textarea" style="height: 200px;">{$vo.jscode}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<input type="text" name="id" class="layui-hide" value="{$vo.id}">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="push_jscode_del">删除</button>
</div>
</div>
</div>
{/volist}
2022-04-17 17:09:19 +08:00
</div>
2022-08-16 15:29:04 +08:00
{//taglink}
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="tag_link">
<div class="layui-form-item">
<label class="layui-form-label">关键词</label>
<div class="layui-input-inline">
<input type="text" name="name" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="jscode" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="tag_link_submit">提交</button>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<table id="taglink" lay-filter="taglink"></table>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i></a>
</script>
<!--textarea type="text" name="search_list" placeholder="搜索引擎抓取结果" class="layui-textarea" style="height: 600px;"></textarea-->
</div>
</div>
</div>
{//蜘蛛分析}
2022-08-02 18:48:31 +08:00
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="search_show">
<div class="layui-form-item">
<label class="layui-form-label">选择时间</label>
<div class="layui-input-inline">
<input type="text" name="search_time" id="search_time" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
2022-08-02 18:49:40 +08:00
<div class="layui-form-item">
<label class="layui-form-label">选择蜘蛛</label>
<div class="layui-input-inline">
<select type="text" name="spider_name" required lay-verify="required" autocomplete="off" class="layui-input">
<option value="Baiduspider" selected>百度</option>
<option value="Bytespider" >头条</option>
<option value="Googlebot" >谷歌</option>
<option value="bingbot" >bing</option>
2022-08-02 20:39:46 +08:00
<option value="''" >全部</option>
2022-08-02 18:49:40 +08:00
</select>
</div>
</div>
2022-08-02 18:48:31 +08:00
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="search_show_submit">开始分析</button>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分析结果</label>
<div class="layui-input-block">
2022-08-02 18:49:40 +08:00
<table id="spider" lay-filter="spider"></table>
<!--textarea type="text" name="search_list" placeholder="搜索引擎抓取结果" class="layui-textarea" style="height: 600px;"></textarea-->
2022-08-02 18:48:31 +08:00
</div>
</div>
</div>
2022-04-17 17:09:19 +08:00
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
2022-08-16 15:29:04 +08:00
<script>
var setWebSite ="{:url('Set/website')}";
var setEmail ="{:url('Set/email')}";
2022-04-17 17:09:19 +08:00
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
2022-08-16 15:29:04 +08:00
}).use(['index'], function(){
2022-04-17 17:09:19 +08:00
var $ = layui.$
,form = layui.form
var element =layui.element ;
2022-08-02 18:48:31 +08:00
var laydate = layui.laydate;
2022-08-02 18:49:40 +08:00
var table = layui.table;
2022-08-02 18:48:31 +08:00
//执行一个laydate实例
laydate.render({
elem: '#search_time' //指定元素
,type: 'date'
,format: 'yyyyMM/dd'
,value: new Date()
2022-08-16 15:29:04 +08:00
});
2022-04-17 17:09:19 +08:00
2022-08-16 15:29:04 +08:00
//蜘蛛列表
2022-08-02 18:49:40 +08:00
table.render({
elem: '#spider'
,url: "{:url('seo/searchLog')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'time', title: '时间', width:160}
,{field: 'name', title: '名称', width:120, sort: true}
,{field: 'ip', title: 'IP', width:200}
2022-08-02 20:39:46 +08:00
,{field: 'url', title: 'URL', minWidth: 200, templet: '<div><a href="{{d.url}}" target="_blank">{{d.url}}</a></div>'}
2022-08-02 18:49:40 +08:00
]]
2022-08-02 20:39:46 +08:00
,limit: 20
2022-08-02 18:49:40 +08:00
,text: '对不起,加载出现异常!'
});
2022-08-16 15:29:04 +08:00
//taglink列表
table.render({
elem: '#taglink'
,url: "{:url('seo/tagLinkList')}" //数据接口
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'tag', title: '名称', width:120, sort: true}
,{field: 'link', title: 'URL', minWidth: 200, templet: '<div><a href="{{d.link}}" target="_blank">{{d.link}}</a></div>'}
,{field: 'time', title: '时间', width:160}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,text: '对不起,加载出现异常!'
});
2022-08-02 18:49:40 +08:00
2022-04-17 17:09:19 +08:00
// baidu push
form.on('submit(search_push)', function(data){
var field = data.field;
$.post("{:url('seo/push')}",field,function(res){
2022-04-17 17:09:19 +08:00
if(res.code == 0){
2022-08-02 18:46:05 +08:00
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
2022-04-17 17:09:19 +08:00
} else {
2022-08-02 18:46:05 +08:00
layer.open({title:"推送失败",content:res.msg,icon:5,anim:6});
2022-04-17 17:09:19 +08:00
}
});
return false;
});
//网站配置
form.on('submit(baidu_config)', function(data){
var field = data.field;
$.post("{:url('seo/config')}",field,function(res){
if(res.code == 0){
2022-08-02 18:46:05 +08:00
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
2022-04-17 17:09:19 +08:00
});
} else {
2022-08-02 18:46:05 +08:00
layer.open({title:"配置失败",content:res.msg,icon:5,anim:6});
2022-04-17 17:09:19 +08:00
}
});
return false;
});
// map
form.on('submit(map_xml)', function(data){
var field = data.field;
$.post("{:url('seo/map')}",field,function(res){
if(res.code == 0){
2022-08-02 18:46:05 +08:00
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
2022-04-17 17:09:19 +08:00
});
} else {
2022-08-02 18:46:05 +08:00
layer.open({title:"生成失败",content:res.msg,icon:5,anim:6});
2022-04-17 17:09:19 +08:00
}
});
return false;
});
2022-08-02 18:46:05 +08:00
// robots
2022-04-17 17:09:19 +08:00
form.on('submit(robots_submit)', function(data){
var field = data.field;
$.post("{:url('seo/robots')}",field,function(res){
if(res.code == 0){
2022-08-02 18:46:05 +08:00
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
2022-04-17 17:09:19 +08:00
});
} else {
layer.open({title:"设置失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
2022-08-02 18:46:05 +08:00
// 添加自动提交JS代码
form.on('submit(push_jscode_submit)', function(data){
var field = data.field;
2022-08-16 15:29:04 +08:00
field.type = 1;
2022-08-02 18:46:05 +08:00
$.post("{:url('seo/savePushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 删除自动提交JS代码
form.on('submit(push_jscode_del)', function(data){
var field = data.field;
$.post("{:url('seo/delPushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"删除失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
2022-08-02 18:48:31 +08:00
2022-08-16 15:29:04 +08:00
// 添加taglink
form.on('submit(tag_link_submit)', function(data){
var field = data.field;
field.type = 2;
$.post("{:url('seo/savePushJs')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
location.reload();
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 删除taglink代码
table.on('tool(taglink)', function(obj){
var data = obj.data;
if(obj.event === 'del'){
layer.confirm('真的删除行么', {icon: 3, title:'删除TagLink'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('seo/delPushJs')}", {"id":data.id}, function(data){
if (data.code == 0) {
layer.msg(data.msg,{icon:6,time:2000}, function(){
location.reload();
});
} else {
layer.open({title:'删除失败',content:data.msg,icon:5,anim:6});
}
});
});
layer.close(index);
}
});
2022-08-02 18:48:31 +08:00
// 搜索引擎分析
form.on('submit(search_show_submit)', function(data){
var field = data.field;
$.post("{:url('seo/searchLog')}",field,function(res){
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000},function(){
2022-08-02 18:49:40 +08:00
//$("textarea[name='search_list']").html(res.data);
2022-08-02 18:48:31 +08:00
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
2022-08-02 18:49:40 +08:00
//执行重载
table.reload('spider', {
where: field
2022-08-02 20:39:46 +08:00
,page: {
curr: 1 //重新从第 1 页开始
}
2022-08-02 18:49:40 +08:00
});
2022-08-02 18:48:31 +08:00
});
return false;
});
2022-04-17 17:09:19 +08:00
2022-08-02 18:46:05 +08:00
// 显示当前tab
2022-04-17 17:09:19 +08:00
if(location.hash){
element.tabChange('seo-tabs-brief', location.hash.replace(/^#/, ''));
}
element.on('tab(seo-tabs-brief)', function(){
var othis = $(this), layid = othis.attr('lay-id');
if(layid){
location.hash = layid;
}
});
2022-08-16 15:29:04 +08:00
});
</script>
2022-04-17 17:09:19 +08:00
{/block}