IndexController.php 2.4 KB
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;

class IndexController extends HomeBaseController
{
    public function index()
    {

        //首页头部图片
        $image = Db::name('slide_item') -> where('slide_id',2) -> find();
        $this -> assign('image',$image);

        //首页关于我们
        $about_data = Db::name('portal_post') -> where('id',1) -> find();
        $about_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($about_data['post_content']));
        $this -> assign('about_data',$about_data);

        //首页中心设备
        $shebei_data = Db::name('portal_post') -> where('id',2) -> find();
        $shebei_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shebei_data['post_content']));
        $this -> assign('shebei_data',$shebei_data);

        $sheshi_data = Db::name('portal_post') -> where('id',47) -> find();
        $sheshi_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shebei_data['post_content']));
        $this -> assign('sheshi_data',$sheshi_data);

        $fuwu_data = Db::name('portal_post') -> where('id',48) -> find();
        $fuwu_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shebei_data['post_content']));
        $this -> assign('fuwu_data',$fuwu_data);

        //首页澳德咨询
        $new_data = Db::name('portal_category_post') -> alias('a') -> join('portal_post b','a.post_id=b.id','LEFT') -> where('category_id',22) -> order('b.id desc') -> limit(5) -> select();
        $this -> assign('new_data',$new_data[0]);

        foreach ($new_data as $key => $val){
            if($key != 0){
                $newdata[] = $val;
            }
        }
        $this -> assign('newdata',$newdata);


        return $this->fetch(':index');


    }






















}