|
|
<?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 SeriesController extends HomeBaseController
|
|
|
{
|
|
|
//产品系列
|
|
|
|
|
|
|
|
|
//产品系列分类
|
|
|
public function seriesType(){
|
|
|
$language = $this->request->param('language');
|
|
|
|
|
|
if(isset($language) && !empty($language)){
|
|
|
//英文
|
|
|
$field_type = 'id,pid,thumbnail,name_en';
|
|
|
}else{
|
|
|
//中文
|
|
|
$field_type = 'id,pid,thumbnail,name';
|
|
|
}
|
|
|
$parent_res = CommonController::findSeriesType($field_type);
|
|
|
$this->assign('parent_res',$parent_res);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
//产品系列列表
|
|
|
public function seriesList(){
|
|
|
$language = $this->request->param('language');
|
|
|
$children_id = $this->request->param('children_id');//二级分类id
|
|
|
if(isset($language) && !empty($language)){
|
|
|
//英文
|
|
|
$field_series = 'id,thumbnail,title_en';
|
|
|
}else{
|
|
|
//中文
|
|
|
$field_series = 'id,thumbnail,title';
|
|
|
}
|
|
|
$res = Db::name('series')
|
|
|
->where(['t_id'=>$children_id])
|
|
|
->field($field_series)
|
|
|
->order('id desc')
|
|
|
->paginate(10,false,['query'=>request()->param()]);
|
|
|
$data = $res->toArray();
|
|
|
$page = $res->render();
|
|
|
$this->assign('res',$data['data']);
|
|
|
$this->assign('page',$page);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
//产品系列详情
|
|
|
public function seriesDetail(){
|
|
|
$language = $this->request->param('language');
|
|
|
$children_id = $this->request->param('children_id');//二级分类id
|
|
|
$series_id = $this->request->param('series_id');//列表id
|
|
|
if(isset($language) && !empty($language)){
|
|
|
//英文
|
|
|
$field_series = 'id,thumbnail,title_en,detail_en,hotline';
|
|
|
$flag = 'name_en';
|
|
|
}else{
|
|
|
//中文
|
|
|
$field_series = 'id,thumbnail,title,detail,hotline';
|
|
|
$flag = 'name';
|
|
|
}
|
|
|
$res = CommonController::findData('series',['id'=>$series_id,'t_id'=>$children_id],$field_series);
|
|
|
$this->assign('res',$res);
|
|
|
|
|
|
//查找父类名称
|
|
|
$pid = CommonController::findData('type',['id'=>$children_id],'pid');
|
|
|
$parent_name = CommonController::findData('type',['id'=>$pid['pid']],$flag);
|
|
|
$this->assign('parent_name',$parent_name);
|
|
|
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
} |
...
|
...
|
|