IndexController.php
3.7 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace api\home\controller;
use cmf\controller\RestBaseController;
/**
* @title 首页
*/
class IndexController extends RestBaseController
{
/**
* @title 首页
* @description 接口说明
* @author 开发者
* @url /api/home/index/index
* @method GET
*
* @param name:language type:string require:0 default: other desc:语言切换(英文传递此字段(en),中文无需传递)
*
* @return rotation:轮播图@
* @rotation id:轮播图id thumbnail:图片路径 link:立即查看链接
*
* @return about:关于我们@!
* @about id:关于我们id thumbnail:图片路径 introduce:简介
*
* @return type:我们的产品@
* @type id:产品id thumbnail:图片路径 name:分类名称 children_name:分类子名称
*
* @return advantage:我们的优势@
* @advantage id:优势id title:标题 introduce:简介
*
* @return contact:联系我们@!
* @contact id:联系我们id address:地址 mobile:电话 phone:手机 wx:微信 email:邮箱
*/
public function index(){
$language = $this->request->param('language');
$arr = [];
//轮播图
$res_rotation = CommonController::selectNoPositionData('rotation','id,thumbnail,link');
$arr['rotation'] = $res_rotation;
//关于我们
if(isset($language) && !empty($language)){
//英文
$field_about = 'id,thumbnail,introduce_en introduce';
}else{
//中文
$field_about = 'id,thumbnail,introduce';
}
$res_about = CommonController::findData('about',['id'=>1],$field_about);
$arr['about'] = $res_about;
//我们的产品(系列)
if(isset($language) && !empty($language)){
//英文
$field_type = 'id,pid,thumbnail,name_en name';
$flag = 'name';
}else{
//中文
$field_type = 'id,pid,thumbnail,name';
$flag = 'name';
}
$res_type = CommonController::getSeriesType($field_type,$flag);
$arr['type'] = $res_type;
//我们的优势
if(isset($language) && !empty($language)){
//英文
$field_advantage = 'id,title_en title,introduce_en introduce';
}else{
//中文
$field_advantage = 'id,title,introduce';
}
$res_advantage = CommonController::selectLimitData('advantage',$field_advantage,3);
$arr['advantage'] = $res_advantage;
//联系我们
if(isset($language) && !empty($language)){
//英文
$field_contact = 'id,address_en address,mobile,phone,wx,email';
}else{
//中文
$field_contact = 'id,address,mobile,phone,wx,email';
}
$res_contact = CommonController::findData('contact',['id'=>1],$field_contact);
$arr['contact'] = $res_contact;
$this->success('成功',$arr);
}
/**
* @title 七牛云域名
* @description 接口说明
* @author 开发者
* @url /api/home/index/qiNiuDomain
* @method GET
*
* @return domain:七牛云域名
*/
public function qiNiuDomain(){
//七牛域名
$arr['domain'] = CommonController::domain;
$this->success('成功',$arr);
}
}