This commit is contained in:
taoser 2024-04-14 12:06:40 +08:00
parent 27daa029f4
commit fe2d08ca8e
8 changed files with 34 additions and 25 deletions

View File

@ -38,6 +38,9 @@
{{# } }}
{{# } }}
</script>
<script type="text/html" id="ver-tpl">
<div>{{d.version}} {{# if(d.have_newversion == 1) { }} <span class="layui-badge-dot"></span> {{# } }}</div>
</script>
<script type="text/html" id="buttonStatus">
<input type="checkbox" name="{{d.name}}" lay-skin="switch" lay-filter="addonsStatus" lay-text="启动|禁用" {{# if(d.status == 1){ }} checked {{# } }} data-url="{:url('addon.addons/check')}">
@ -50,7 +53,8 @@
{include file="public/user_login" /}
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script>
var addonList = "{:url('addon.addons/getList')}";
@ -64,7 +68,7 @@
var toast = layui.toast;
let LIST_URL = "{:url('addon.addons/list')}";
let cols = [[
{type: 'checkbox'},
{title: '序号', type: 'numbers'},
@ -73,7 +77,7 @@
{field: 'author', title: '作者', width: 100},
{field: 'price', title: '价格(元)', width: 85},
{field: 'downloads', title: '下载', width: 70},
{field: 'version', title: '版本', templet: '<div>{{d.version}} {{# if(d.have_newversion == 1){ }} <span class="layui-badge-dot"></span> {{# } }}</div>', width: 75},
{field: 'version', title: '版本', templet: '#ver-tpl', width: 75},
{field: 'status', title: '在线', width: 70},
{title: '操作', width: 165, align: 'center', toolbar: '#addons-bar'}
]];

View File

@ -620,7 +620,6 @@
} else {
toast.error({title:"服务器错误", message:res.msg})
}
return false;
});
layer.close(index);
});

View File

@ -109,9 +109,11 @@ class BaseController extends BaseCtrl
$user = Cache::get('user'.$id);
if(!$user){
//1.查询用户
$user = Db::name('user')->field('id,name,nickname,user_img,sex,area_id,auth,city,phone,email,active,sign,point,vip,create_time')->find($id);
$vipNick = Db::name('user_viprule')->field('nick')->where('vip', $user['vip'] ?? 0)->value('nick');
$user['nick'] = $vipNick;
$user = Db::name('user')
->alias('u')
->join('user_viprule v','v.vip = u.vip')
->field('u.id as id,v.id as vid,name,nickname,user_img,sex,area_id,auth,city,phone,email,active,sign,point,u.vip as vip,nick,u.create_time as cteate_time')
->find($id);
Cache::tag('user')->set('user'.$id, $user, 600);
}
return $user;

View File

@ -7,6 +7,7 @@ use think\Model;
use think\model\concern\SoftDelete;
use think\facade\Cache;
use think\facade\Config;
use think\db\Query;
class Article extends Model
{
@ -111,13 +112,13 @@ class Article extends Model
{
return Cache::remember('topArticle', function() use($num){
return $this::field('id,title,title_color,cate_id,user_id,content,create_time,is_top,pv,upzip,has_img,has_video,has_audio,read_type,art_pass')
->where([['is_top', '=', 1], ['status', '=', 1]])
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,upzip,has_img,has_video,has_audio,read_type')
->where(['is_top' => 1, 'status' => 1])
->with([
'cate' => function ($query) {
'cate' => function (Query $query) {
$query->where('delete_time', 0)->field('id,catename,ename');
},
'user' => function ($query) {
'user' => function (Query $query) {
$query->field('id,name,nickname,user_img');
}
])->withCount(['comments'])
@ -140,12 +141,12 @@ class Article extends Model
public function getArtList(int $num)
{
return Cache::remember('indexArticle', function() use($num){
return $this::field('id,title,title_color,cate_id,user_id,content,create_time,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type,art_pass')
$data = $this::field('id,title,title_color,cate_id,user_id,content,create_time,is_hot,pv,jie,upzip,has_img,has_video,has_audio,read_type,art_pass')
->with([
'cate' => function($query){
'cate' => function(Query $query){
$query->where('delete_time',0)->field('id,catename,ename,detpl');
},
'user' => function($query){
'user' => function(Query $query){
$query->field('id,name,nickname,user_img');
} ])
->withCount(['comments'])
@ -153,8 +154,9 @@ class Article extends Model
->order('create_time','desc')
->limit($num)
->append(['url'])
->select()
->toArray();
->select();
return $data->hidden(['art_pass'])->toArray();
},30);
}
@ -172,10 +174,10 @@ class Article extends Model
$artHot = $this::field('id,cate_id,title,create_time')
->withCount('comments')
->where(['status' => 1])
->whereTime('create_time', 'year')
->whereMonth('create_time')
->order('comments_count','desc')
->limit($num)
->withCache(120)
->withCache(600)
->append(['url'])
->select();
@ -195,14 +197,15 @@ class Article extends Model
return $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,read_type,art_pass,title_color,create_time,update_time')
->where(['status'=>1])
->with([
'cate' => function($query){
'cate' => function(Query $query){
$query->where('delete_time',0)->field('id,catename,ename');
},
'user' => function($query){
'user' => function(Query $query){
$query->field('id,name,nickname,user_img,area_id,vip,city')->withCount(['article','comments']);
}
])
->withCount(['comments'])
->hidden(['art_pass'])
->append(['url'])
->find($id);

View File

@ -89,7 +89,7 @@ class Cate extends Model
{
try {
return $this->where(['status' => 1])
->cache('catename', 3600)
->cache(3600)
->append(['url'])
->select()
->toArray();
@ -104,7 +104,7 @@ class Cate extends Model
{
try {
$cateList = $this->where(['status' => 1])
->cache('catename', 3600)
->cache(3600)
->append(['url'])
->select()
->toArray();

View File

@ -74,7 +74,8 @@ CREATE TABLE `tao_article` (
`delete_time` int NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE COMMENT '文章的用户索引',
INDEX `cate_id`(`cate_id`) USING BTREE COMMENT '文章分类索引'
INDEX `cate_id`(`cate_id`) USING BTREE COMMENT '文章分类索引',
INDEX `idx_article_create_time`(`create_time` DESC) USING BTREE COMMENT '创建时间'
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文章表' ROW_FORMAT = Dynamic;
-- ----------------------------

View File

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

View File

@ -22,7 +22,7 @@
<div class="layui-col-md6">
<div class="fly-panel fly-panel-border"> <div class="fly-panel-title"> 我的会员信息 </div>
<div class="fly-panel-main layui-text" style="padding: 18px 15px; height: 50px; line-height: 26px;">
<p>您的财富经验值:<span style="color: red">{$user.point}</span> 金币</p> <p>您当前为:<span style="color: red">{$user.nickname}</span></p> </div> </div> </div>
<p>您的财富经验值:<span style="color: red">{$user.point}</span> 金币</p> <p>您当前为:<span style="color: red">{$user.nick}</span></p> </div> </div> </div>
<div class="layui-col-md12" style="margin-top: -20px;">
<div class="fly-panel fly-panel-border"> <div class="fly-panel-title"> 快捷方式 </div>
<div class="fly-panel-main">