From 4394f78cbca13f0f0f0795c7f8adb8e7eff220a3 Mon Sep 17 00:00:00 2001 From: toogee Date: Thu, 14 May 2020 12:33:10 +0800 Subject: [PATCH] This week article --- app/admin/controller/Index.php | 8 +++++--- public/static/admin/modules/console.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 5a82318..e517b75 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -8,6 +8,7 @@ use think\facade\Session; use think\facade\Request; use app\admin\model\Admin; use app\admin\model\Article; +use think\facade\Config; class Index extends AdminController { @@ -15,7 +16,8 @@ class Index extends AdminController protected function initialize() { parent::initialize(); - + $this->domain = Request::scheme().'://www.'.Request::rootDomain(); + //dump($this->domain); } public function index() @@ -63,7 +65,7 @@ class Index extends AdminController $res['msg'] = ''; $res['count'] = $count; foreach($forumList as $k=>$v){ - $res['data'][]= ['id'=>$v['aid'],'title'=>$v['title'],'name'=>$v['name'],'catename'=>$v['catename'],'pv'=>$v['pv']]; + $res['data'][]= ['id'=>str_replace("admin","index",$this->domain.(string) url('article/detail',['id'=>$v['aid']])),'title'=>$v['title'],'name'=>$v['name'],'catename'=>$v['catename'],'pv'=>$v['pv']]; } } else { $res = ['code'=>-1,'msg'=>'本周还没有发帖!']; @@ -90,7 +92,7 @@ class Index extends AdminController if ($count) { $res = ['code'=>0,'msg'=>'','count'=>$count]; foreach($replys as $k => $v){ - $res['data'][] = ['content'=>$v['content'],'title'=>$v['title'],'cid'=>$v['cid'],'name'=>$v['name']]; + $res['data'][] = ['content'=>$v['content'],'title'=>$v['title'],'cid'=>str_replace("admin","index",$this->domain.(string) url('article/detail',['id'=>$v['cid']])),'name'=>$v['name']]; } } else { $res = ['code'=>-1,'msg'=>'本周还没评论']; diff --git a/public/static/admin/modules/console.js b/public/static/admin/modules/console.js index f616547..d89262f 100644 --- a/public/static/admin/modules/console.js +++ b/public/static/admin/modules/console.js @@ -196,7 +196,7 @@ layui.define(function(exports){ ,cellMinWidth: 120 ,cols: [[ {type: 'numbers', fixed: 'left'} - ,{field: 'title', title: '标题', minWidth: 300, templet: '
{{ d.title }}
'} + ,{field: 'title', title: '标题', minWidth: 300, templet: '
{{ d.title }}
'} ,{field: 'name', title: '发帖者'} ,{field: 'catename', title: '类别'} ,{field: 'pv', title: '点击率', sort: true} @@ -213,7 +213,7 @@ layui.define(function(exports){ ,cols: [[ {type: 'numbers', fixed: 'left'} ,{field: 'content', title: '评论', minWidth: 300} - ,{field: 'title', title: '帖子', minWidth: 200, templet: '
{{ d.title }}
'} + ,{field: 'title', title: '帖子', minWidth: 200, templet: '
{{ d.title }}
'} ,{field: 'name', title: '评论者'} ]]