From 5a6a54c88777b5a7e51dd7ce2ff9f6a41492482e Mon Sep 17 00:00:00 2001 From: tao Date: Tue, 2 Aug 2022 18:47:24 +0800 Subject: [PATCH] 1.9.4 --- README.md | 4 +-- app/admin/controller/Forum.php | 13 +++------ app/admin/controller/Seo.php | 40 +++++++++++++++++----------- app/admin/view/forum/replys.html | 14 +++++----- app/admin/view/seo/index.html | 15 ++++++++++- app/index/route/route.php | 4 +-- public/static/admin/modules/forum.js | 2 +- vendor/composer/installed.php | 4 +-- vendor/services.php | 2 +- view/taoler/index/article/cate.html | 29 ++++++++++---------- view/taoler/index/index/index.html | 13 +++++---- 11 files changed, 77 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 255aa30..7c41daa 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ > TaoLer是一个简单迅捷的轻论坛系统,适用于个人或组织区域型信息交流发布平台。 * 官网:https://www.aieok.com - * 版本:TaoLer 1.9.3 - * 日期:2022.4.22 + * 版本:TaoLer 1.9.4 + * 日期:2022.4.24 webman版新架构已适配90% diff --git a/app/admin/controller/Forum.php b/app/admin/controller/Forum.php index f566b20..da9a9d7 100644 --- a/app/admin/controller/Forum.php +++ b/app/admin/controller/Forum.php @@ -77,15 +77,7 @@ class Forum extends AdminController $res['msg'] = ''; $res['count'] = $count; foreach($forumList as $k=>$v){ - $indexUrl = $this->getIndexUrl(); - $artUrl = (string) url('detail_id', ['id' => $v['aid']]); - if(empty(config('app.domain_bind'))) { - // 未绑定域名 - $url = $indexUrl . str_replace('admin','index',$artUrl); - } else { - // 单独绑定域名 - $url = $indexUrl . $artUrl; - } + $url = $this->getRouteUrl($v['aid']); $res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'title'=>htmlspecialchars($v['title']),'url'=>$url,'content'=>htmlspecialchars($v['content']),'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']]; } } else { @@ -270,8 +262,9 @@ class Forum extends AdminController if ($count) { $res = ['code'=>0,'msg'=>'','count'=>$count]; foreach($replys as $k => $v){ + $url = $this->getRouteUrl($v['cid']); //$res['data'][] = ['id'=>$v['id'],'replyer'=>$v->user->name,'cardid'=>$v->article->title,'avatar'=>$v->user->user_img,'content'=>$v['content'],'replytime'=>$v['create_time']]; - $res['data'][] = ['id'=>$v['aid'],'replyer'=>$v['name'],'cardid'=>htmlspecialchars($v['title']),'avatar'=>$v['user_img'],'content'=>htmlspecialchars($v['content']),'replytime'=>date("Y-m-d",$v['create_time']),'check'=>$v['astatus'],'cid'=>$v['cid']]; + $res['data'][] = ['id'=>$v['aid'],'replyer'=>$v['name'],'title'=>htmlspecialchars($v['title']),'avatar'=>$v['user_img'],'content'=>htmlspecialchars($v['content']),'replytime'=>date("Y-m-d",$v['create_time']),'check'=>$v['astatus'],'url'=>$url]; } } else { $res = ['code'=>-1,'msg'=>'没有查询结果!']; diff --git a/app/admin/controller/Seo.php b/app/admin/controller/Seo.php index eb42742..fabd523 100644 --- a/app/admin/controller/Seo.php +++ b/app/admin/controller/Seo.php @@ -2,7 +2,7 @@ /* * @Author: TaoLer * @Date: 2022-04-13 09:54:31 - * @LastEditTime: 2022-04-21 11:39:38 + * @LastEditTime: 2022-04-24 08:44:53 * @LastEditors: TaoLer * @Description: 搜索引擎SEO优化设置 * @FilePath: \TaoLer\app\admin\controller\Seo.php @@ -45,33 +45,41 @@ class Seo extends AdminController public function push() { - $data = Request::only(['start_id','end_id']); + $data = Request::only(['start_id','end_id','time']); if(empty(config('taoler.baidu.push_api'))) return json(['code'=>-1,'msg'=>'请先配置接口push_api']); $urls = []; if(empty($data['start_id']) || empty($data['end_id'])) { - $artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->column('id'); + $artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->whereTime('create_time', $data['time'])->column('id'); } else { - $artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->where('id','between',[$data['start_id'],$data['end_id']])->column('id'); + $artAllId = Db::name('article')->where(['delete_time'=>0,'status'=>1])->where('id','between',[$data['start_id'],$data['end_id']])->whereTime('create_time', $data['time'])->column('id'); } - + if(empty($artAllId)) return json(['code'=>-1,'msg'=>'没有查询到结果,无需推送']); + // 组装链接数组 foreach($artAllId as $aid) { $urls[] = $this->getRouteUrl($aid); } + // 百度接口单次最大提交200,进行分组 + $urls = array_chunk($urls,2000); + $api = config('taoler.baidu.push_api'); $ch = curl_init(); - $options = array( - CURLOPT_URL => $api, - CURLOPT_POST => true, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POSTFIELDS => implode("\n", $urls), - CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), - ); - curl_setopt_array($ch, $options); - $result = curl_exec($ch); - if($result == false) { - return json(['code'=>-1,'msg'=>'接口失败']); + foreach($urls as $url) { + $options = array( + CURLOPT_URL => $api, + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POSTFIELDS => implode("\n", $url), + CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), + ); + curl_setopt_array($ch, $options); + $result = curl_exec($ch); + if($result == false) { + return json(['code'=>-1,'msg'=>'接口失败']); + } } + curl_close($ch); + $res = stripos($result,'error'); $data = json_decode($result); if($res !== false) { diff --git a/app/admin/view/forum/replys.html b/app/admin/view/forum/replys.html index c82c947..df103ee 100644 --- a/app/admin/view/forum/replys.html +++ b/app/admin/view/forum/replys.html @@ -44,7 +44,7 @@ {/block} \ No newline at end of file