IndexController.php
2.6 KB
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
<?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();
}
}