IndexController.php 2.6 KB
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
class IndexController extends HomeBaseController
{
    //首页
    public function index(){
        $language = $this->request->param('language');
        //轮播图
        $res_rotation = CommonController::selectNoPositionData('rotation','id,thumbnail,link');
        $this->assign('res_rotation',$res_rotation);

        //关于我们
        if(isset($language) && !empty($language)){
            //英文
            $field_about = 'id,thumbnail,introduce_en';
        }else{
            //中文
            $field_about = 'id,thumbnail,introduce';
        }
        $res_about = CommonController::findData('about',['id'=>1],$field_about);
        $this->assign('res_about',$res_about);

        //我们的产品(系列)
        if(isset($language) && !empty($language)){
            //英文
            $field_type = 'id,pid,thumbnail,name_en';
            $flag = 'name_en';
        }else{
            //中文
            $field_type = 'id,pid,thumbnail,name';
            $flag = 'name';
        }
        $res_type = CommonController::getSeriesType($field_type,$flag);
        $this->assign('res_type',$res_type);

        //我们的优势
        if(isset($language) && !empty($language)){
            //英文
            $field_advantage = 'id,title_en,introduce_en';
        }else{
            //中文
            $field_advantage = 'id,title,introduce';
        }
        $res_advantage = CommonController::selectLimitData('advantage',$field_advantage,3);
        $this->assign('res_advantage',$res_advantage);

        //联系我们
        if(isset($language) && !empty($language)){
            //英文
            $field_contact = 'id,address_en,mobile,phone,wx,email';
        }else{
            //中文
            $field_contact = 'id,address,mobile,phone,wx,email';
        }
        $res_contact = CommonController::findData('contact',['id'=>1],$field_contact);
        $this->assign('res_contact',$res_contact);

        return $this->fetch();
    }
}