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"}
{include file="/public/column" /}
{/block} {block name="content"} -
-
-
-
- {//标题} -

{$article.title}

-
+
+
+
+
+ {//标题} +

{$article.title}

+
- {//图标} -
- - {$article.user.name} - {$article.user.nickname ?: $article.user.name} / - - - / {$article.comments_count} / {$pv} - {if ($article.jie == 0) } - {:lang('no finished')} - {else /} - {:lang('finished')} + {//图标} +
+ + {$article.user.name} + {$article.user.nickname ?: $article.user.name} / + + + / {$article.comments_count} / {$pv} + {if ($article.jie == 0) } + {:lang('no finished')} + {else /} + {:lang('finished')} + {/if} + +
+ +
+ + {//问题内容} +
问题描述:
+
+ {:hook('taoplayerdiv')} +
{$article.content|raw}
+ {if (($article.upzip !== '') || session('?user_name'))} +
+ {notempty name="$article.upzip"} + + {/notempty} +
{/if} - + + {notempty name="tags"} +
标签 + {volist name="tags" id="vo" } + {$vo.name} + {/volist} +
+ {/notempty} +
+

{$sysInfo.state|raw}

+
+
-
+ {//评论内容} +
+ 评论 {$article.comments_count} +
    + {volist name="comments['data']" id="vo" empty= ""} +
  • + +
    + +  {if($vo.user.vip > 0)}{/if} + +
    + + {$vo.user.nickname ?: $vo.user.name} + + {if condition="$article.user.id eq $vo.user.id"}({:lang('poster')}){/if} +
    +
    {:hook('ipShow', $vo.user.city)}
    + {if $vo.cai == 1}{/if} +
    +
    {$vo.content|raw}
    - {//问题内容} -
    问题描述:
    -
    - {:hook('taoplayerdiv')} -
    {$article.content|raw}
    - {if (($article.upzip !== '') || session('?user_name'))} -
    - {notempty name="$article.upzip"} - - {/notempty} +
    + {$vo.zan} + {:lang('reply')} + {//评论 编辑/删除/采纳/权限} +
    + {if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')} + {:lang('edit')} + {:lang('delete')} + {/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/} + {:lang('accept')} + {/if} +
    +
    +
    +
    +
    {$vo.user.sign|raw}
    +
    +
  • + {/volist} +
+
+
+ + {//评论区} + {if session('?user_id') AND ( config('taoler.config.is_reply') == 1 ) AND ( $article.is_reply == 1 )} +
+
+ +
+ +
+
+ + + +
+
{/if} - {notempty name="tags"} -
标签 - {volist name="tags" id="vo" } - {$vo.name} - {/volist} -
- {/notempty} -
-

{$sysInfo.state|raw}

-
-
- {//评论内容} -
- 评论 {$article.comments_count} -
    - {volist name="comments['data']" id="vo" empty= ""} -
  • - -
    - -  {if($vo.user.vip > 0)}{/if} + {// 右栏} +
    +
    +
    +
    + + {$article.user.name} + {if($article.user.vip > 0)}{/if} -
    - - {$vo.user.nickname ?: $vo.user.name} - - {if condition="$article.user.id eq $vo.user.id"}({:lang('poster')}){/if} -
    -
    {:hook('ipShow',$vo.user.city)}
    - {if $vo.cai == 1}{/if}
    -
    {$vo.content|raw}
    - -
    - {$vo.zan} - {:lang('reply')} - {//评论 编辑/删除/采纳/权限} -
    - {if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')} - {:lang('edit')} - {:lang('delete')} - {/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/} - {:lang('accept')} - {/if} -
    +
    + 回答 {$article.user.comments_count} 提问 {$article.user.article_count} + + 关注
    -
    -
    -
    {$vo.user.sign|raw}
    -
    -
  • +
+
+ {if showSlider(7)} +
+
{:lang('sponsor')}- + {:lang('i want to join')} +
+
+ {volist name="ad_comm" id="vo"} + {$vo.slid_name} + {/volist} +
+
+ {/if} +
+
{:lang('hot post list')}
+ {volist name="artHot" id="vo"} +
+ {$vo.title} + {$vo.comments_count} +
{/volist} - -
-
- - {//评论区} - {if session('?user_id') AND ( config('taoler.config.is_reply') == 1 ) AND ( $article.is_reply == 1 )} -
-
- -
- -
-
-
- - - -
-
- {/if} - -
- - {// 右栏} -
-
-
- -
- 回答 {$article.user.comments_count} 提问 {$article.user.article_count} - + 关注 -
-
-
- {if showSlider(7)} -
-
{:lang('sponsor')}- - {:lang('i want to join')} -
-
- {volist name="ad_comm" id="vo"} - {$vo.slid_name} + + {if showSlider(4)} +
+ {volist name="ad_art" id="vo"} + {/volist}
+ {/if}
- {/if} -
-
{:lang('hot post list')}
- {volist name="artHot" id="vo"} -
- {$vo.title} - {$vo.comments_count} -
- {/volist} -
- {if showSlider(4)} -
- {volist name="ad_art" id="vo"} - - {/volist} -
- {/if} + {//crud管理模块} + {include file="/public/crud" /}
- {//crud管理模块} - {include file="/public/crud" /} -
-{include file="public/menu" /} + {/block} {block name="script"} @@ -322,7 +322,7 @@ //首次不执行 if (!first) { $.post("{:url('article/detail')}", { id: id, page: page }, function () { - location.href = url + '?page=' + page; + location.href = url + '?page=' + page + '#flyReply'; }); } }, @@ -347,9 +347,8 @@ {//图片点击放大} {include file="/public/images-click" /} -{:hook('markdownhook')} + {include file="/public/qr-read" /} -{volist name="push_js" id="vo"} {$vo.jscode|raw} {/volist} {/block} diff --git a/view/taoler/index/article/blog/detail.html b/view/taoler/index/article/blog/detail.html index d7e0ebd..362aad2 100644 --- a/view/taoler/index/article/blog/detail.html +++ b/view/taoler/index/article/blog/detail.html @@ -284,7 +284,7 @@ {//crud管理模块} {include file="/public/crud" /} - {include file="public/menu" /} + {/block} {block name="script"} @@ -413,27 +413,27 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ } return false; }); - - //执行一个laypage实例 - laypage.render({ - elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号 - ,count: "{$article.comments_count}" //数据总数,从服务端得到 - ,limit: 10 - ,curr : {$page} - - //获取起始页 - ,jump: function(obj, first){ - //首次不执行 - if(!first){ + + // 评论分页 + laypage.render({ + elem: "pages", //注意,这里的 test1 是 ID,不用加 # 号 + count: "{$article.comments_count}", //数据总数,从服务端得到 + limit: 10, + curr: "{$page}", + //获取起始页 + jump: function (obj, first) { var page = obj.curr; - var url = "{:url('article/detail',['id'=>$article.id])}"; + var limit = obj.limit; + var url = "{:url('article_detail',['id' => $article.id ,'ename' =>$article['cate']['ename']])}"; var id = "{$article.id}"; - $.post("{:url('article/detail')}",{"id":id,"page":page},function(){ - window.location.href = url + '?page=' + page + '#flyReply'; - }); - } - } - }); + //首次不执行 + if (!first) { + $.post("{:url('article/detail')}", { id: id, page: page }, function () { + location.href = url + '?page=' + page + '#flyReply'; + }); + } + }, + }); //下载 $('#zip-download').click(function (){ @@ -453,12 +453,6 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ {:hook('taoplyr')} -{:hook('markdownhook')} - {include file="/public/qr-read" /} -{volist name="push_js" id="vo"} -{$vo.jscode|raw} -{/volist} - {/block} \ No newline at end of file diff --git a/view/taoler/index/article/news/detail.html b/view/taoler/index/article/news/detail.html index 0bcce3e..d003373 100644 --- a/view/taoler/index/article/news/detail.html +++ b/view/taoler/index/article/news/detail.html @@ -62,7 +62,7 @@
-{include file="public/menu" /} + {/block} {block name="script"} @@ -172,27 +172,27 @@ } return false; }); - - //执行一个laypage实例 - laypage.render({ - elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号 - ,count: "{$article.comments_count}" //数据总数,从服务端得到 - ,limit: 10 - ,curr : {$page} - + + // 评论分页 + laypage.render({ + elem: "pages", //注意,这里的 test1 是 ID,不用加 # 号 + count: "{$article.comments_count}", //数据总数,从服务端得到 + limit: 10, + curr: "{$page}", //获取起始页 - ,jump: function(obj, first){ + jump: function (obj, first) { + var page = obj.curr; + var limit = obj.limit; + var url = "{:url('article_detail',['id' => $article.id ,'ename' =>$article['cate']['ename']])}"; + var id = "{$article.id}"; //首次不执行 - if(!first){ - var page = obj.curr; - var url = "{:url('article/detail',['id'=>$article.id])}"; - var id = "{$article.id}"; - $.post("{:url('article/detail')}",{"id":id,"page":page},function(){ - window.location.href = url + '?page=' + page + '#flyReply'; + if (!first) { + $.post("{:url('article/detail')}", { id: id, page: page }, function () { + location.href = url + '?page=' + page + '#flyReply'; }); } - } - }); + }, + }); //下载 $('#zip-download').click(function (){ @@ -213,10 +213,5 @@ {//图片点击放大} {include file="/public/images-click" /} -{:hook('markdownhook')} - -{volist name="push_js" id="vo"} -{$vo.jscode|raw} -{/volist} {/block} \ No newline at end of file diff --git a/view/taoler/index/article/posts/detail.html b/view/taoler/index/article/posts/detail.html index d2dec4f..813810d 100644 --- a/view/taoler/index/article/posts/detail.html +++ b/view/taoler/index/article/posts/detail.html @@ -200,7 +200,7 @@
-{include file="public/menu" /} + {/block} {block name="script"} @@ -323,27 +323,27 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ } return false; }); - - //执行一个laypage实例 - laypage.render({ - elem: 'pages' //注意,这里的 test1 是 ID,不用加 # 号 - ,count: "{$article.comments_count}" //数据总数,从服务端得到 - ,limit: 10 - ,curr : {$page} - + + // 评论分页 + laypage.render({ + elem: "pages", //注意,这里的 test1 是 ID,不用加 # 号 + count: "{$article.comments_count}", //数据总数,从服务端得到 + limit: 10, + curr: "{$page}", //获取起始页 - ,jump: function(obj, first){ + jump: function (obj, first) { + var page = obj.curr; + var limit = obj.limit; + var url = "{:url('article_detail',['id' => $article.id ,'ename' =>$article['cate']['ename']])}"; + var id = "{$article.id}"; //首次不执行 - if(!first){ - var page = obj.curr; - var url = "{:url('article/detail',['id'=>$article.id])}"; - var id = "{$article.id}"; - $.post("{:url('article/detail')}",{"id":id,"page":page},function(){ - window.location.href = url + '?page=' + page + '#flyReply'; + if (!first) { + $.post("{:url('article/detail')}", { id: id, page: page }, function () { + location.href = url + '?page=' + page + '#flyReply'; }); } - } - }); + }, + }); //下载 $('#zip-download').click(function (){ @@ -364,11 +364,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ {//图片点击放大} {include file="/public/images-click" /} -{:hook('markdownhook')} + {include file="/public/qr-read" /} -{volist name="push_js" id="vo"} -{$vo.jscode|raw} -{/volist} - {/block} \ No newline at end of file diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 8244cd0..87825d9 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -47,6 +47,8 @@ {//右栏}
+ {:hook('live')} + {:hook('kankan')} {:hook('signhook', ['id'=>1])}