This week article

This commit is contained in:
toogee 2020-05-14 12:33:10 +08:00
parent e9ae3e5eec
commit 4394f78cbc
2 changed files with 7 additions and 5 deletions

View File

@ -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'=>'本周还没评论'];

View File

@ -196,7 +196,7 @@ layui.define(function(exports){
,cellMinWidth: 120
,cols: [[
{type: 'numbers', fixed: 'left'}
,{field: 'title', title: '标题', minWidth: 300, templet: '<div><a href="/index/jie/{{d.id}}.html" target="_blank" class="layui-table-link">{{ d.title }}</div>'}
,{field: 'title', title: '标题', minWidth: 300, templet: '<div><a href="{{d.id}}" target="_blank" class="layui-table-link">{{ d.title }}</div>'}
,{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: '<div><a href="/index/jie/{{d.cid}}.html" target="_blank" class="layui-table-link">{{ d.title }}</div>'}
,{field: 'title', title: '帖子', minWidth: 200, templet: '<div><a href="{{d.cid}}" target="_blank" class="layui-table-link">{{ d.title }}</div>'}
,{field: 'name', title: '评论者'}
]]