From d9bd39747518c2cb174a476f35cee838c0bc4b54 Mon Sep 17 00:00:00 2001 From: taoser Date: Mon, 1 Apr 2024 10:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=9C=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=94=81=E5=AE=9A=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseController.php | 17 ++-- app/admin/controller/Index.php | 16 +++- app/admin/controller/content/Forum.php | 2 +- app/admin/controller/user/User.php | 9 +- app/admin/view/content/forum/add.html | 4 +- app/admin/view/content/forum/edit.html | 4 +- app/admin/view/content/forum/index.html | 25 +----- app/admin/view/index/console1.html | 26 +++--- app/admin/view/index/console2.html | 82 ++--------------- app/admin/view/system/admin/info.html | 88 ++----------------- app/admin/view/user/user/index.html | 6 +- app/common/controller/AdminController.php | 48 +++++++--- app/common/model/Article.php | 20 +++++ app/common/model/User.php | 1 + app/listener/UserLogin.php | 52 ++++------- app/middleware/Auth.php | 1 - composer.lock | 36 ++++---- config/taoler.php | 2 +- vendor/composer/installed.json | 42 ++++----- vendor/composer/installed.php | 22 ++--- vendor/firebase/php-jwt/CHANGELOG.md | 7 ++ .../php-jwt/src/BeforeValidException.php | 13 ++- .../firebase/php-jwt/src/ExpiredException.php | 13 ++- vendor/firebase/php-jwt/src/JWT.php | 12 ++- .../src/JWTExceptionWithPayloadInterface.php | 20 +++++ .../league/mime-type-detection/CHANGELOG.md | 22 +++-- .../src/GeneratedExtensionToMimeTypeMap.php | 7 +- vendor/psr/http-client/CHANGELOG.md | 8 ++ vendor/psr/http-client/composer.json | 3 + vendor/services.php | 2 +- view/taoler/index/article/add.html | 2 +- view/taoler/index/article/blog/detail.html | 8 +- view/taoler/index/article/edit.html | 6 +- 33 files changed, 301 insertions(+), 325 deletions(-) create mode 100644 vendor/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php diff --git a/app/BaseController.php b/app/BaseController.php index 3238768..a46f3ec 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -202,16 +202,15 @@ abstract class BaseController protected function getArticleAllpic($str) { //正则匹配 - $pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/"; + $pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png|\.jpeg]))[\'|\"].*?[\/]?>/"; preg_match_all($pattern,$str,$matchContent); if(isset($matchContent[1])){ - $img = $matchContent[1]; + $imgArr = $matchContent[1]; }else{ $temp = "./images/no-image.jpg";//在相应位置放置一张命名为no-image的jpg图片 } - - return $img; - + + return $imgArr; } //下载远程图片 @@ -234,9 +233,9 @@ abstract class BaseController { $filename = pathinfo($url, PATHINFO_BASENAME); //$dirname = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_DIRNAME); - $dirname = date('Ymd',time()); + //路径 - $path = 'storage/download/article_pic/' . $dirname . '/'; + $path = 'storage/download/article_pic/' . date('Ymd',time()) . '/'; //绝对文件夹 $fileDir = public_path() . $path; //文件绝对路径 @@ -271,12 +270,12 @@ 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); //替换图片链接 - $content = str_replace($image,Request::domain().$newImageUrl,$content); + $content = str_replace($image, Request::domain().$newImageUrl, $content); } } //不可下载的图片,如加密或者带有参数的图片如?type=jpeg,直接返回content diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 33c975b..fccb26a 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -21,6 +21,7 @@ use app\admin\model\Cunsult; use think\facade\Config; use taoler\com\Api; use app\common\lib\facade\HttpHelper; +use app\common\model\Comment; class Index extends AdminController { @@ -61,15 +62,28 @@ class Index extends AdminController public function console2() { // 评论、帖子状态 - $comm = Db::name('comment')->field('id')->where(['delete_time'=>0,'status'=>0])->select(); + $comm = Db::name('comment')->field('id,content,create_time')->where(['delete_time'=>0,'status'=>0])->select(); $forum = Db::name('article')->field('id')->where(['delete_time'=>0,'status'=>0])->select(); $user = Db::name('user')->field('id')->where(['delete_time'=>0,'status'=>0])->select(); + // 回复评论 + $comments = Comment::field('id,article_id,content,create_time,delete_time')->where(['delete_time'=>0])->order('create_time desc')->limit(10)->select(); + $commData = []; + foreach($comments as $v) { + $commData[] = [ + 'id' => $v->id, + 'content' => strip_tags($v['content']), + 'create_time' => $v['create_time'], + 'url' => $this->getArticleUrl($v['article_id'], 'index', $v->article->cate->ename) + ]; + } View::assign([ 'pendComms' => count($comm), 'pendForums' => count($forum), 'pendUser' => count($user), + 'comments' => $commData, ]); + return View::fetch('console2'); } diff --git a/app/admin/controller/content/Forum.php b/app/admin/controller/content/Forum.php index 2115e08..232040c 100644 --- a/app/admin/controller/content/Forum.php +++ b/app/admin/controller/content/Forum.php @@ -87,7 +87,7 @@ class Forum extends AdminController $where[] = ['title', 'like', '%'.$data['title'].'%']; } - $list = $this->model->getList($where, input('limit'), input('page')); + $list = $this->model->getAllStatusList($where, input('limit'), input('page')); $res = []; if($list['total']){ foreach($list['data'] as $v) { diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php index 252b684..700f6b7 100644 --- a/app/admin/controller/user/User.php +++ b/app/admin/controller/user/User.php @@ -19,7 +19,6 @@ use app\common\lib\Uploads; use app\common\validate\User as userValidate; use think\exception\ValidateException; - class User extends AdminController { @@ -204,5 +203,13 @@ class User extends AdminController } return true; } + + //登录用过户中心 + public function goUserHome() { + $id = (int)input('id'); + $user_home_url = $this->getUserHome($id); + + return redirect($user_home_url); + } } diff --git a/app/admin/view/content/forum/add.html b/app/admin/view/content/forum/add.html index 222af21..779d370 100644 --- a/app/admin/view/content/forum/add.html +++ b/app/admin/view/content/forum/add.html @@ -113,7 +113,7 @@ show: true, indent: 15, strict: false, - expandedKeys: true + expandedKeys: false }, tips: '请选择' }); @@ -203,6 +203,8 @@ }); + {// 编辑器} + {:hook('ueditor')} {:hook('taonyeditor')} {// 百度标题词条} {:hook('seoBaiduTitle')} diff --git a/app/admin/view/content/forum/edit.html b/app/admin/view/content/forum/edit.html index a09e262..51bb7b0 100644 --- a/app/admin/view/content/forum/edit.html +++ b/app/admin/view/content/forum/edit.html @@ -154,7 +154,7 @@ show: true, indent: 15, strict: false, - expandedKeys: true + expandedKeys: false }, tips: '请选择' }); @@ -222,6 +222,8 @@ }); + {// 编辑器} + {:hook('ueditor')} {:hook('taonyeditor')} {// 百度标题词条} {:hook('seoBaiduTitle')} diff --git a/app/admin/view/content/forum/index.html b/app/admin/view/content/forum/index.html index ca29f30..61d96d0 100644 --- a/app/admin/view/content/forum/index.html +++ b/app/admin/view/content/forum/index.html @@ -104,7 +104,7 @@ diff --git a/app/admin/view/user/user/index.html b/app/admin/view/user/user/index.html index 9670816..a3a0940 100644 --- a/app/admin/view/user/user/index.html +++ b/app/admin/view/user/user/index.html @@ -82,6 +82,9 @@ +