DetailController.class.php
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Created by PhpStorm.
* User: zhonglei
* Date: 17/2/22
* Time: 09:59
*/
namespace Frontend\Controller\Index;
use Common\Common\Constant;
use Common\Service\ArticleService;
class DetailController extends AbstractController
{
/**
* 跳转至手机端新闻详情页
*/
public function Index()
{
$article_id = I('get.article_id', 0, 'intval');
if (empty($article_id)) {
E('_ERR_ARTICLE_ID_IS_EMPTY');
}
// 取新闻信息
$articleServ = new ArticleService();
$articleInfo = $articleServ->get($article_id);
if (empty($articleInfo)) {
redirectFront('/app/page/news/detail/detail', ['article_id' => $article_id]);
}
// 跳转至详情或外链
if ($articleInfo['is_jump'] == Constant::NEWS_IS_JUMP_TRUE && !empty($articleInfo['link'])) {
header('location:' . $articleInfo['link']);
} else {
redirectFront('/app/page/news/detail/detail', ['article_id' => $article_id]);
}
}
}