1.9.10
This commit is contained in:
parent
cea9984bfc
commit
f17b24122f
@ -6,6 +6,12 @@ namespace app;
|
||||
use think\App;
|
||||
use think\exception\ValidateException;
|
||||
use think\Validate;
|
||||
use think\Response;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use think\facade\Lang;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* 控制器基础类
|
||||
@ -187,4 +193,94 @@ abstract class BaseController
|
||||
}
|
||||
|
||||
|
||||
//显示网站设置
|
||||
protected function getSystem()
|
||||
{
|
||||
//1.系统配置信息
|
||||
return Db::name('system')->cache('system',3600)->find(1);
|
||||
|
||||
}
|
||||
|
||||
//域名协议转换 把数据库中的带HTTP或不带协议的域名转换为当前协议的域名前缀
|
||||
protected function getHttpUrl($url)
|
||||
{
|
||||
//域名转换为无http协议
|
||||
$www = stripos($url,'://') ? substr(stristr($url,'://'),3) : $url;
|
||||
$htpw = Request::scheme().'://'. $www;
|
||||
return $htpw;
|
||||
}
|
||||
|
||||
//得到当前系统安装前台域名
|
||||
protected function getIndexUrl()
|
||||
{
|
||||
$sys = $this->getSystem();
|
||||
$domain = $this->getHttpUrl($sys['domain']);
|
||||
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
||||
$runTime = $this->getRunTime();
|
||||
View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
||||
return $domain;
|
||||
}
|
||||
|
||||
protected function getRunTime()
|
||||
{
|
||||
//运行时间
|
||||
$now = time();
|
||||
$sys = $this->getSystem();
|
||||
$count = $now-$sys['create_time'];
|
||||
$days = floor($count/86400);
|
||||
$hos = floor(($count%86400)/3600);
|
||||
$mins = floor(($count%3600)/60);
|
||||
$years = floor($days/365);
|
||||
if($years >= 1){
|
||||
$days = floor($days%365);
|
||||
}
|
||||
$runTime = $years ? "{$years}年{$days}天{$hos}时{$mins}分" : "{$days}天{$hos}时{$mins}分";
|
||||
return $runTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章链接地址
|
||||
*
|
||||
* @param integer $aid
|
||||
* @return string
|
||||
*/
|
||||
protected function getRouteUrl(int $aid) : string
|
||||
{
|
||||
$indexUrl = $this->getIndexUrl();
|
||||
$artUrl = (string) url('detail_id', ['id' => $aid]);
|
||||
|
||||
// 判断是否开启绑定
|
||||
//$domain_bind = array_key_exists('domain_bind',config('app'));
|
||||
|
||||
// 判断index应用是否绑定域名
|
||||
$bind_index = array_search('index',config('app.domain_bind'));
|
||||
// 判断admin应用是否绑定域名
|
||||
$bind_admin = array_search('admin',config('app.domain_bind'));
|
||||
|
||||
// 判断index应用是否域名映射
|
||||
$map_index = array_search('index',config('app.app_map'));
|
||||
// 判断admin应用是否域名映射
|
||||
$map_admin = array_search('admin',config('app.app_map'));
|
||||
|
||||
$index = $map_index ? $map_index : 'index'; // index应用名
|
||||
$admin = $map_admin ? $map_admin : 'admin'; // admin应用名
|
||||
|
||||
if($bind_index) {
|
||||
// index绑定域名
|
||||
$url = $indexUrl . str_replace($admin.'/','',$artUrl);
|
||||
} else { // index未绑定域名
|
||||
// admin绑定域名
|
||||
if($bind_admin) {
|
||||
$url = $indexUrl .'/' . $index . $artUrl;
|
||||
} else {
|
||||
$url = $indexUrl . str_replace($admin,$index,$artUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,17 +3,13 @@
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\AdminController;
|
||||
use app\admin\validate\Admin;
|
||||
use app\admin\model\Admin as adminModel;
|
||||
use app\common\model\Cate;
|
||||
use app\common\model\Comment;
|
||||
use app\common\model\Article;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
use think\facade\Session;
|
||||
use think\facade\Cache;
|
||||
use think\exception\ValidateException;
|
||||
use taoler\com\Files;
|
||||
|
||||
class Forum extends AdminController
|
||||
@ -117,32 +113,22 @@ class Forum extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
//置顶帖子
|
||||
public function top()
|
||||
{
|
||||
//
|
||||
}
|
||||
//加精帖子
|
||||
public function hot()
|
||||
{
|
||||
//
|
||||
}
|
||||
//审核帖子
|
||||
/**
|
||||
* 置顶、加精、评论开关,审核等状态管理
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$data = Request::only(['id','status']);
|
||||
|
||||
$param = Request::only(['id','name','value']);
|
||||
$data = ['id'=>$param['id'],$param['name']=>$param['value']];
|
||||
//获取状态
|
||||
$res = Db::name('article')->where('id',$data['id'])->save(['status' => $data['status']]);
|
||||
$res = Db::name('article')->save($data);
|
||||
Cache::delete('article_'.$data['id']);
|
||||
if($res){
|
||||
if($data['status'] == 1){
|
||||
return json(['code'=>0,'msg'=>'帖子审核通过','icon'=>6]);
|
||||
} else {
|
||||
return json(['code'=>0,'msg'=>'帖子被禁止','icon'=>5]);
|
||||
}
|
||||
|
||||
return json(['code'=>0,'msg'=>'设置成功','icon'=>6]);
|
||||
}else {
|
||||
return json(['code'=>-1,'msg'=>'审核出错']);
|
||||
return json(['code'=>-1,'msg'=>'失败啦','icon'=>6]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* @Author: TaoLer <alipey_tao@qq.com>
|
||||
* @Date: 2022-04-13 09:54:31
|
||||
* @LastEditTime: 2022-05-07 12:00:01
|
||||
* @LastEditTime: 2022-05-12 16:21:33
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\app\admin\controller\Seo.php
|
||||
@ -60,8 +60,7 @@ class Seo extends AdminController
|
||||
$urls[] = $this->getRouteUrl($aid);
|
||||
}
|
||||
// 百度接口单次最大提交200,进行分组
|
||||
$urls = array_chunk($urls,2000);
|
||||
|
||||
$urls = array_chunk($urls,2000);
|
||||
$api = config('taoler.baidu.push_api');
|
||||
$ch = curl_init();
|
||||
foreach($urls as $url) {
|
||||
|
@ -49,38 +49,21 @@
|
||||
<div style="padding-bottom: 10px;">
|
||||
<button class="layui-btn layuiadmin-btn-forum-list" data-type="batchdel">删除</button>
|
||||
</div>
|
||||
<table id="LAY-app-forum-list" lay-filter="LAY-app-forum-list" ></table>
|
||||
<script type="text/html" id="imgTpl">
|
||||
<img style="display: inline-block; width: 50%; height: 100%;" src= "{{ d.avatar }}">
|
||||
</script>
|
||||
<script type="text/html" id="title">
|
||||
<a href="{{ d.url }}" target="_blank">{{d.title}}</a>
|
||||
<table id="LAY-app-forum-list" lay-filter="LAY-app-forum-list" ></table>
|
||||
<script type="text/html" id="avatarTpl">
|
||||
<div><img style="width: 25px; height: 25px;" src= "{{ d.avatar }}"></div>
|
||||
</script>
|
||||
<script type="text/html" id="buttonTpl">
|
||||
{{# if(d.top == 1){ }}
|
||||
<button class="layui-btn layui-btn-xs">是</button>
|
||||
{{# } else { }}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-xs">否</button>
|
||||
{{# } }}
|
||||
</script>
|
||||
<script type="text/html" id="buttonHot">
|
||||
{{# if(d.hot == 1){ }}
|
||||
<button class="layui-btn layui-btn-xs">是</button>
|
||||
{{# } else { }}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-xs">否</button>
|
||||
{{# } }}
|
||||
<input type="checkbox" name="is_top" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="isTop" {{ d.top == 1 ? 'checked' : '' }}>
|
||||
</script>
|
||||
<script type="text/html" id="buttonReply">
|
||||
{{# if(d.reply == 1){ }}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-xs">否</button>
|
||||
{{# } else { }}
|
||||
<button class="layui-btn layui-btn-xs">禁</button>
|
||||
{{# } }}
|
||||
<script type="text/html" id="buttonHot">
|
||||
<input type="checkbox" name="is_hot" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="isHot" {{ d.hot == 1 ? 'checked' : '' }}>
|
||||
</script>
|
||||
<script type="text/html" id="buttonCheck">
|
||||
{if condition="checkRuleButton('forum/check')"}
|
||||
<input type="checkbox" name="check" lay-skin="switch" lay-filter="forumcheck" lay-text="通过|{{# if(d.check == -1){ }}禁止{{# } }} {{# if(d.check == 0){ }}待审{{# } }}" {{# 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 type="text/html" id="buttonReply">
|
||||
<input type="checkbox" name="is_reply" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="isReply" {{ d.reply == 0 ? 'checked' : '' }}>
|
||||
</script>
|
||||
<script type="text/html" id="buttonCheck">
|
||||
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-filter="artStatus" lay-text="通过|{{ d.check == 0 ? '待审' : '禁止' }}" {{ d.check == 1 ? 'checked' : '' }}>
|
||||
</script>
|
||||
<script type="text/html" id="table-forum-list">
|
||||
{if condition="checkRuleButton('forum/listdel')"}
|
||||
@ -96,108 +79,106 @@
|
||||
|
||||
{block name="js"}
|
||||
<script>
|
||||
var forumList = "{:url('Forum/list')}",
|
||||
forumListdel = "{:url('Forum/listdel')}",
|
||||
forumListform = "{:url('Forum/listform')}",
|
||||
forumReplys = "{:url('Forum/replys')}",
|
||||
forumRedel = "{:url('Forum/redel')}",
|
||||
var forumList = "{:url('Forum/list')}",
|
||||
forumListdel = "{:url('Forum/listdel')}",
|
||||
forumListform = "{:url('Forum/listform')}",
|
||||
forumReplys = "{:url('Forum/replys')}",
|
||||
forumRedel = "{:url('Forum/redel')}",
|
||||
forumReplysform = "{:url('Forum/replysform')}",
|
||||
forumTags = "{:url('Forum/tags')}",
|
||||
forumTags = "{:url('Forum/tags')}",
|
||||
forumTagsDelete = "{:url('Forum/tagsdelete')}",
|
||||
forumTagsForm = "{:url('Forum/tagsform')}";
|
||||
layui.config({
|
||||
base: '/static/admin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'forum', 'table'], function(){
|
||||
var $ = layui.$
|
||||
,form = layui.form
|
||||
,table = layui.table;
|
||||
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-forumlist-search)', function(data){
|
||||
var field = data.field;
|
||||
$.post("{:url('Forum/list')}",field);
|
||||
//执行重载
|
||||
table.reload('LAY-app-forum-list', {
|
||||
where: field
|
||||
});
|
||||
});
|
||||
|
||||
//事件
|
||||
var active = {
|
||||
batchdel: function(){
|
||||
var checkStatus = table.checkStatus('LAY-app-forum-list')
|
||||
,checkData = checkStatus.data; //得到选中的数据
|
||||
|
||||
if(checkData.length === 0){
|
||||
return layer.msg('请选择数据');
|
||||
}
|
||||
|
||||
layer.confirm('确定删除吗?', function(index) {
|
||||
|
||||
//获取所选id
|
||||
var idsArray = [];
|
||||
for (var i = 0; i < checkData.length; i++) {
|
||||
idsArray.push(checkData[i].id);
|
||||
}
|
||||
|
||||
var ids = idsArray.toString();
|
||||
//console.log(ids);
|
||||
|
||||
//执行 Ajax 后重载
|
||||
|
||||
$.post("{:url('Forum/listdel')}",{"id": ids},function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg('删除成功', {
|
||||
icon: 1
|
||||
,shade: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
//,……
|
||||
);
|
||||
|
||||
table.reload('LAY-app-forum-list');
|
||||
layer.msg('已删除');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//监听帖子审核
|
||||
form.on('switch(forumcheck)', function(data){
|
||||
var data= data.elem;
|
||||
status = data.checked ? 1 : -1;
|
||||
//执行帖子审核
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Forum/check')}",
|
||||
data:{id:data.id,status:status},
|
||||
dataType:'json',
|
||||
success:function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{
|
||||
icon:res.icon,
|
||||
time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({
|
||||
title:'审核失败',
|
||||
content:res.msg,
|
||||
icon:5,
|
||||
adim:6
|
||||
})
|
||||
}
|
||||
table.reload('LAY-app-forum-list');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.layui-btn.layuiadmin-btn-forum-list').on('click', function(){
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
forumTagsForm = "{:url('Forum/tagsform')}";
|
||||
layui.config({
|
||||
base: '/static/admin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'forum', 'table'], function(){
|
||||
var $ = layui.$
|
||||
,form = layui.form
|
||||
,table = layui.table;
|
||||
|
||||
// 监听搜索
|
||||
form.on('submit(LAY-app-forumlist-search)', function(data){
|
||||
var field = data.field;
|
||||
$.post("{:url('Forum/list')}",field);
|
||||
//执行重载
|
||||
table.reload('LAY-app-forum-list', {
|
||||
where: field
|
||||
});
|
||||
});
|
||||
|
||||
// 监听置顶
|
||||
form.on('switch(isTop)', function(obj){
|
||||
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value:obj.elem.checked ? 1 : 0},function(res){
|
||||
layer.tips(obj.value + ' ' + obj.elem.name + ':'+ obj.elem.checked, obj.othis);
|
||||
});
|
||||
});
|
||||
|
||||
// 监听加精
|
||||
form.on('switch(isHot)', function(obj){
|
||||
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 1 : 0},function(res){
|
||||
layer.tips(obj.value + ' ' + obj.elem.name + ':'+ obj.elem.checked, obj.othis);
|
||||
});
|
||||
});
|
||||
|
||||
// 监听回复
|
||||
form.on('switch(isReply)', function(obj){
|
||||
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 0 : 1},function(res){
|
||||
layer.tips(obj.value + ' ' + obj.elem.name + ':'+ obj.elem.checked, obj.othis);
|
||||
});
|
||||
});
|
||||
|
||||
// 监听审贴
|
||||
form.on('switch(artStatus)', function(obj){
|
||||
//layer.tips(obj.value + ' ' + obj.elem.name + ':'+ obj.elem.checked, obj.othis);
|
||||
$.post("{:url('Forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 1 : -1},function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg,{icon:res.icon,time:2000})
|
||||
} else {
|
||||
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
||||
}
|
||||
});
|
||||
//执行重载
|
||||
table.reload('LAY-app-forum-list', {
|
||||
where: field
|
||||
});
|
||||
});
|
||||
|
||||
//事件
|
||||
var active = {
|
||||
batchdel: function(){
|
||||
var checkStatus = table.checkStatus('LAY-app-forum-list')
|
||||
,checkData = checkStatus.data; //得到选中的数据
|
||||
|
||||
if(checkData.length === 0){
|
||||
return layer.msg('请选择数据');
|
||||
}
|
||||
|
||||
layer.confirm('确定删除吗?', function(index) {
|
||||
//获取所选id
|
||||
var idsArray = [];
|
||||
for (var i = 0; i < checkData.length; i++) {
|
||||
idsArray.push(checkData[i].id);
|
||||
}
|
||||
var ids = idsArray.toString();
|
||||
|
||||
//执行 Ajax 后重载
|
||||
$.post("{:url('Forum/listdel')}",{"id": ids},function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg('删除成功', {icon: 1,shade: 0});
|
||||
}
|
||||
});
|
||||
|
||||
table.reload('LAY-app-forum-list');
|
||||
layer.msg('已删除');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.layui-btn.layuiadmin-btn-forum-list').on('click', function(){
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
@ -123,7 +123,7 @@
|
||||
<div class="layui-input-inline" style="width: 400px;">
|
||||
<input type="text" name="copyright" value="{$sysInfo.copyright}" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline layui-input-company">提示:</div>
|
||||
<div class="layui-input-inline layui-input-company">提示</div>
|
||||
<div class="layui-form-mid layui-word-aux">未授权版本,不限制功能,但严禁私自改写此处版权脚本,一旦发现,永久关闭升级服务!!</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
|
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:50
|
||||
* @LastEditTime: 2022-05-12 16:02:40
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\app\common\controller\AdminController.php
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
*/
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\controller;
|
||||
@ -92,93 +101,6 @@ class AdminController extends \app\BaseController
|
||||
return true;
|
||||
}
|
||||
|
||||
//显示网站设置
|
||||
protected function getSystem()
|
||||
{
|
||||
//1.系统配置信息
|
||||
return Db::name('system')->cache('system',3600)->find(1);
|
||||
|
||||
}
|
||||
|
||||
//域名协议转换 把数据库中的带HTTP或不带协议的域名转换为当前协议的域名前缀
|
||||
protected function getHttpUrl($url)
|
||||
{
|
||||
//域名转换为无http协议
|
||||
$www = stripos($url,'://') ? substr(stristr($url,'://'),3) : $url;
|
||||
$htpw = Request::scheme().'://'. $www;
|
||||
return $htpw;
|
||||
}
|
||||
|
||||
//得到当前系统安装前台域名
|
||||
protected function getIndexUrl()
|
||||
{
|
||||
$sys = $this->getSystem();
|
||||
$domain = $this->getHttpUrl($sys['domain']);
|
||||
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
||||
$runTime = $this->getRunTime();
|
||||
View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
||||
return $domain;
|
||||
}
|
||||
|
||||
protected function getRunTime()
|
||||
{
|
||||
//运行时间
|
||||
$now = time();
|
||||
$sys = $this->getSystem();
|
||||
$count = $now-$sys['create_time'];
|
||||
$days = floor($count/86400);
|
||||
$hos = floor(($count%86400)/3600);
|
||||
$mins = floor(($count%3600)/60);
|
||||
$years = floor($days/365);
|
||||
if($years >= 1){
|
||||
$days = floor($days%365);
|
||||
}
|
||||
$runTime = $years ? "{$years}年{$days}天{$hos}时{$mins}分" : "{$days}天{$hos}时{$mins}分";
|
||||
return $runTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章链接地址
|
||||
*
|
||||
* @param integer $aid
|
||||
* @return string
|
||||
*/
|
||||
protected function getRouteUrl(int $aid) : string
|
||||
{
|
||||
$indexUrl = $this->getIndexUrl();
|
||||
$artUrl = (string) url('detail_id', ['id' => $aid]);
|
||||
|
||||
// 判断是否开启绑定
|
||||
//$domain_bind = array_key_exists('domain_bind',config('app'));
|
||||
|
||||
// 判断index应用是否绑定域名
|
||||
$bind_index = array_search('index',config('app.domain_bind'));
|
||||
// 判断admin应用是否绑定域名
|
||||
$bind_admin = array_search('admin',config('app.domain_bind'));
|
||||
|
||||
// 判断index应用是否域名映射
|
||||
$map_index = array_search('index',config('app.app_map'));
|
||||
// 判断admin应用是否域名映射
|
||||
$map_admin = array_search('admin',config('app.app_map'));
|
||||
|
||||
$index = $map_index ? $map_index : 'index'; // index应用名
|
||||
$admin = $map_admin ? $map_admin : 'admin'; // admin应用名
|
||||
|
||||
if($bind_index) {
|
||||
// index绑定域名
|
||||
$url = $indexUrl . str_replace($admin.'/','',$artUrl);
|
||||
} else { // index未绑定域名
|
||||
// admin绑定域名
|
||||
if($bind_admin) {
|
||||
$url = $indexUrl .'/' . $index . $artUrl;
|
||||
} else {
|
||||
$url = $indexUrl . str_replace($admin,$index,$artUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -205,16 +205,24 @@ class Article extends BaseController
|
||||
$article = new ArticleModel();
|
||||
$result = $article->add($data);
|
||||
if ($result['code'] == 1) {
|
||||
// 获取到的最新ID
|
||||
$aid = Db::name('article')->max('id');
|
||||
// 清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
// 发提醒邮件
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
||||
|
||||
if(Config::get('taoler.config.posts_check')){
|
||||
$aid = Db::name('article')->max('id');
|
||||
$link = (string)url('article/detail', ['id' => $aid]);
|
||||
}else{
|
||||
$link = (string)url('index/');
|
||||
}
|
||||
// 清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
||||
$res = Msgres::success($result['msg'], $link);
|
||||
// 推送给百度收录接口
|
||||
if(empty(config('taoler.baidu.push_api'))) {
|
||||
$this->baiduPush($aid);
|
||||
}
|
||||
|
||||
$res = Msgres::success($result['msg'], $link);
|
||||
} else {
|
||||
$res = Msgres::error('add_error');
|
||||
}
|
||||
@ -261,6 +269,10 @@ class Article extends BaseController
|
||||
//删除原有缓存显示编辑后内容
|
||||
Cache::delete('article_'.$id);
|
||||
$link = (string) url('article/detail',['id'=> $id]);
|
||||
// 推送给百度收录接口
|
||||
if(empty(config('taoler.baidu.push_api'))) {
|
||||
$this->baiduPush($data['id']);
|
||||
}
|
||||
$editRes = Msgres::success('edit_success',$link);
|
||||
} else {
|
||||
$editRes = Msgres::error($result);
|
||||
@ -541,11 +553,35 @@ class Article extends BaseController
|
||||
$tag = Config::get('taglink');
|
||||
if(count($tag)) {
|
||||
foreach($tag as $key=>$value) {
|
||||
$content = str_replace("$key", 'a('.$value.')['.$key.']',$content);
|
||||
// 匹配所有
|
||||
//$content = str_replace("$key", 'a('.$value.')['.$key.']',$content);
|
||||
// 限定匹配数量
|
||||
$content = preg_replace('/'.$key.'/','a('.$value.')['.$key.']',$content,2);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
// baidu push api
|
||||
protected function baiduPush($id)
|
||||
{
|
||||
// baidu 接口
|
||||
$api = config('taoler.baidu.push_api');
|
||||
$artUrl = $this->getRouteUrl((int)$id);
|
||||
$url = [$artUrl];
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
CURLOPT_URL => $api,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POSTFIELDS => implode("\n", $url),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||
);
|
||||
curl_setopt_array($ch, $options);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +1,25 @@
|
||||
|
||||
|
||||
layui.define(['table', 'form'], function(exports){
|
||||
var $ = layui.$
|
||||
,table = layui.table
|
||||
,form = layui.form;
|
||||
|
||||
//帖子管理
|
||||
table.render({
|
||||
var forms = table.render({
|
||||
elem: '#LAY-app-forum-list'
|
||||
,url: forumList //帖子数据接口
|
||||
,cols: [[
|
||||
{type: 'checkbox'}
|
||||
,{field: 'id', width: 60, title: 'ID', sort: true}
|
||||
,{field: 'poster', title: '贴主',width: 100}
|
||||
,{field: 'avatar', title: '头像', width: 80, templet: '#imgTpl'}
|
||||
,{field: 'title', title: '标题', mWidth: 200,templet: '#title'}
|
||||
,{field: 'content', title: '内容', mWidth: 200}
|
||||
,{field: 'poster', title: '账号',width: 80}
|
||||
,{field: 'avatar', title: '头像', width: 60, templet: '#avatarTpl'}
|
||||
,{field: 'title', title: '标题', minWidth: 180,templet: '<div><a href="{{ d.url }}" target="_blank">{{d.title}}</a></div>'}
|
||||
,{field: 'content', title: '内容', minWidth: 200}
|
||||
,{field: 'posttime', title: '时间',width: 120, sort: true}
|
||||
,{field: 'top', title: '置顶', templet: '#buttonTpl', width: 80, align: 'center'}
|
||||
,{field: 'hot', title: '加精', templet: '#buttonHot', width: 80, align: 'center'}
|
||||
,{field: 'reply', title: '禁评', templet: '#buttonReply', width: 80, align: 'center'}
|
||||
,{field: 'check', title: '审帖', templet: '#buttonCheck', width: 100, align: 'center'}
|
||||
,{field: 'check', title: '审帖', templet: '#buttonCheck', width: 95, align: 'center'}
|
||||
,{title: '操作', width: 60, align: 'center', toolbar: '#table-forum-list'}
|
||||
]]
|
||||
,page: true
|
||||
@ -34,29 +34,29 @@ layui.define(['table', 'form'], function(exports){
|
||||
if(obj.event === 'del'){
|
||||
layer.confirm('确定删除此条帖子?', function(index){
|
||||
//obj.del();
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:forumListdel,
|
||||
data:{id:data.id},
|
||||
dataType:'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,
|
||||
adim:6
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:forumListdel,
|
||||
data:{id:data.id},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{
|
||||
icon:6,
|
||||
time:2000
|
||||
},function(){
|
||||
forms.reload();
|
||||
});
|
||||
} else {
|
||||
layer.open({
|
||||
title:'删除失败',
|
||||
content:data.msg,
|
||||
icon:5,
|
||||
adim:6
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
} else if(obj.event === 'edit'){
|
||||
@ -74,8 +74,8 @@ layui.define(['table', 'form'], function(exports){
|
||||
,submitID = 'LAY-app-forum-submit'
|
||||
,submit = layero.find('iframe').contents().find("#layuiadmin-form-list")
|
||||
,poster = submit.find('input[name="poster"]').val()
|
||||
,content = submit.find('input[name="content"]').val()
|
||||
,avatar = submit.find('input[name="avatar"]').val();
|
||||
,content = submit.find('input[name="content"]').val()
|
||||
,avatar = submit.find('input[name="avatar"]').val();
|
||||
|
||||
//监听提交
|
||||
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
|
||||
@ -132,7 +132,7 @@ layui.define(['table', 'form'], function(exports){
|
||||
,{field: 'avatar', title: '头像', width: 80, templet: '#imgTpl'}
|
||||
,{field: 'content', title: '评论', minWidth: 200}
|
||||
,{field: 'replytime', title: '回复时间', width: 120, sort: true}
|
||||
,{field: 'check', title: '审核', templet: '#buttonCheck', width: 100}
|
||||
,{field: 'check', title: '审核', templet: '#buttonCheck', width: 100}
|
||||
,{title: '操作', width: 60, align: 'center', toolbar: '#table-forum-replys'}
|
||||
]]
|
||||
,page: true
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
images压缩扩展模块
|
||||
changlin_zhao@qq.com
|
||||
2021.5.25
|
||||
|
@ -216,8 +216,42 @@
|
||||
});
|
||||
|
||||
// 获取描述的内容
|
||||
$("#L_content").bind('input propertychange', function(){
|
||||
var content = $(this).val()
|
||||
// $("#L_content111").bind('input propertychange', function(){
|
||||
// var content = $(this).val();
|
||||
// setTimeout(function(){
|
||||
// $.ajax({
|
||||
// type:"post",
|
||||
// url:"{:url('article/getDescription')}",
|
||||
// data:{"content":content},
|
||||
// daType:"json",
|
||||
// success:function (data){
|
||||
// if (data.code == 0) {
|
||||
// $('[name="description"]').val(data.data);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }, 5000)
|
||||
// return false;
|
||||
// })
|
||||
|
||||
// 获取描述的内容 非实时获取,停止输入后获取
|
||||
var flag = false;
|
||||
var othis = $('#L_content');
|
||||
othis.on('compositionstart',function(){
|
||||
flag = true;
|
||||
})
|
||||
othis.on('compositionend',function(){
|
||||
flag = false;
|
||||
desc(othis.val());
|
||||
|
||||
})
|
||||
|
||||
// othis.on('input', function (event) {
|
||||
// // 忽略一切非直接输入,不做逻辑处理
|
||||
// if (!flag) todo(event.target.value);
|
||||
// });
|
||||
|
||||
function desc(content){
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/getDescription')}",
|
||||
@ -228,9 +262,8 @@
|
||||
$('[name="description"]').val(data.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 手动添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
|
@ -1,3 +1,12 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-11 12:01:15
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\error\404.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}404 - {$sysInfo.webname}{/block}
|
||||
@ -9,7 +18,7 @@
|
||||
<div class="fly-panel">
|
||||
<div class="fly-none">
|
||||
<h2><i class="iconfont icon-404"></i></h2>
|
||||
<p>页面或者数据被<a href="http://www.aieok.com"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
||||
<p>页面或者数据被<a href="{$Request.domain}"> 纸飞机 </a>运到火星了,啥都看不到了…</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -19,11 +28,11 @@
|
||||
<script>
|
||||
layui.cache.page = 'user';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
username: "{$user.name??'游客'}"
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
,avatar: "{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}"
|
||||
,experience: "{$user.point ?? ''}"
|
||||
,sex: "{$user.sex ? '女':'男'}"
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
|
@ -1,12 +1,3 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-10 13:12:36
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\login\reg.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
{extend name="public:base" /}
|
||||
|
||||
{block name="title"}注册账号{/block}
|
||||
|
@ -1,3 +1,12 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-11 07:38:52
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\public\base.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -45,20 +54,20 @@
|
||||
{block name="content"}内容{/block}
|
||||
{include file="public/footer" /}
|
||||
<script>
|
||||
layui.cache.page = '{$jspage}';
|
||||
layui.cache.user = {
|
||||
username: "{$user.name??'游客'}"
|
||||
,uid: "{$user.id ?? -1}"
|
||||
,avatar: '/static/res/images/avatar/00.jpg'
|
||||
,experience: "{$user.point ?? ''}"
|
||||
,sex: "{$user.sex ? '女':'男'}"
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
layui.cache.page = '{$jspage}';
|
||||
layui.cache.user = {
|
||||
username: "{$user.name??'游客'}"
|
||||
,uid: "{$user.id ?? -1}"
|
||||
,avatar: '/static/res/images/avatar/00.jpg'
|
||||
,experience: "{$user.point ?? ''}"
|
||||
,sex: "{$user.sex ? '女':'男'}"
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '{$Request.domain}/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{block name="script"}{/block}
|
||||
</body>
|
||||
|
@ -1,12 +1,3 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-10 12:45:43
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\public\column.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
<div class="fly-panel fly-column layui-hide-xs">
|
||||
<div class="layui-container">
|
||||
<ul class="layui-clear">
|
||||
|
@ -1,12 +1,3 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-10 12:49:45
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\public\filter.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
<div class="fly-panel-title fly-filter">
|
||||
<a href="{$Request.domain}{:url('cate_type',['ename' => $Request.param.ename,'type' => 'all'])} " {if condition="$type eq 'all'" } class="layui-this" {/if} >{:lang('all')}</a>
|
||||
<span class="fly-mid"></span>
|
||||
|
@ -1,12 +1,3 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-10 12:49:25
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\public\footer.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
<div class="fly-footer html5plus-hide">
|
||||
<p>
|
||||
Copyright © {:date('Y')}{$sysInfo.copyright|raw}v{:config('taoler.version')}
|
||||
|
@ -28,11 +28,11 @@
|
||||
<cite class="layui-hide-xs">{$user.name}</cite><img src="{$Request.domain}{$user.user_img}">
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="{:url('user/index')}"><i class="layui-icon"></i>{:lang('user center')}</a></dd>
|
||||
<dd><a href="{:url('user/set')}"><i class="layui-icon"></i>{:lang('set info')}</a></dd>
|
||||
<dd><a href="{$Request.domain}{:url('user/index')}"><i class="layui-icon"></i>{:lang('user center')}</a></dd>
|
||||
<dd><a href="{$Request.domain}{:url('user/set')}"><i class="layui-icon"></i>{:lang('set info')}</a></dd>
|
||||
<hr>
|
||||
<dd><a href="{:url('user/message')}"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>{:lang('my message')}</a></dd>
|
||||
<dd><a href="{:url('user/home',['id'=>session('user_id')])}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;"></i>{:lang('my page')}</a></dd>
|
||||
<dd><a href="{$Request.domain}{:url('user/message')}"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>{:lang('my message')}</a></dd>
|
||||
<dd><a href="{$Request.domain}{:url('user/home',['id'=>session('user_id')])}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;"></i>{:lang('my page')}</a></dd>
|
||||
<hr style="margin: 5px 0;">
|
||||
<dd><a data-url="{:url('user/logout')}" href="javascript:void(0)" class="logi_logout" style="text-align: center;">{:lang('logout')}</a></dd>
|
||||
</dl>
|
||||
@ -40,13 +40,13 @@
|
||||
{else /}
|
||||
<!-- 未登入的状态 -->
|
||||
<li class="layui-nav-item">
|
||||
<a class="iconfont icon-touxiang" href="{:url('login/index')}"></a>
|
||||
<a class="iconfont icon-touxiang" href="{$Request.domain}{:url('login/index')}"></a>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-hide-xs">
|
||||
<a href="{:url('login/index')}">{:lang('login')}</a>
|
||||
<a href="{$Request.domain}{:url('login/index')}">{:lang('login')}</a>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-hide-xs">
|
||||
<a href="{:url('login/reg')}">{:lang('register')}</a>
|
||||
<a href="{$Request.domain}{:url('login/reg')}">{:lang('register')}</a>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-hide-xs" >
|
||||
<select name="language" style="width:50px;" lay-filter="language" lay-verify="" id="language">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div carousel-item="">
|
||||
{volist name="slider" id="vo"}
|
||||
<div time-limit="">
|
||||
<a href="{$Request.domain}{$vo.slid_href}" target="_blank" rel="nofollow">
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow">
|
||||
<img src="{$Request.domain}{$vo.slid_img}" alt="{$vo.slid_name}" />
|
||||
</a>
|
||||
</div>
|
||||
|
@ -1,12 +1,3 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-10 12:51:38
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\public\index-static.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
<div class="layui-row fly-panel-main" style="padding: 15px;">
|
||||
<div class="layui-clear fly-list-quick">
|
||||
{volist name="fastlinks" id="vo"}
|
||||
|
@ -1,12 +1,3 @@
|
||||
<!--
|
||||
* @Author: TaoLer <alipay_tao@qq.com>
|
||||
* @Date: 2021-12-06 16:04:51
|
||||
* @LastEditTime: 2022-05-10 12:47:05
|
||||
* @LastEditors: TaoLer
|
||||
* @Description: 搜索引擎SEO优化设置
|
||||
* @FilePath: \TaoLer\view\taoler\index\public\menu.html
|
||||
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
|
||||
-->
|
||||
<div class="layui-panel site-menu layui-hide-md">
|
||||
<ul class="layui-menu layui-menu-lg">
|
||||
<li class="search" style="padding-left:5px;padding-top:2px;padding-right:5px;">
|
||||
|
Loading…
Reference in New Issue
Block a user