diff --git a/app/admin/controller/content/Forum.php b/app/admin/controller/content/Forum.php index 6e173c0..b4d777d 100644 --- a/app/admin/controller/content/Forum.php +++ b/app/admin/controller/content/Forum.php @@ -43,7 +43,46 @@ class Forum extends AdminController public function list() { - $list = $this->model->getList(input('limit'),input('page')); + $data = Request::only(['id','name','title','sec']); + $where = []; + if (!empty($data['sec'])) { + switch ($data['sec']) { + case '1': + $where[] = ['status', '=', 1]; + break; + case '2': + $where[] = ['is_top', '=', 1]; + break; + case '3': + $where[] = ['is_hot', '=', 1]; + break; + case '4': + $where[] = ['is_reply', '=', 1]; + break; + case '5': + $where[] = ['status', '=', -1]; + break; + case '6': + $where[] = ['status', '=', 0]; + break; + } + } + unset($data['sec']); + + if(!empty($data['id'])){ + $where[] = ['id', '=', $data['id']]; + } + + if(!empty($data['name'])){ + $userId = Db::name('user')->where('name',$data['name'])->value('id'); + $where[] = ['user_id', '=', $userId]; + } + + if(!empty($data['title'])){ + $where[] = ['title', 'like', $data['title'].'%']; + } + + $list = $this->model->getList($where, input('limit'), input('page')); $res = []; if($list['total']){ foreach($list['data'] as $v) { diff --git a/app/common/model/Article.php b/app/common/model/Article.php index 04f910a..ee61378 100644 --- a/app/common/model/Article.php +++ b/app/common/model/Article.php @@ -381,7 +381,7 @@ class Article extends Model } // 获取所有帖子内容 - public function getList($limit,$page) + public function getList(array $where, int $limit, int $page) { return $this::field('id,user_id,cate_id,title,content,is_top,is_hot,is_reply,status,update_time')->with([ 'user' => function($query){ @@ -390,7 +390,9 @@ class Article extends Model 'cate' => function($query){ $query->field('id,ename'); } - ])->paginate([ + ])->where($where) + ->order('create_time', 'desc') + ->paginate([ 'list_rows' => $limit, 'page' => $page ])->toArray(); diff --git a/config/taoler.php b/config/taoler.php index dacee23..47098d2 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -16,7 +16,7 @@ return [ // 应用名,此项不可更改 'appname' => 'TaoLer', // 版本配置 - 'version' => '2.2.7', + 'version' => '2.2.8', // 加盐 'salt' => 'taoler', // 数据库备份目录 diff --git a/public/static/component/pear/module/addons.js b/public/static/component/pear/module/addons.js index 913eca3..c09cb80 100644 --- a/public/static/component/pear/module/addons.js +++ b/public/static/component/pear/module/addons.js @@ -70,71 +70,70 @@ layui.define(["table", "form",'toast','common'], function (exports) { // }); var api = { - userinfo: { - get: function () { - var userinfo = localStorage.getItem("taoleradmin_userinfo"); - return userinfo ? JSON.parse(userinfo) : null; - }, - set: function (data) { - if (data) { - localStorage.setItem("taoleradmin_userinfo", JSON.stringify(data)); - } else { - localStorage.removeItem("taoleradmin_userinfo"); - } + userinfo: { + get: function () { + var userinfo = localStorage.getItem("taoleradmin_userinfo"); + return userinfo ? JSON.parse(userinfo) : null; + }, + set: function (data) { + if (data) { + localStorage.setItem("taoleradmin_userinfo", JSON.stringify(data)); + } else { + localStorage.removeItem("taoleradmin_userinfo"); + } + } } - } } //监听工具条 table.on("tool(addons-list)", function (obj) { + var data = obj.data; + var event = obj.event; + var url = $(this).data('url') - var data = obj.data; - var event = obj.event; - var url = $(this).data('url') - - // 安装 - var install = function (data,url,userLoginUrl,userIsPayUrl){ + // 安装 + var install = function (data,url,userLoginUrl,userIsPayUrl){ var userinfo = api.userinfo.get(); // 检测权限 if(userinfo) { - layer.confirm("确认安装吗?", "vcenter",function(index){ - $.post(url, { name: data.name, version: data.version, uid: userinfo.uid, token: userinfo.token }, function (res) { - // 需要支付 - if (res.code === -2) { - layer.close(index); - layer.open({ - type: 2, - area: [common.isModile()?'100%':'800px', common.isModile()?'100%':'600px'], - fixed: false, //不固定 - maxmin: true, - content: 'pay.html'+ "?id=" + data.id+ "&name=" + data.name + "&version=" + data.version + "&uid=" + userinfo.uid + "&price=" + data.price, - success: function (layero, index){ - // 订单轮询 - var intervalPay = setInterval(function() { - $.post(userIsPayUrl,{name:data.name, userinfo:userinfo},function (res){ - if(res.code === 0) { - layer.close(index); - clearInterval(intervalPay); - install(data,url,userLoginUrl,userIsPayUrl); - } + layer.confirm("确认安装吗?", "vcenter",function(index){ + layer.close(index); + let loading = layer.load(); + $.post(url, { name: data.name, version: data.version, uid: userinfo.uid, token: userinfo.token }, function (res) { + layer.close(loading); + // 需要支付 + if (res.code === -2) { + layer.open({ + type: 2, + area: [common.isModile()?'100%':'800px', common.isModile()?'100%':'600px'], + fixed: false, //不固定 + maxmin: true, + content: 'pay.html'+ "?id=" + data.id+ "&name=" + data.name + "&version=" + data.version + "&uid=" + userinfo.uid + "&price=" + data.price, + success: function (layero, index){ + // 订单轮询 + var intervalPay = setInterval(function() { + $.post(userIsPayUrl,{name:data.name, userinfo:userinfo},function (res){ + if(res.code === 0) { + layer.close(index); + clearInterval(intervalPay); + install(data,url,userLoginUrl,userIsPayUrl); + } + }); + },3000); + } }); - },3000); } + // 安装成功 + if (res.code === 0) { + toast.success({title:"安装成功",message:res.msg,position: 'topRight'}); + } + // 安装失败 + if (res.code === -1) { + toast.error({title:"安装失败",message:res.msg,position: 'topRight'}); + } + // 重载 + table.reloadData("addons-list",{},'deep'); }); - } - // 安装成功 - if (res.code === 0) { - layer.close(index); - toast.success({title:"安装成功",message:res.msg,position: 'topRight'}); - } - // 安装失败 - if (res.code === -1) { - layer.close(index); - toast.error({title:"安装失败",message:res.msg,position: 'topRight'}); - } - // 重载 - table.reloadData("addons-list",{},'deep'); }); - }); } else { // 未登录时 layer.confirm('你当前还未登录TaoLer社区账号,请登录后操作!', { @@ -189,15 +188,15 @@ layui.define(["table", "form",'toast','common'], function (exports) { } } - //安装插件 - if (event === "install" || event === "upgrade") { + //安装插件 + if (event === "install" || event === "upgrade") { var userLoginUrl = $(this).data('userlogin'); var userIsPayUrl = $(this).data('ispay'); install(data,url,userLoginUrl,userIsPayUrl); } - // 卸载插件 - if (event === "uninstall") { + // 卸载插件 + if (event === "uninstall") { layer.confirm("是否卸载?", "vcenter",function(index) { $.post(url, { name: data.name }, function (res) { if (res.code === 0) { @@ -212,8 +211,8 @@ layui.define(["table", "form",'toast','common'], function (exports) { }); } - // 配置插件 - if (event === "config") { + // 配置插件 + if (event === "config") { $.post(url,{name:data.name},function (res){ // 无配置项拦截 if (res.code === -1) { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 303955d..6e8213a 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'taoser/taoler', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'dcfb9c2a8181fb002fee01a04843002e53a68e20', + 'reference' => 'f3d0aa0ea3473bafd7ce92799552709c43f3f02d', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -358,7 +358,7 @@ 'taoser/taoler' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'dcfb9c2a8181fb002fee01a04843002e53a68e20', + 'reference' => 'f3d0aa0ea3473bafd7ce92799552709c43f3f02d', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/services.php b/vendor/services.php index 8c31fb6..3db8b51 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'taoser\\addons\\Service', diff --git a/vendor/taoser/think-addons/src/helper.php b/vendor/taoser/think-addons/src/helper.php index b726ddc..3864f4d 100644 --- a/vendor/taoser/think-addons/src/helper.php +++ b/vendor/taoser/think-addons/src/helper.php @@ -2,9 +2,9 @@ declare(strict_types=1); use think\facade\Event; +use think\facade\App; use think\facade\Route; use taoser\addons\Service; -use think\facade\App; use think\facade\Config; use think\facade\Cache; use think\helper\{ @@ -24,8 +24,11 @@ define('DS', DIRECTORY_SEPARATOR); spl_autoload_register(function ($class) { $class = ltrim($class, '\\'); - - $dir = App::getRootPath(); +// $app = new think\App(); +// $dir = $app->getRootPath(); +// $dir = App::getRootPath(); + $dir = app()->getRootPath(); +// halt($dir); $namespace = 'addons'; if (strpos($class, $namespace) === 0) { diff --git a/view/taoler/index/article/ask/detail.html b/view/taoler/index/article/ask/detail.html index 1a64b0f..09fb508 100644 --- a/view/taoler/index/article/ask/detail.html +++ b/view/taoler/index/article/ask/detail.html @@ -14,176 +14,176 @@ {block name="link"} {/block} {block name="column"}
{/block} {block name="content"} -{$sysInfo.state|raw}
+{$sysInfo.state|raw}
-