ServiceController.php 1.8 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;
use think\Db;
class ServiceController extends HomeBaseController
{
    //主要服务


    //主要服务分类
    public function serviceType(){
        $language = $this->request->param('language');

        if(isset($language) && !empty($language)){
            //英文
            $field_service = 'id,name_en';
        }else{
            //中文
            $field_service = 'id,name';
        }
        $parent_res = CommonController::selectNoPositionData('service',$field_service);
        $this->assign('parent_res',$parent_res);
        return $this->fetch();
    }

    //主要服务详情
    public function serviceDetail(){
        $language = $this->request->param('language');
        $service_id = $this->request->param('service_id');
        if(isset($language) && !empty($language)){
            //英文
            $field_service = 'id,name_en,detail_en';
        }else{
            //中文
            $field_service = 'id,name,detail';
        }
        $res = CommonController::findData('service',['id'=>$service_id],$field_service);
        $this->assign('res',$res);

        return $this->fetch();
    }
}