This commit is contained in:
tao 2022-08-02 18:48:31 +08:00
parent 5a6a54c887
commit 563a01e3fa
12 changed files with 204 additions and 133 deletions

View File

@ -3,8 +3,6 @@
> TaoLer是一个简单迅捷的轻论坛系统适用于个人或组织区域型信息交流发布平台。
* 官网https://www.aieok.com
* 版本TaoLer 1.9.4
* 日期2022.4.24
webman版新架构已适配90%

View File

@ -79,8 +79,9 @@ class AuthAccess extends AdminController
}
//管理员权限编辑
public function edit($id)
public function edit()
{
$id = input('id');
if(Request::isAjax()){
$data = Request::only(['id','uid','group_id']);
//检测重复权限
@ -98,7 +99,7 @@ class AuthAccess extends AdminController
return json($res);
}
$access = Db::name('auth_group_access')->group('uid')->find($id);
$access = Db::name('auth_group_access')->find($id);
$admins = Db::name('admin')->field('id,username')->where('delete_time',0)->select();
$auth_groups = Db::name('auth_group')->field('id,title')->select();

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-13 09:54:31
* @LastEditTime: 2022-04-24 08:44:53
* @LastEditTime: 2022-04-27 14:20:06
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\controller\Seo.php
@ -128,7 +128,7 @@ class Seo extends AdminController
$flag= true;
// 写ID
$w_id = '';
// 新文件编号
// 生成新文件编号,防止重复写入,
$i = 1;
// 获取public下所有xml文件
$newFile = $this->getXmlFile(public_path());
@ -228,7 +228,7 @@ class Seo extends AdminController
return json(['code'=>-1,'msg'=>'写xml配置失败']);
}
return json(['code'=>0,'msg'=>'生成xml成功']);
return json(['code'=>0,'msg'=>'本次成功生成'.count($artAllId).'条xml']);
}
/**
@ -313,4 +313,31 @@ class Seo extends AdminController
return json(['code'=>0,'msg'=>'删除成功']);
}
public function searchLog()
{
$time = input('search_time');
$logPath = app()->getRootPath().'runtime/log/browse/'.$time.'.log';
$logPath = str_replace('\\','/',$logPath);
if(!file_exists($logPath)) return json(['code'=>-1,'msg'=>'还没有要分析的日志哦']);
$log = file_get_contents($logPath);
$log = preg_replace('/\[info\][^\n]*compatible;/', '', $log);
// 正则蜘蛛
preg_match_all('/(.*?)(?:bingbot|Googlebot|Baiduspider|SemrushBot|AhrefsBot|MJ12bot)+[^\n]*\r?\n/',$log,$arr);
$string = '';
foreach($arr[0] as $str) {
$str = preg_replace('/\[(.*?)T/', '', $str);
$str = preg_replace('/\+08:00\]/', '', $str);
$string .= preg_replace('/\/(.*?)\)/', '', $str);
}
if(strlen($string)) {
return json(['code'=>0,'msg'=>'分析成功','data'=>$string]);
} else {
return json(['code'=>-1,'msg'=>'还没有蜘蛛来哦']);
}
}
}

View File

@ -6,15 +6,13 @@
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
管理员筛选
</div>
<div class="layui-inline">管理员筛选</div>
<div class="layui-inline">
<select name="uid" lay-filter="LAY-admin-group-type">
<option value="">全部用户</option>
{volist name="admins" id="vo"}
{volist name="admins" id="vo"}
<option value="{$vo.id}">{$vo.username}</option>
{/volist}
{/volist}
</select>
</div>
</div>
@ -30,9 +28,9 @@
{if condition="checkRuleButton('AuthAccess/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="groupcheck" lay-text="开启|禁用" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('AuthAccess/edit')"}
{if condition="checkRuleButton('AuthAccess/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('AuthAccess/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
@ -156,7 +154,7 @@
type: 2
,title: '添加权限'
,content: 'add.html'
,area: ['400px', '300px']
,area: ['450px', '400px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
@ -168,7 +166,7 @@
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/AuthAccess/add')}",
url:"{:url('AuthAccess/add')}",
data:field,
daType:"json",
success:function (data){

View File

@ -13,6 +13,7 @@
<li lay-id="map">站点地图</li>
<li lay-id="robots">robots</li>
<li lay-id="push_js">自动提交</li>
<li lay-id="search_show">蜘蛛分析</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item">
@ -177,6 +178,27 @@
{/volist}
</div>
<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>
<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">
<textarea type="text" name="search_list" placeholder="搜索引擎抓取结果" class="layui-textarea" style="height: 600px;"></textarea>
</div>
</div>
</div>
</div>
</div>
@ -196,10 +218,19 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index'], function(){
}).use(['index', 'laydate'], function(){
var $ = layui.$
,form = layui.form
var element =layui.element ;
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#search_time' //指定元素
,type: 'date'
,format: 'yyyyMM/dd'
,value: new Date()
});
// baidu push
form.on('submit(search_push)', function(data){
@ -291,6 +322,22 @@
return false;
});
// 搜索引擎分析
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(){
$("textarea[name='search_list']").html(res.data);
//location.reload();
});
} else {
layer.open({title:"添加失败",content:res.msg,icon:5,anim:6});
}
});
return false;
});
// 显示当前tab
if(location.hash){
element.tabChange('seo-tabs-brief', location.hash.replace(/^#/, ''));

View File

@ -92,7 +92,7 @@ function getCateDesc($ename)
function getArtContent($content)
{
// 过滤音视频图片
$content = preg_replace('/[(img)|(audio)|(video)]+(\(\S+\))?\[\S+\]/','',$content);
$content = preg_replace('/(?:img|audio|video)(\(\S+\))?\[\S+\]/','',$content);
$content = preg_replace('/\s*/','',$content);
$content = preg_replace('/\[[^\]]+\]/','',$content);
return mb_substr(strip_tags($content),0,150).'...';

View File

@ -234,13 +234,13 @@ class SetArr
preg_match($k_arr,$this->str,$k_arr);
//$k_arr[0]
$k_arr = preg_replace('/[\s|\'|>]/', '', $k_arr[0]);
dump($k_arr);
//dump($k_arr);
$k_ar = eval('$'.$k_arr);
$n = $this->getArrSonCount($k_ar);
dump($n);
//dump($n);
$kpats = $this->getArrSonCount(config($this->configName.'.'.$k)) ? '/\''.$k.'\'\s*=>\s*\[[^\[|\]]*,\r?\n/' : '/\''.$k.'\'\s*=>\s*\[\r?\n/';
preg_match($kpats,$this->str,$arrk);
dump($k,$kpats,$this->str,$arrk);
//dump($k,$kpats,$this->str,$arrk);
if(!is_int($kk)) {
if(array_key_exists($kk,config($this->configName.'.'.$k))) {
echo $kk.'不能添加已存在的配置项kk';

View File

@ -331,7 +331,7 @@ layui.define(['table', 'form'], function(exports){
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
$.ajax({
type:"post",
url:authGroupRoleEdit,
data:{"id":field.id,"rules":rules,"title":field.title,"descr":field.descr},
@ -419,7 +419,7 @@ layui.define(['table', 'form'], function(exports){
type: 2
,title: '编辑用户权限'
,content: authAccessEdit +'?id='+ data.id
,area: ['350px', '420px']
,area: ['450px', '420px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
@ -430,30 +430,30 @@ layui.define(['table', 'form'], function(exports){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:authAccessEdit,
data:field,
daType:"json",
success:function (res){
if (res.code == 0) {
layer.msg(res.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'修改失败',
content:res.msg,
icon:5,
anim:6
});
}
}
});
type:"post",
url:authAccessEdit,
data:field,
daType:"json",
success:function (res){
if (res.code == 0) {
layer.msg(res.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'修改失败',
content:res.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-group'); //数据刷新
layer.close(index); //关闭弹层
});
});
submit.trigger('click');
}
@ -545,7 +545,7 @@ layui.define(['table', 'form'], function(exports){
field.ishidden = 1;
}
//提交 Ajax 成功后,静态更新表格中的数据
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:authRuleEdit,

View File

@ -12,7 +12,7 @@ var compressImage = {
//obj.preview(function(index, file, result){
//执行实例
var index = layer.load(1);
var files = obj.pushFile();
var filesArry = [];
for (var key in files) { //将上传的文件转为数组形式

View File

@ -153,93 +153,93 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'],
return false;
}
layer.open({
type: 1
,id: 'fly-jie-upload'
,title: '插入图片'
,area: 'auto'
,shade: false
//,area: '465px'
,fixed: false
,offset: [
editor.offset().top - $(window).scrollTop() + 'px'
,editor.offset().left + 'px'
]
,skin: 'layui-layer-border'
,content: ['<ul class="layui-form layui-form-pane" style="margin: 20px;">'
,'<li class="layui-form-item">'
,'<label class="layui-form-label">URL</label>'
,'<div class="layui-input-inline">'
,'<input required name="image" placeholder="支持粘贴远程图片地址" value="" class="layui-input">'
,'</div>'
,'<button type="button" class="layui-btn layui-btn-primary" id="uploadImg"><i class="layui-icon">&#xe67c;</i>上传图片</button>'
,'</li>'
,'<li class="layui-form-item" style="text-align: center;">'
,'<button type="button" lay-submit lay-filter="uploadImages" class="layui-btn" id="img-button">确认</button>'
,'</li>'
,'</ul>'].join('')
,success: function(layero, index){
var image = layero.find('input[name="image"]');
layer.open({
type: 1
,id: 'fly-jie-upload'
,title: '插入图片'
,area: 'auto'
,shade: false
//,area: '465px'
,fixed: false
,offset: [
editor.offset().top - $(window).scrollTop() + 'px'
,editor.offset().left + 'px'
]
,skin: 'layui-layer-border'
,content: ['<ul class="layui-form layui-form-pane" style="margin: 20px;">'
,'<li class="layui-form-item">'
,'<label class="layui-form-label">URL</label>'
,'<div class="layui-input-inline">'
,'<input required name="image" placeholder="支持粘贴远程图片地址" value="" class="layui-input">'
,'</div>'
,'<button type="button" class="layui-btn layui-btn-primary" id="uploadImg"><i class="layui-icon">&#xe67c;</i>上传图片</button>'
,'</li>'
,'<li class="layui-form-item" style="text-align: center;">'
,'<button type="button" lay-submit lay-filter="uploadImages" class="layui-btn" id="img-button">确认</button>'
,'</li>'
,'</ul>'].join('')
,success: function(layero, index){
var image = layero.find('input[name="image"]');
//执行上传实例
upload.render({
elem: '#uploadImg'
,accept: 'images'
,acceptMime: 'image/*'
,exts: 'jpg|png|gif|bmp|jpeg'
,url: uploads
,data: {type:'image'}
,auto: false
//,bindAction: '#img-button' //指向一个按钮触发上传
//,field: 'image'
,size: 10240
,choose: function (obj) { //选择文件后的回调
imgcom.uploads(obj);
}
//执行上传实例
upload.render({
elem: '#uploadImg'
,accept: 'images'
,acceptMime: 'image/*'
,exts: 'jpg|png|gif|bmp|jpeg'
,url: uploads
,data: {type:'image'}
,auto: false
//,bindAction: '#img-button' //指向一个按钮触发上传
//,field: 'image'
,size: 10240
,choose: function (obj) { //选择文件后的回调
imgcom.uploads(obj);
}
,done: function(res){
if(res.status == 0){
//console.log(res.url);
image.val(res.url);
} else {
layer.msg(res.msg, {icon: 5});
}
}
,error: function(){
layer.msg('系统错误,请联系管理员');
}
});
,done: function(res){
if(res.status == 0){
//console.log(res.url);
image.val(res.url);
} else {
layer.msg(res.msg, {icon: 5});
}
}
,error: function(){
layer.msg('系统错误,请联系管理员');
}
});
form.on('submit(uploadImages)', function(data){
var field = data.field;
if(!field.image) return image.focus();
layui.focusInsert(editor[0], 'img['+ field.image + '] ');
layer.close(index);
editor.trigger('keyup');
});
}
});
}
,href: function(editor){ //超链接
layer.prompt({
title: '请输入合法链接'
,shade: false
,fixed: false
,id: 'LAY_flyedit_href'
,offset: [
editor.offset().top - $(window).scrollTop() + 1 + 'px'
,editor.offset().left + 1 + 'px'
]
}, function(val, index, elem){
if(!/^http(s*):\/\/[\S]/.test(val)){
layer.tips('请务必 http 或 https 开头', elem, {tips:1})
return;
}
layui.focusInsert(editor[0], ' a('+ val +')['+ val + '] ');
layer.close(index);
editor.trigger('keyup');
});
form.on('submit(uploadImages)', function(data){
var field = data.field;
if(!field.image) return image.focus();
layui.focusInsert(editor[0], 'img['+ field.image + '] ');
layer.close(index);
editor.trigger('keyup');
});
}
});
}
,href: function(editor){ //超链接
layer.prompt({
title: '请输入合法链接'
,shade: false
,fixed: false
,id: 'LAY_flyedit_href'
,offset: [
editor.offset().top - $(window).scrollTop() + 1 + 'px'
,editor.offset().left + 1 + 'px'
]
}, function(val, index, elem){
if(!/^http(s*):\/\/[\S]/.test(val)){
layer.tips('请务必 http 或 https 开头', elem, {tips:1})
return;
}
layui.focusInsert(editor[0], ' a('+ val +')['+ val + '] ');
layer.close(index);
editor.trigger('keyup');
});
}
,quote: function(editor){ //引用
layer.prompt({
title: '请输入引用内容'

View File

@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'bf441719f29b5b109daebc5b9ededd8da8914773',
'reference' => '55487e7d9d3d67406b0dbe02896d285923cec456',
'name' => 'taoser/taoler',
'dev' => true,
),
@ -160,7 +160,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'bf441719f29b5b109daebc5b9ededd8da8914773',
'reference' => '55487e7d9d3d67406b0dbe02896d285923cec456',
'dev_requirement' => false,
),
'taoser/think-addons' => array(

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2022-04-24 09:15:39
// This file is automatically generated at:2022-04-27 14:39:58
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',