审查视图

app/portal/controller/NewsController.php 5.3 KB
景龙 authored
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
<?php
/**
 * 新闻与媒体
 * Author : xiaojie
 * DateTime: 2018/12/06 11:42
 */
namespace app\portal\controller;

use app\portal\model\PageModel;
use app\portal\model\PortalCategoryModel;
use app\portal\model\ShowModel;
use cmf\controller\HomeBaseController;

class NewsController extends HomeBaseController
{

    /**
     * 行业新闻,展会新闻,媒体报道,展会视频(36,37,38,39)
     * portal/news/news
     */
    public function news()
    {
        $cate_id = $this->request->param('cate_id');
        $showModel = new ShowModel();
        $list = $showModel->getList($cate_id);
        if($cate_id == 36){
            $location = '行业新闻';
            $menu_id = '42';
        }elseif ($cate_id == 37){
            $location = '展会新闻';
            $menu_id = '43';
        }elseif ($cate_id == 38){
            $location = '媒体报道';
            $menu_id = '44';
        }else{
            return false;
        }
        //分页样式
        $page = $this->getPageStyle($list);
        //所在位置
        $location = [
            [
                'location' => '新闻与媒体',
                'url' => 'javascript:;'
            ],
            [
                'location' => $location,
                'url' => 'javascript:;'
            ]
        ];
        $this->assign('list',$list);
        $this->assign('location',$location);
        $this->assign('page',$page);
        $this->assign('menu_id',$menu_id);
        return $this->fetch(':list');
    }

    /**
     * 展会视频
     * portal/news/video
     */
    public function video()
    {
        $cate_id = 39;
        $showModel = new ShowModel();
        $list = $showModel->getList($cate_id,'',6);
        //分页样式
        $page = $this->getPageStyle($list);
        //所在位置
        $location = [
            [
                'location' => '新闻与媒体',
                'url' => 'javascript:;'
            ],
            [
                'location' => '展会视频',
                'url' => 'javascript:;'
            ]
        ];

        $this->assign('list',$list);
        $this->assign('location',$location);
        $this->assign('page',$page);
        return $this->fetch();
    }


    /**
     * 合作媒体
     * portal/news/media
     */
    public function media()
    {
//        $cate_id = 40;
//        $showModel = new ShowModel();
//        $list = $showModel->getList($cate_id,'',16);
//        //分页样式
//        $page = $this->getPageStyle($list);
//        //所在位置
//        $location = [
//            [
//                'location' => '新闻与媒体',
//                'url' => 'javascript:;'
//            ],
//            [
//                'location' => '合作媒体',
//                'url' => 'javascript:;'
//            ]
//        ];
//
//        $this->assign('list',$list);
//        $this->assign('page',$page);
//        $this->assign('location',$location);
//        return $this->fetch();
        $keyword = $this->request->param('keyword','');
        $showModel = new ShowModel();
jinglong authored
117
        $list = $showModel->getList(40,$keyword,16,'sort desc');
景龙 authored
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
        $page = $this->getPageStyle($list);
        //所在位置
        $location = [
            [
                'location' => '新闻与媒体',
                'url' => 'javascript:;'
            ],
            [
                'location' => '合作媒体',
                'url' => 'javascript:;'
            ]
        ];
        $this->assign('list',$list);
        $this->assign('location',$location);
        $this->assign('page',$page);
        $this->assign('keyword',empty($keyword)?'':$keyword);
        return $this->fetch();
    }


    /**
     * 下载中心
     * portal/news/download
     */
    public function download()
    {
        $cate_id = 41;
        $showModel = new ShowModel();
        $list = $showModel->getList($cate_id,'',17);
        //分页样式
        $page = $this->getPageStyle($list);
        //所在位置
        $location = [
            [
                'location' => '新闻与媒体',
                'url' => 'javascript:;'
            ],
            [
                'location' => '下载中心',
                'url' => 'javascript:;'
            ]
        ];

        $this->assign('list',$list);
        $this->assign('page',$page);
        $this->assign('location',$location);
        return $this->fetch();
    }

    /**
     * 下载操作
     */
    public function download_file()
    {
        $id = $this->request->param('id');
        $showModel = new ShowModel();
        //增加下载次数
        $showModel->where('id',$id)->setInc('down_num',1);
        $this->apiResponse(1,'操作成功');
    }

    /**
     * 全部新闻
     * portal/news/all_news
     */
    public function all_news()
    {
        $cate_id = [36,37,38];
        $showModel = new ShowModel();
        $list = $showModel->getList($cate_id);
        //分页样式
        $page = $this->getPageStyle($list);
        //所在位置
        $location = [
            [
                'location' => '全部新闻',
                'url' => 'javascript:;'
            ],
            [
                'location' => '',
                'url' => 'javascript:;'
            ]
        ];
        $this->assign('list',$list);
        $this->assign('location',$location);
        $this->assign('page',$page);
        return $this->fetch(':list');
    }

}