This commit is contained in:
taoser 2023-05-05 12:01:49 +08:00
parent 149d89e9db
commit 06b783c1e7
12 changed files with 320 additions and 291 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '2.2.7',
'version' => '2.2.8',
// 加盐
'salt' => 'taoler',
// 数据库备份目录

View File

@ -87,7 +87,6 @@ layui.define(["table", "form",'toast','common'], function (exports) {
//监听工具条
table.on("tool(addons-list)", function (obj) {
var data = obj.data;
var event = obj.event;
var url = $(this).data('url')
@ -97,10 +96,12 @@ layui.define(["table", "form",'toast','common'], function (exports) {
var userinfo = api.userinfo.get(); // 检测权限
if(userinfo) {
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.close(index);
layer.open({
type: 2,
area: [common.isModile()?'100%':'800px', common.isModile()?'100%':'600px'],
@ -123,12 +124,10 @@ layui.define(["table", "form",'toast','common'], function (exports) {
}
// 安装成功
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'});
}
// 重载

View File

@ -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(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2023-03-20 11:45:35
// This file is automatically generated at:2023-03-28 11:40:31
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -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) {

View File

@ -183,7 +183,7 @@
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
</div>
</div>
{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}

View File

@ -284,7 +284,7 @@
{//crud管理模块}
{include file="/public/crud" /}
</main>
{include file="public/menu" /}
{/block}
{block name="script"}
@ -414,25 +414,25 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
return false;
});
//执行一个laypage实例
// 评论分页
laypage.render({
elem: 'pages' //注意,这里的 test1 是 ID不用加 # 号
,count: "{$article.comments_count}" //数据总数,从服务端得到
,limit: 10
,curr : {$page}
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';
$.post("{:url('article/detail')}", { id: id, page: page }, function () {
location.href = url + '?page=' + page + '#flyReply';
});
}
}
},
});
//下载
@ -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}

View File

@ -62,7 +62,7 @@
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
</div>
</div>
{include file="public/menu" /}
{/block}
{block name="script"}
@ -173,25 +173,25 @@
return false;
});
//执行一个laypage实例
// 评论分页
laypage.render({
elem: 'pages' //注意,这里的 test1 是 ID不用加 # 号
,count: "{$article.comments_count}" //数据总数,从服务端得到
,limit: 10
,curr : {$page}
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';
$.post("{:url('article/detail')}", { id: id, page: page }, function () {
location.href = url + '?page=' + page + '#flyReply';
});
}
}
},
});
//下载
@ -213,10 +213,5 @@
{//图片点击放大}
{include file="/public/images-click" /}
{:hook('markdownhook')}
{volist name="push_js" id="vo"}
{$vo.jscode|raw}
{/volist}
{/block}

View File

@ -200,7 +200,7 @@
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
</div>
</div>
{include file="public/menu" /}
{/block}
{block name="script"}
@ -324,25 +324,25 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
return false;
});
//执行一个laypage实例
// 评论分页
laypage.render({
elem: 'pages' //注意,这里的 test1 是 ID不用加 # 号
,count: "{$article.comments_count}" //数据总数,从服务端得到
,limit: 10
,curr : {$page}
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';
$.post("{:url('article/detail')}", { id: id, page: page }, function () {
location.href = url + '?page=' + page + '#flyReply';
});
}
}
},
});
//下载
@ -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}

View File

@ -47,6 +47,8 @@
</div>
{//右栏}
<div class="layui-col-md4">
{:hook('live')}
{:hook('kankan')}
{:hook('signhook', ['id'=>1])}
<!--首页图片广告-->