1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- /**
- * NewsController.php UTF-8
- * 新闻处理类
- *
- * @date : 2018/1/19 16:25
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : linjiebin <ljb@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace web\pc\controller\v8;
- use huolib\constant\NewsConst;
- use web\common\controller\WebBaseController;
- use web\pc\logic\SlideLogic;
- use web\pc\logic\PostLogic;
- class NewsController extends WebBaseController {
- public function __construct() {
- parent::__construct();
- }
- public function index() {
- $_web_info = $this->web_info;
- $this->set_seo($_web_info['web_basic']['company_name']);
- $_posts_class = new PostLogic();
- $_row = $this->request->param('row', 10);
- $_new_page = $this->request->param('new_page', 1);
- $_activity_page = $this->request->param('activity_page', 1);
- $_strategy_page = $this->request->param('strategy_page', 1);
- $_news_list['new'] = $_posts_class->getList(['catalog' => NewsConst::NEWS_TYPE_NEWS], $_new_page.','.$_row,'id desc');
- $_news_list['activity'] = $_posts_class->getList(['catalog' => NewsConst::NEWS_TYPE_STRATEGY], $_activity_page.','.$_row);
- $_news_list['strategy'] = $_posts_class->getList(['catalog' => NewsConst::NEWS_TYPE_ACTIVITY], $_strategy_page.','.$_row);
- $_title_map = [
- 'catalog'=>[
- 'in',
- [NewsConst::NEWS_TYPE_NEWS, NewsConst::NEWS_TYPE_STRATEGY, NewsConst::NEWS_TYPE_ACTIVITY]
- ]
- ];
- $_title_list = $_posts_class->getList($_title_map, '1,3');
- $_rdata = [
- 'news_list' => $_news_list,
- 'title_list' => $_title_list
- ];
- if($this->request->isAjax()){
- return $_rdata;
- }
- $this->assign($_rdata);
- return $this->fetch('News/index');
- }
- public function detail() {
- $_newsid = $this->request->param('newsid', 0);
- if(empty($_newsid)) {
- $this->error('参数错误');
- }
- $_posts_class = new PostLogic();
- $_rdata['detail'] = $_posts_class->getDetail($_newsid);
- if(!empty($_rdata['detail']['gameid'])) {
- $_map['gameid'] = $_rdata['detail']['gameid'];
- }else{
- $_map['catalog'] = $_rdata['detail']['type'];
- }
- $_rdata['similar'] = $_posts_class->getList($_map,'1,4');
- $_web_info = $this->web_info;
- $this->set_seo($_web_info['web_basic']['company_name'],'',$_rdata['detail']['title']);
- $this->assign($_rdata);
- return $this->fetch('News/detail');
- }
- }
|