This commit is contained in:
tao 2022-08-02 20:39:46 +08:00
parent bdf3421b9d
commit c528ef2e16
14 changed files with 317 additions and 246 deletions

View File

@ -12,6 +12,8 @@
2. github https://www.github.com/taoser/TaoLer
3. composer create-project taoser/taoler
![alt taoler官网](https://www.aieok.com/storage/1/article_pic/20220802/3cf60f90f7d75b7ddb7efedd96b9e62c.png "TaoLerCMS")
#### 介绍
1. 采用动态密码加密,相同密码在入库时具有唯一性,即使管理员也无法破解,用户信息安全牢固。
@ -24,6 +26,7 @@
8. 项目会长期维护,优化更新。
9. 预增加插件管理机制1.02.0版本正式上线)
![alt taoler官网](https://www.aieok.com/storage/1/article_pic/20220802/6ea6bb3e40d9a3bc7c9ec28f3e0d7b90.png "TaoLerCMS")
#### 构架组成
- 1.x版本构架
@ -38,6 +41,8 @@
极简、丰盈简单高效模块化UI框架体积轻盈组件丰盈。
Fly模板:
一款至简的社区模板。
![alt taoler官网](https://www.aieok.com/storage/1/article_pic/20220802/54c8364fffd9ca1d15856efd90b689bc.png "TaoLerCMS")
#### 安装教程

View File

@ -2,7 +2,7 @@
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2022-04-13 09:54:31
* @LastEditTime: 2022-04-29 17:24:47
* @LastEditTime: 2022-05-02 11:54:00
* @LastEditors: TaoLer
* @Description: 搜索引擎SEO优化设置
* @FilePath: \TaoLer\app\admin\controller\Seo.php
@ -317,6 +317,8 @@ class Seo extends AdminController
{
$time = input('search_time');
$name = input('spider_name');
$page = input('page') ? input('page') : 1;
$limit = input('limit') ? input('limit') : 20;
$logPath = app()->getRootPath().'runtime/log/browse/'.$time.'.log';
$logPath = str_replace('\\','/',$logPath);
if(!file_exists($logPath)) {
@ -324,6 +326,7 @@ class Seo extends AdminController
}
$log = file_get_contents($logPath);
$log = preg_replace('/\[info\][^\n]*compatible;/', '', $log);
$log = preg_replace('/\[info\][^\n]*(?=YisouSpider)/', ' ', $log);
switch($name) {
case 'Baiduspider':
@ -340,7 +343,7 @@ class Seo extends AdminController
break;
default:
// 正则全部蜘蛛
preg_match_all('/(.*?)(?:bingbot|Googlebot|Baiduspider|Bytespider|SemrushBot|AhrefsBot|MJ12bot)+[^\n]*\r?\n/',$log,$arr);
preg_match_all('/(.*?)(?:bingbot|Googlebot|Baiduspider|Bytespider|360Spider|YisouSpider|Sosospider|Sogou News Spider|SemrushBot|AhrefsBot|MJ12bot)+[^\n]*\r?\n/',$log,$arr);
}
// $string = '';
@ -355,6 +358,7 @@ class Seo extends AdminController
// } else {
// return json(['code'=>-1,'msg'=>'还没有蜘蛛来哦']);
// }
$data = [];
$list = [];
if(count($arr[0])) {
$list['code']= 0;
@ -363,22 +367,35 @@ class Seo extends AdminController
foreach($arr[0] as $k =>$str) {
// $str = preg_replace('/\[(.*?)T/', '', $str);
// $str = preg_replace('/\+08:00\]/', '', $str);
// 时间
$str = preg_replace('/\/(.*?)\)/', '', $str);
// 时间
$ptime = "/([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/";
preg_match($ptime, $str,$at);
$time = str_replace('T',' ',$at[0]);
//$list[$k]['time'] = $time;
// ip
$pip = '/(?:(?:2[0-4][0-9]\.)|(?:25[0-5]\.)|(?:1[0-9][0-9]\.)|(?:[1-9][0-9]\.)|(?:[0-9]\.)){3}(?:(?:2[0-5][0-5])|(?:25[0-5])|(?:1[0-9][0-9])|(?:[1-9][0-9])|(?:[1-9]))/';
$pip = '/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/';
preg_match($pip, $str,$aip);
$ip = $aip[0];
// url
$pattern="/(http|https):\/\/.*$/i";
preg_match($pattern, $str,$url);
// name
preg_match('/(?:bingbot|Googlebot|Baiduspider|Bytespider|360Spider|YisouSpider|Sosospider|Sogou News Spider|SemrushBot|AhrefsBot|MJ12bot)/', $str, $n);
$name = $n[0];
$list['data'][] = ['id'=>$k + 1, 'time'=>$time, 'name'=>$name, 'ip'=>$ip, 'url'=>$url[0]];
//$list['data'][] = ['id'=>$k + 1, 'time'=>$time, 'name'=>$name, 'ip'=>$ip, 'url'=>$url[0]];
$data[] = ['id'=>$k + 1, 'time'=>$time, 'name'=>$name, 'ip'=>$ip, 'url'=>$url[0]];
}
$datas = array_chunk($data,(int)$limit);
//$pages = count($datas);
foreach($datas as $k=>$v) {
if($page-1 == $k) {
$list['data'] = $v;
}
}
return json($list);
} else {
return json(['code'=>-1,'msg'=> '没有需要分析的数据']);

View File

@ -5,8 +5,6 @@ use app\common\controller\AdminController;
use think\facade\View;
use think\facade\Db;
use think\facade\Request;
use think\facade\Config;
use think\exception\ValidateException;
use app\common\model\Slider as SliderModel;
class Slider extends AdminController
@ -19,10 +17,51 @@ class Slider extends AdminController
*/
public function index()
{
//幻灯列表
$sliders = SliderModel::select();
View::assign('slider',$sliders);
return View::fetch();
return View::fetch();
}
/**
* 链接列表
*
* @return void
*/
public function list()
{
$list = [];
$type = input('slid_type');
$limit = input('limit');
$page = input('page');
if($type) {
$datas = SliderModel::where('slid_type',$type)->where('')->paginate([
'list_rows'=> $limit,
'page'=>$page
]);
} else {
$datas = SliderModel::paginate([
'list_rows'=> $limit,
'page'=>$page
]);
}
if(count($datas)) {
$list = ['code'=>0,'msg'=>'获取数据成功'];
foreach($datas as $k=>$v) {
$list['data'][] = [
'id'=>$v['id'],
'slid_name'=>$v['slid_name'],
'slid_img' =>$v['slid_img'],
'slid_type'=>$v['slid_type'],
'slid_href'=>$v['slid_href'],
'slid_color'=>$v['slid_color'],
'slid_start'=> time() < $v['slid_start'] ? '<span style="color:#1c97f5;">未开始</span>' : date('Y-m-d H:i',$v['slid_start']),
'slid_over'=> time() > $v['slid_over'] ? '<span style="color:#F00;">已结束</span>' : date('Y-m-d H:i',$v['slid_over']),
'slid_status'=> $v['slid_status'] ? '正常' : '禁止'
];
}
return json($list);
} else {
return json(['code'=>-1,'msg'=>'还没有数据']);
}
}
/**
@ -37,13 +76,14 @@ class Slider extends AdminController
$data = Request::param();
$data['slid_start'] = strtotime($data['slid_start']);
$data['slid_over'] = strtotime($data['slid_over']);
$result = Db::name('slider')->save($data);
if($result){
$slid = new SliderModel();
$result = $slid->add($data);
if($result == 1){
$res = ['code'=>0,'msg'=>'添加成功'];
}else{
$res = ['code'=>-1,'msg'=>'添加失败'];
}
return json($res);
return json($res);
}
return View::fetch();
@ -57,22 +97,23 @@ class Slider extends AdminController
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit($id)
public function edit()
{
$slider = Db::name('slider')->find($id);
$id = (int)input('id');
$slider = Db::name('slider')->find($id);
if(Request::isAjax()){
$data = Request::param();
//var_dump($data);
$data['slid_start'] = strtotime($data['slid_start']);
$data['slid_over'] = strtotime($data['slid_over']);
$result = Db::name('slider')->where('id',$id)->save($data);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
if(Request::isAjax()){
$data = Request::param();
$data['slid_start'] = strtotime($data['slid_start']);
$data['slid_over'] = strtotime($data['slid_over']);
$slid = new SliderModel();
$result = $slid->edit($data);
if($result == 1){
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
View::assign('slider',$slider);
@ -84,11 +125,11 @@ class Slider extends AdminController
*/
public function uploadImg()
{
$uploads = new \app\common\lib\Uploads();
$upRes = $uploads->put('file','slider',1024,'image');
$slires = $upRes->getData();
$uploads = new \app\common\lib\Uploads();
$upRes = $uploads->put('file','slider',1024,'image');
$slires = $upRes->getData();
if($slires['status'] == 0){
if($slires['status'] == 0){
$name_path = $slires['url'];
$res = ['code'=>0,'msg'=>'上传flash成功','src'=>$name_path];
} else {
@ -106,13 +147,12 @@ class Slider extends AdminController
*/
public function delete($id)
{
//
$slider = SliderModel::find($id);
$res = $slider->delete();
if($res){
return json(['code'=>0,'msg'=>'删除成功']);
} else {
return json(['code'=>-1,'msg'=>'删除失败']);
}
$slider = SliderModel::find($id);
$res = $slider->delete();
if($res){
return json(['code'=>0,'msg'=>'删除成功']);
} else {
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}

View File

@ -194,7 +194,7 @@
<option value="Bytespider" >头条</option>
<option value="Googlebot" >谷歌</option>
<option value="bingbot" >bing</option>
<option value="" >全部</option>
<option value="''" >全部</option>
</select>
</div>
</div>
@ -257,8 +257,9 @@
,{field: 'time', title: '时间', width:160}
,{field: 'name', title: '名称', width:120, sort: true}
,{field: 'ip', title: 'IP', width:200}
,{field: 'url', title: 'URL', minWidth: 200}
,{field: 'url', title: 'URL', minWidth: 200, templet: '<div><a href="{{d.url}}" target="_blank">{{d.url}}</a></div>'}
]]
,limit: 20
,text: '对不起,加载出现异常!'
});
@ -366,6 +367,9 @@
//执行重载
table.reload('spider', {
where: field
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
return false;

View File

@ -4,23 +4,23 @@
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option value="">链接投放位置</option>
<option value="1">1首页幻灯 - 1126x410</option>
<option value="2">2首页图片</option>
<option value="">链接投放位置</option>
<option value="1">1首页幻灯 - 1126x410</option>
<option value="2">2首页图片</option>
<option value="3">3分类图片</option>
<option value="4">4详情图片</option>
<option value="5">5首页赞助</option>
<option value="5">5首页赞助</option>
<option value="6">6分类赞助</option>
<option value="7">7详情赞助</option>
<option value="8">8温馨通道</option>
<option value="8">8温馨通道</option>
<option value="9">9友情链接</option>
<option value="10">10头部菜单</option>
<option value="11">11页脚链接</option>
</select>
<option value="10">10头部菜单</option>
<option value="11">11页脚链接</option>
</select>
</div>
</div>
<div class="layui-form-item">

View File

@ -7,18 +7,18 @@
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option {if condition="$slider.slid_type eq 1"} selected {/if} value="1">1首页幻灯</option>
<option {if condition="$slider.slid_type eq 2"} selected {/if} value="2">2首页图片</option>
<option {if condition="$slider.slid_type eq 3"} selected {/if} value="3">3分类图片</option>
<option {if condition="$slider.slid_type eq 4"} selected {/if} value="4">4详情图片</option>
<option {if condition="$slider.slid_type eq 5"} selected {/if} value="5">5首页赞助</option>
<option {if condition="$slider.slid_type eq 6"} selected {/if} value="6">6分类赞助</option>
<option {if condition="$slider.slid_type eq 7"} selected {/if} value="7">7详情赞助</option>
<option {if condition="$slider.slid_type eq 8"} selected {/if} value="8">8温馨通道</option>
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="9">9友情链接</option>
<option {if condition="$slider.slid_type eq 1"} selected {/if} value="1">1首页幻灯</option>
<option {if condition="$slider.slid_type eq 2"} selected {/if} value="2">2首页图片</option>
<option {if condition="$slider.slid_type eq 3"} selected {/if} value="3">3分类图片</option>
<option {if condition="$slider.slid_type eq 4"} selected {/if} value="4">4详情图片</option>
<option {if condition="$slider.slid_type eq 5"} selected {/if} value="5">5首页赞助</option>
<option {if condition="$slider.slid_type eq 6"} selected {/if} value="6">6分类赞助</option>
<option {if condition="$slider.slid_type eq 7"} selected {/if} value="7">7详情赞助</option>
<option {if condition="$slider.slid_type eq 8"} selected {/if} value="8">8温馨通道</option>
<option {if condition="$slider.slid_type eq 9"} selected {/if} value="9">9友情链接</option>
<option {if condition="$slider.slid_type eq 10"} selected {/if} value="10">10头部菜单</option>
<option {if condition="$slider.slid_type eq 11"} selected {/if} value="11">11页脚链接</option>
</select>
</select>
</div>
</div>
<div class="layui-form-item">
@ -34,12 +34,12 @@
</div>
<button style="float: left;" type="button" class="layui-btn" dataid="{$slider.id}" id="layuiadmin-upload-slid-img">选图</button>
</div>
<div class="layui-form-item">
<label class="layui-form-label">背景</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="选位置3,4,5请选背景色" autocomplete="off" class="layui-input" value="{$slider.slid_color}" id="color-select">
</div>
<div class="layui-inline" style="left: -11px;">
<div class="layui-form-item">
<label class="layui-form-label">背景</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="选位置3,4,5请选背景色" autocomplete="off" class="layui-input" value="{$slider.slid_color}" id="color-select">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="coloer-form"></div>
</div>
</div>
@ -118,20 +118,13 @@
imgcom.uploads(obj);
}
,done: function(res){
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{icon:6,tiye:2000});
} else {
layer.open({title:"上传失败",content:res.msg,icon:5,anim:6
});
}
}
});
})

View File

@ -8,52 +8,35 @@
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="slid-add">添加</button>
<div class="layui-upload-list">
<table class="layui-table">
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>图片/icon</th>
<th>位置</th>
<th>路径</th>
<th>颜色</th>
<th>开始</th>
<th>结束</th>
<th>状态</th>
<th>操作</th>
</tr></thead>
<tbody id="demoList">
{volist name="slider" id="vo"}
<tr>
<th>{$vo.id}</th>
<th>{$vo.slid_name}</th>
<th>{notempty name="$vo.slid_img"}{if $vo.slid_type == '头部菜单'}<div><i class="layui-icon {$vo.slid_img}"></i></div>{else /}<img src="{$vo.slid_img}" height="40" width="80" />{/if}{/notempty}</th>
<th>{$vo.slid_type}</th>
<th><a href="{$vo.slid_href}" target="_blank">{$vo.slid_href}</a></th>
<th>{$vo.slid_color}</th>
<th>{$vo.slid_start|date='Y-m-d'}</th>
<th>{$vo.slid_over|date='Y-m-d'}</th>
<th>{$vo.slid_status ?'显示':'禁止'}</th>
<th>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id-data="{$vo.id}"><i class="layui-icon layui-icon-edit"></i></a>
{if condition="checkRuleButton('Slider/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" id-data="{$vo.id}"><i class="layui-icon layui-icon-delete"></i></a>
{else /}<a class="layui-btn layui-btn-disabled layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i></a>{/if}
</th>
</tr>
{/volist}
</tbody>
</table>
</div>
<button type="button" class="layui-btn layui-btn-normal" id="slid-add">添加</button>
<div class="layui-form" lay-filter="select_type">位置:
<div class="layui-inline">
<select name="slid_type" lay-verify="required" lay-filter="slid-type">
<option value="">链接投放位置</option>
<option value="1">1首页幻灯</option>
<option value="2">2首页图片</option>
<option value="3">3分类图片</option>
<option value="4">4详情图片</option>
<option value="5">5首页赞助</option>
<option value="6">6分类赞助</option>
<option value="7">7详情赞助</option>
<option value="8">8温馨通道</option>
<option value="9">9友情链接</option>
<option value="10">10头部菜单</option>
<option value="11">11页脚链接</option>
</select>
</div>
</div>
<table id="slider" lay-filter="slider"></table>
<script type="text/html" id="imgTpl">
{{# if(d.slid_type == "头部菜单"){ }}<i class="layui-icon {{d.slid_img}}"></i>{{# } else { }} {{# if(d.slid_img == "") { }}无{{# } else { }} <img src="{{d.slid_img}}" height="40" width="80">{{# } }} {{# } }}
</script>
<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>
</div>
</div>
</div>
@ -69,11 +52,108 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','layer','table','form'], function(){
}).use(['index','layer','table','util','form'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form;
var util = layui.util;
//第一个实例
table.render({
elem: '#slider'
,url: "{:url('slider/list')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'slid_type', title: '位置', width:120}
,{field: 'slid_img', title: '图片/icon', width:150, templet: '#imgTpl'}
,{field: 'slid_name', title: '名称', width:180}
,{field: 'slid_href', title: 'URL', minWidth: 250}
,{field: 'slid_color', title: '颜色', width: 80}
,{field: 'slid_start', title: '开始', width: 150, sort: true}
,{field: 'slid_over', title: '结束', width: 150, sort: true}
,{field: 'slid_status', title: '状态', width: 135}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,limit: 15
,text: '对不起,加载出现异常!'
});
form.on('select(slid-type)', function(data){
$.post("{:url('slider/list')}", {"slid_type":data.value}, function (data){
if (data.code == -1){
layer.open({content:data.msg,icon:5,anim:6});
}
}
);
//执行重载
table.reload('slider', {
where: {slid_type: data.value}
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
//监听行工具事件
table.on('tool(slider)', function(obj){
var data = obj.data;
var id = data.id;
//console.log(obj)
if(obj.event === 'del'){
layer.confirm('真的删除行么', {icon: 3, title:'删除链接?'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.post("{:url('slider/delete')}", {"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);
} else if(obj.event === 'edit'){
layer.open({
type: 2,
title: '编辑链接',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['500px' , '600px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-slider-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('slider/edit')}",
data:{"id":id,"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success: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);
});
submit.trigger('click');
}
});
}
});
//添加幻灯
$('#slid-add').on('click', function(){
layer.open({
@ -81,7 +161,7 @@
title: '添加链接',
content: 'add.html',
maxmin: true,
area : ['460px' , '530px'],
area : ['500px' , '600px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
@ -122,88 +202,6 @@
}
});
});
//编辑广告
$('a[lay-event=edit]').on('click', function(){
var id = $(this).attr('id-data');
layer.open({
type: 2,
title: '编辑链接',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['460px' , '530px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-slider-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('slider/edit')}",
data:{"id":id,"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success: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);
});
submit.trigger('click');
}
});
});
//删除幻灯
$('a[lay-event=del]').on('click', function(){
var id = $(this).attr('id-data');
layer.confirm('确定删除?', {icon: 3, title:'删除幻灯'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('slider/delete')}",
data:{"id":id},
daType:"json",
success: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);
});
});
});
</script>

View File

@ -1,4 +1,13 @@
<?php
/*
* @Author: TaoLer <alipey_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-05-01 17:10:55
* @LastEditors: TaoLer
* @Description: 链接投放优化设置
* @FilePath: \TaoLer\app\common\model\Slider.php
* Copyright (c) 2020~2022 http://www.aieok.com All rights reserved.
*/
namespace app\common\model;
use think\Model;
@ -35,7 +44,7 @@ class Slider extends Model
$sliders = Cache::get('slider'.$type);
if(!$sliders){
$sliders = $this::where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>$type])->whereTime('slid_over','>=',time())->select()->toArray();
Cache::set('slider'.$type,$sliders,3600);
Cache::tag('tagSlider')->set('slider'.$type,$sliders,3600);
}
return $sliders;
}
@ -46,6 +55,7 @@ class Slider extends Model
$result = $this::save($data);
if($result) {
Cache::tag('tagSlider')->clear();
return 1;
} else {
return 'add_error';
@ -58,6 +68,7 @@ class Slider extends Model
$slider = $this::find($data['id']);
$result = $slider->save($data);
if($result) {
Cache::tag('tagSlider')->clear();
return 1;
} else {
return 'edit_error';

View File

@ -32,7 +32,7 @@ class User extends BaseController
//发帖list
public function artList()
{
$article = Article::withCount('comments')->where('user_id',$this->uid)->order('update_time','desc')->paginate(10);
$article = Article::withCount('comments')->where(['user_id'=>$this->uid])->order('update_time','desc')->paginate(10);
//var_dump($article);
$count = $article->total();
$res = [];
@ -198,9 +198,9 @@ class User extends BaseController
//用户发贴
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',$id)->order(['a.create_time'=>'desc'])->cache(3600)->select();
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time,a.status')->where(['a.delete_time'=>0,'a.status'=>1])->where('a.user_id',$id)->order(['a.create_time'=>'desc'])->cache(3600)->select();
//用户回答
$reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time,c.delete_time')->where(['a.delete_time'=>0,'c.delete_time'=>0])->where('c.user_id',$id)->order(['c.create_time'=>'desc'])->cache(3600)->select();
$reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time,c.delete_time,c.status')->where(['a.delete_time'=>0,'c.delete_time'=>0,'c.status'=>1])->where('c.user_id',$id)->order(['c.create_time'=>'desc'])->cache(3600)->select();
View::assign(['u'=>$u,'arts'=>$arts,'reys'=>$reys,'jspage'=>'']);
return View::fetch();

View File

@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'bb712c71c521dd5acc4656bb49ff90285de07458',
'reference' => '334c91212372abf2e9a2441668700e9a794b635d',
'name' => 'taoser/taoler',
'dev' => true,
),
@ -160,7 +160,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'bb712c71c521dd5acc4656bb49ff90285de07458',
'reference' => '334c91212372abf2e9a2441668700e9a794b635d',
'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-29 17:39:41
// This file is automatically generated at:2022-05-04 14:24:24
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -12,37 +12,38 @@
<ul class="fly-list">
{volist name="artList['data']" id="art"}
<li>
<a href="{:url('user/home',['id'=>$art.user.id])}" class="fly-avatar">
<img src="{$art.user.user_img}" alt="{$art.user.name}">
</a>
<a href="{:url('user/home',['id'=>$art.user.id])}" class="fly-avatar"><img src="{$art.user.user_img}" alt="{$art.user.name}"></a>
<h2>
{if config('taoler.config.cate_show') == 1}<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>{/if}
<a href="{:url('article/detail',['id' => $art.id])}" style="color:{$art.title_color};">{$art.title}</a>
</h2>
<div class="fly-list-info">
<a href="{:url('user/home',['id'=>$art.user.id])}" link>
{if config('taoler.config.area_show') == 1}<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>{/if}
<cite>{$art.user.nickname ?: $art.user.name}</cite>
<i>{$art.create_time|date='Y-m-d'}</i>
{if config('taoler.config.area_show') == 1}
<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>
{/if}
<cite>{$art.user.nickname ?: $art.user.name}</cite>
<i>{$art.create_time|date='Y-m-d'}</i>
</a>
<span>
{$art.has_img ?= ' <i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
{$art.has_video ?= ' <i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
{$art.has_audio ?= ' <i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
</span>
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span>
<span class="fly-list-nums">
<i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}
{$art.has_img ?= ' <i class="layui-icon layui-icon-picture" style=" color: #5FB878;"></i>'}
{$art.has_video ?= ' <i class="layui-icon layui-icon-play" style="color: #FF5722;"></i>'}
{$art.has_audio ?= ' <i class="layui-icon layui-icon-speaker" style="color: #000000;"></i>'}
{$art.upzip ?= ' <i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i>'}
</span>
<span class="layui-hide-xs" title="浏览"><i class="iconfont" title="浏览">&#xe60b;</i> {$art.pv}</span>
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$art.comments_count}</span>
</div>
<div class="fly-list-badge">
{if ($art.is_hot == 1)}<i class="layui-icon layui-icon-fire layui-hide-md" style="font-size: 20px; color: #FF5722;"></i><span class="layui-badge layui-bg-red layui-hide-xs">{:lang('hot')}</span> {/if}
{if ($art.is_hot == 1)}
<i class="layui-icon layui-icon-fire layui-hide-md" style="font-size: 20px; color: #FF5722;"></i>
<span class="layui-badge layui-bg-red layui-hide-xs">{:lang('hot')}</span>
{/if}
</div>
</li>
{/volist}
</ul>
<div style="text-align: center" id="pages"></div>
<div style="text-align: center" id="pages"></div>
</div>
</div>
<div class="layui-col-md3">
@ -56,21 +57,21 @@
<dl class="fly-panel fly-list-one layui-hide-xs">
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
{volist name="artHot" id="vo"}
<dd>
<dd>
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
</dd>
{/volist}
</dl>
{/volist}
</dl>
<div class="fly-panel">
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
<a href="" class="fly-link fly-joinad ">{:lang('i want to join')}</a>
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
</div>
<div class="fly-panel-main">
{volist name="ad_comm" id="vo"}
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
{/volist}
{volist name="ad_comm" id="vo"}
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: '{$vo.slid_color}';">{$vo.slid_name}</a>
{/volist}
</div>
</div>
</div>

View File

@ -25,9 +25,10 @@
<div class="detail-body photos" style="font-size: 18px;line-height: 200%;" id="content">{$article.content}</div>
</div>
<div class="fly-panel detail-box" >
{//管理}
{//管理}
{if (($article.upzip !== '') || session('?user_name'))}
<div class="fly-panel detail-box" >
<div class="detail-assist">
{notempty name="$article.upzip"}
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
@ -40,7 +41,6 @@
{else /}
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>
{/if}
{if($article.is_hot == 0)}
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
{else /}
@ -58,8 +58,9 @@
{/if}
</div>
</div>
{/if}
</div>
{/if}
</div>
</div>

View File

@ -46,9 +46,9 @@
<div class="detail-body photos" id="content">{$article.content}</div>
</div>
{//管理}
{if (($article.upzip !== '') || session('?user_name'))}
<div class="fly-panel detail-box" >
{//管理}
{if (($article.upzip !== '') || session('?user_name'))}
<div class="detail-assist">
{notempty name="$article.upzip"}
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
@ -78,8 +78,9 @@
{/if}
</div>
</div>
{/if}
</div>
{/if}
{//评论}
<div class="fly-panel detail-box" id="flyReply">