From 59db9269382b986c79e8529203f84ae0fc6eb094 Mon Sep 17 00:00:00 2001 From: taoser Date: Mon, 1 Apr 2024 10:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8F=92=E4=BB=B6=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseController.php | 2 +- app/admin/controller/user/User.php | 83 +++-- app/admin/controller/user/Vip.php | 26 +- app/admin/view/user/user/index.html | 190 ++++++---- app/admin/view/user/vip/edit.html | 33 +- app/admin/view/user/vip/index.html | 94 +++-- app/common/controller/BaseController.php | 2 +- app/common/model/Comment.php | 2 +- app/common/model/UserViprule.php | 2 +- app/index/controller/Article.php | 35 +- app/index/controller/Index.php | 8 - app/index/controller/User.php | 99 ++++- app/index/route/route.php | 2 + composer.lock | 10 +- config/taoler.php | 2 +- public/static/admin/css/admin.css | 17 +- public/static/component/layui/css/layui.css | 2 +- public/static/component/layui/layui.js | 2 +- public/static/component/pear/module/admin.js | 344 +++++++++--------- public/static/component/pear/module/card.js | 9 +- public/static/component/pear/module/menu.js | 85 +++-- public/static/component/pear/pear.js | 2 +- public/static/res/css/global.css | 64 ++-- public/static/res/mods/index.js | 22 +- public/static/res/mods/user.js | 79 +++- vendor/composer/installed.json | 12 +- vendor/composer/installed.php | 10 +- .../src/Support/ReflectionClosure.php | 5 + vendor/services.php | 2 +- vendor/taoser/think-addons/src/Addons.php | 9 +- .../think-addons/src/addons/Controller.php | 6 +- vendor/taoser/think-addons/src/helper.php | 2 +- view/taoler/index/article/ask/cate.html | 15 +- view/taoler/index/article/ask/detail.html | 24 +- view/taoler/index/article/blog/detail.html | 10 +- view/taoler/index/article/edit.html | 1 + view/taoler/index/article/news/cate.html | 16 +- view/taoler/index/article/news/detail.html | 8 +- view/taoler/index/article/posts/cate.html | 40 +- view/taoler/index/article/posts/detail.html | 84 ++--- view/taoler/index/comment/edit.html | 2 +- view/taoler/index/index/index.html | 35 +- view/taoler/index/public/footer.html | 3 +- view/taoler/index/user/post.html | 14 + view/taoler/index/user/set.html | 77 ++-- 45 files changed, 928 insertions(+), 663 deletions(-) diff --git a/app/BaseController.php b/app/BaseController.php index a46f3ec..53eeb1d 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -270,7 +270,7 @@ abstract class BaseController if(count($images)) { foreach($images as $image){ //1.带http地址的图片,2.非本站的网络图片 3.非带有?号等参数的图片 - if((stripos($image,'http') !== false) && (stripos($image, Request::domain()) == false) && (stripos($image, '?') == false)) { + if((stripos($image,'http') !== false) && (stripos($image, Request::domain()) === false) && (stripos($image, '?') == false)) { // 如果图片中没有带参数或者加密可下载 //下载远程图片(可下载) $newImageUrl = $this->downloadImage($image); diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php index 700f6b7..1d2daca 100644 --- a/app/admin/controller/user/User.php +++ b/app/admin/controller/user/User.php @@ -44,34 +44,44 @@ class User extends AdminController 'page' => input('page') ]); $count = $user->total(); - $res = []; + $data = []; if($count){ - $res = ['code'=>0,'msg'=>'ok','count'=>$count]; - foreach($user as $k => $v){ - $data = [ - 'id' => $v['id'], - 'username' => $v['name'], - 'nick' => $v['nickname'], - 'avatar' => $v['user_img'], - 'phone' => $v['phone'], - 'email' => $v['email'], - 'sex' => $v['sex'], - 'ip' => $v['last_login_ip'], - 'city' => $v['city'], - 'logintime' => date("Y-m-d H:i",$v['last_login_time']), - 'jointime' => date("Y-m-d",$v['create_time']), - 'check' => $v['status'], - 'auth' => $v['auth'] - ]; - $res['data'][] = $data; + $vipList = []; + $vipRule = Db::name('user_viprule')->field('id,vip,nick')->select(); + foreach($vipRule as $v) { + $vipList[] = ['id' => $v['id'], 'vip' => $v['vip'], 'title' => $v['nick']]; } - } else { - $res = ['code'=>-1,'msg'=>'没有查询结果!']; + + foreach($user as $k => $v){ + $data[] = [ + 'id' => $v['id'], + 'username' => $v['name'], + 'nick' => $v['nickname'], + 'avatar' => $v['user_img'], + 'phone' => $v['phone'], + 'email' => $v['email'], + 'sex' => $v['sex'], + 'ip' => $v['last_login_ip'], + 'city' => $v['city'], + 'point' => $v['point'], + 'logintime' => date("Y-m-d H:i:s",$v['last_login_time']), + 'jointime' => date("Y-m-d H:i",$v['create_time']), + 'check' => $v['status'], + 'auth' => $v['auth'], + 'vip' => $vipList[$v['vip']]['title'] + ]; + } + + return json(['code'=>0,'msg'=>'ok','count'=>$count, 'data' => $data, 'viplist' => $vipList]); } - return json($res); + return json(['code'=>-1,'msg'=>'没有查询结果!']); } return View::fetch(); } + + protected function getUserVipNick($vip) { + + } //添加用户 @@ -204,12 +214,39 @@ class User extends AdminController return true; } - //登录用过户中心 + //登录用户中心 public function goUserHome() { $id = (int)input('id'); $user_home_url = $this->getUserHome($id); return redirect($user_home_url); } + + // 编辑用户积分 + public function editPoint() + { + if(Request::isAjax()) { + $param = Request::param(['id','point']); + + $res = Db::name('user')->where('id',(int)$param['id'])->update(['point' => (int)$param['point']]); + if($res > 0) { + return json(['code' => 0, 'msg' => '修改成功']); + } + return json(['code' => -1, 'msg' => '修改失败']); + } + } + // 编辑用户会员等级 + public function editVipLevel() + { + if(Request::isAjax()) { + $param = Request::param(['id','vip']); + $vipRule = Db::name('user_viprule')->field('vip,nick')->where('nick', $param['vip'])->find(); + $res = Db::name('user')->where('id',(int)$param['id'])->update(['vip' => (int)$vipRule['vip']]); + if($res > 0) { + return json(['code' => 0, 'msg' => '修改成功']); + } + return json(['code' => -1, 'msg' => '修改失败']); + } + } } diff --git a/app/admin/controller/user/Vip.php b/app/admin/controller/user/Vip.php index c45d2ee..78785d8 100644 --- a/app/admin/controller/user/Vip.php +++ b/app/admin/controller/user/Vip.php @@ -29,22 +29,30 @@ class Vip extends AdminController { $keys = UserViprule::select(); $count = $keys->count(); - $res = []; + $data = []; if($count){ - $res = ['code'=>0,'msg'=>'','count'=>$count]; foreach($keys as $k=>$v){ - $res['data'][] = ['id'=>$v['id'],'score'=>$v['score'],'nick'=>$v['nick'],'vip'=>$v['vip'],'ctime'=>$v['create_time']]; - } - } else { - $res = ['code'=>-1,'msg'=>'还没有任何vip等级设置!']; - } - return json($res); + $data[] = [ + 'id'=>$v['id'], + 'vip'=>$v['vip'], + 'score'=>$v['score'], + 'nick'=>$v['nick'], + 'postnum'=>$v['postnum'], + 'postpoint'=>$v['postpoint'], + 'refreshnum'=>$v['refreshnum'], + 'refreshpoint'=>$v['refreshpoint'], + 'ctime'=>$v['create_time'] + ]; + } + return json(['code'=>0,'msg'=>'ok','count'=>$count, 'data' => $data]); + } + return json(['code'=>-1,'msg'=>'还没有任何vip等级设置!']); } //添加VIP积分规则 public function add() { - $data = Request::only(['score','vip','nick']); + $data = Request::only(['score','vip','nick','postnum','refreshnum']); $vip = UserViprule::where('vip',$data['vip'])->find(); if($vip){ $res = ['code'=>-1,'msg'=>'vip等级不能重复设置']; diff --git a/app/admin/view/user/user/index.html b/app/admin/view/user/user/index.html index a3a0940..eac5215 100644 --- a/app/admin/view/user/user/index.html +++ b/app/admin/view/user/user/index.html @@ -63,6 +63,7 @@ +
@@ -80,10 +81,15 @@ - - - - - + + -{:hook('taonyeditor')} - -{:hook('taoplayer')} - -{:hook('taoplyr')} + +{:hook('addonhook_detail_js')} {//图片点击放大} {include file="/public/images-click" /} diff --git a/view/taoler/index/article/blog/detail.html b/view/taoler/index/article/blog/detail.html index 121e0e1..c8fdab9 100644 --- a/view/taoler/index/article/blog/detail.html +++ b/view/taoler/index/article/blog/detail.html @@ -301,6 +301,9 @@ {:hook('ads_blog_detail_rimg')} + + {:hook('callme_show', ['id' => $article.id, 'uid' => $article.user.id])} + {//热门文章}
热门文章
@@ -582,10 +585,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ }); -{:hook('taonyeditor')} - -{:hook('taoplayer')} - -{:hook('taoplyr')} + +{:hook('addonhook_detail_js')} {/block} \ No newline at end of file diff --git a/view/taoler/index/article/edit.html b/view/taoler/index/article/edit.html index 3c271f6..c65c402 100644 --- a/view/taoler/index/article/edit.html +++ b/view/taoler/index/article/edit.html @@ -23,6 +23,7 @@ {if ($user.auth == 1)}
{else /} + {/if}
diff --git a/view/taoler/index/article/news/cate.html b/view/taoler/index/article/news/cate.html index 9d23d15..05f843a 100644 --- a/view/taoler/index/article/news/cate.html +++ b/view/taoler/index/article/news/cate.html @@ -68,20 +68,8 @@
- - {:hook('ads_cate_rimg')} - -
-
{:lang('hot post list')}
- {volist name="artHot" id="vo"} -
- {$vo.title} - {$vo.comments_count} -
- {/volist} -
- - {:hook('ads_cate_support')} + + {:hook('addonhook_list')}
diff --git a/view/taoler/index/article/news/detail.html b/view/taoler/index/article/news/detail.html index 998ae2e..c61c82d 100644 --- a/view/taoler/index/article/news/detail.html +++ b/view/taoler/index/article/news/detail.html @@ -75,11 +75,6 @@ {/block} {block name="script"} - -{:hook('taonyeditor')} - -{:hook('taoplayer')} - -{:hook('taoplyr')} + +{:hook('addonhook_detail_js')} {//图片点击放大} {include file="/public/images-click" /} diff --git a/view/taoler/index/article/posts/cate.html b/view/taoler/index/article/posts/cate.html index 480d606..16dff76 100644 --- a/view/taoler/index/article/posts/cate.html +++ b/view/taoler/index/article/posts/cate.html @@ -58,31 +58,21 @@
- - {:hook('ads_cate_rimg')} - {//热门文章} -
-
{:lang('hot post list')}
- {volist name="artHot" id="vo"} -
- {$vo.title} - {$vo.comments_count} -
- {/volist} -
- {//热门标签} -
-
热门标签
-
-
    - {volist name="hotTag" id="vo"} -
  • {$vo.name}
  • - {/volist} -
-
-
- - {:hook('ads_detail_support')} + + {:hook('addonhook_list')} + + {//热门标签} +
+
热门标签
+
+
    + {volist name="hotTag" id="vo"} +
  • {$vo.name}
  • + {/volist} +
+
+
+
diff --git a/view/taoler/index/article/posts/detail.html b/view/taoler/index/article/posts/detail.html index a8f04df..ff39d9a 100644 --- a/view/taoler/index/article/posts/detail.html +++ b/view/taoler/index/article/posts/detail.html @@ -25,18 +25,20 @@ {//图标}
- {if (cookie('think_lang') == 'en-us')} {article:cate name="ename" /} - {else /} {article:cate name="name" /} - {/if} - - {if ($article.is_top == 1)}{:lang('top')}{/if} + {if (cookie('think_lang') == 'en-us')} + {article:cate name="ename" /} + {else /} + {article:cate name="name" /} + {/if} + + {if ($article.is_top == 1)}{:lang('top')}{/if} {if ($article.is_hot == 1)}{:lang('hot')}{/if} - - {article:comment_num /} - - {article:pv /} + + {article:comment_num /} + + {article:pv /}
{//作者} @@ -71,11 +73,11 @@ {//解密文件} {empty name="passJieMi"} - {if($article.read_type == 1)} -
- -
- {/if} + {if($article.read_type == 1)} +
+ +
+ {/if} {/empty} {notempty name="tags"} @@ -85,18 +87,18 @@ {/volist} {/notempty} -
-

{$sysInfo.state|raw}

-
+
+

{$sysInfo.state|raw}

+
本文链接:{$Request.domain}{$Request.url}
-
- - 点赞 {:count($userZanList)} - - {volist name="userZanList" id="vo" } - - {/volist} -
+
+ + 点赞 {:count($userZanList)} + + {volist name="userZanList" id="vo" } + + {/volist} +
{//评论} @@ -249,20 +251,15 @@ - - {:hook('ads_detail_support')} -
-
{:lang('hot post list')}
- {volist name="artHot" id="vo"} -
- {$vo.title} - {$vo.comments_count} -
- {/volist} -
- - {:hook('ads_detail_rimg')} + + + {:hook('callme_show', ['id' => $article.id, 'uid' => $article.user.id])} + + + {:hook('addonhook_detail')} + + {//crud管理模块} {include file="/public/crud" /} @@ -270,12 +267,8 @@ {include file="public/menu" /} {/block} + {block name="script"} - - - -{:hook('taoplayer')} - -{:hook('taoplyr')} -{:hook('taonyeditor')} + +{:hook('addonhook_detail_js')} + {//图片点击放大} {include file="/public/images-click" /} diff --git a/view/taoler/index/comment/edit.html b/view/taoler/index/comment/edit.html index defd9c6..328a6d5 100644 --- a/view/taoler/index/comment/edit.html +++ b/view/taoler/index/comment/edit.html @@ -23,7 +23,7 @@ - + {:hook('taonyeditor')} diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 28d2e55..354c96b 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -101,40 +101,11 @@ - + {//右栏}
- - {:hook('signhook', ['id'=>1])} - - {:hook('ranking')} - - {:hook('ads_index_rimg')} - - {:hook('ads_index_fastlinks')} - - {:hook('ads_index_support')} - -
-

{:lang('reviewers list')}

-
- -
-
- -
-
{:lang('hot post list')}
- {volist name="artHot" id="vo"} -
- {$vo.title} - {$vo.comments_count} -
- {/volist} -
- - {:hook('ads_index_rfimg')} - - {:hook('ads_index_flink')} + + {:hook('addonhook_index')}
diff --git a/view/taoler/index/public/footer.html b/view/taoler/index/public/footer.html index 65892ce..49a4d27 100644 --- a/view/taoler/index/public/footer.html +++ b/view/taoler/index/public/footer.html @@ -10,6 +10,7 @@ {$sysInfo.icp}

+ {//websocket统计脚本}
@@ -30,7 +31,7 @@ - +{:hook('callme_foot', ['id' => $article.id ?? '', 'uid' => $article.user.id ?? ''])} {:hook('showLeftLayer')} {/block} \ No newline at end of file diff --git a/view/taoler/index/user/set.html b/view/taoler/index/user/set.html index 34bb8cb..b270c05 100644 --- a/view/taoler/index/user/set.html +++ b/view/taoler/index/user/set.html @@ -17,6 +17,12 @@
如果您在邮箱已激活的情况下,变更了邮箱,需重新验证邮箱
+
+ +
+ +
+
@@ -69,33 +75,33 @@
- -
- -
- -
- -
-
-
- -
- -
-
6到16个字符
-
-
- -
- -
-
-
- -
-
+
+ +
+ +
+ +
+
+
+ +
+ +
+
6到16个字符
+
+
+ +
+ +
+
+
+ +
+
+
+ + {:hook('callme_set')} + {/block} @@ -131,13 +140,13 @@ url:"{:url('User/set')}", data:field, dataType:"json", - success:function(data){ - if(data.code === 0){ - layer.msg(data.msg,{icon:6,tiye:2000},function(){ + success:function(res){ + if(res.code === 0){ + layer.msg(res.msg, {icon:6,tiye:2000}, function(){ location.reload(); }); } else { - layer.open({title:"更新失败",content:data.msg,icon:5,anim:6}); + layer.open({title:"更新失败",content: res.msg, icon:5, anim:6}); }} }); return false; @@ -151,13 +160,13 @@ url:"{:url('User/setPass')}", data:field, dataType:"json", - success:function(data){ - if(data.code === 1){ - layer.msg(data.msg,{icon:6,tiye:2000},function(){ + success:function(res){ + if(res.code === 1){ + layer.msg(res.msg,{icon:6, tiye:2000},function(){ location.reload(); }); } else { - layer.open({title:"密码设置失败",content:data.msg,icon:5,anim:6}); + layer.open({title: res.msg, content: res.msg, icon:5, anim:6}); }} }); return false;