Index.php
6.0 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
namespace app\api\controller;
use app\common\controller\Api;
/**
* 首页接口
*/
class Index extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* @ApiTitle (首页)
* @ApiSummary (首页)
* @ApiMethod (GET)
* @ApiRoute (/api/index/index)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463253",
"data": {
"banner": [//轮播图
{
"id": 2,//id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片路径
"sort": 0
},
{
"id": 1,
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",
"sort": 0
}
],
"thumbnail": {//缩略图
"introduce": "http://mite.w.brotop.cn/uploads/20200107/e0bf0b8d402b5447575389b8bd57c225.png",//公司简介缩略图
"service": "http://mite.w.brotop.cn/uploads/20200107/b48a6582d12da1fdafce424afbb3384d.png",//服务介绍缩略图
"experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
"register": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员注册缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//个人中心缩略图
"reserve": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//一键预约缩略图
}
}
})
*/
public function index(){
if($this->request->isGet()){
$arr = [];
//轮播图
$banner = Common::selectData('banner','id,image,sort','sort desc,id desc');
foreach ($banner as &$b_value){
$b_value['image'] = Common::absolutionUrlOne($b_value['image']);
}
$arr['banner'] = $banner;
//缩略图
$introduce = Common::findWhereData('platform',['id'=>1],'id,thumbnail');//公司简介
$service = Common::findWhereData('platform',['id'=>2],'id,thumbnail');//服务介绍
$experience = Common::findWhereData('platform',['id'=>3],'id,thumbnail');//服务体验
$register = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员注册
$center = Common::findWhereData('platform',['id'=>5],'id,thumbnail');//个人中心
$reserve = Common::findWhereData('platform',['id'=>6],'id,thumbnail');//一键预约
$arr['thumbnail']['introduce'] = Common::absolutionUrlOne($introduce['thumbnail']);
$arr['thumbnail']['service'] = Common::absolutionUrlOne($service['thumbnail']);
$arr['thumbnail']['experience'] = Common::absolutionUrlOne($experience['thumbnail']);
$arr['thumbnail']['register'] = Common::absolutionUrlOne($register['thumbnail']);
$arr['thumbnail']['center'] = Common::absolutionUrlOne($center['thumbnail']);
$arr['thumbnail']['reserve'] = Common::absolutionUrlOne($reserve['thumbnail']);
$this->success('成功',$arr);
}else{
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (公司简介详情)
* @ApiSummary (公司简介详情)
* @ApiMethod (GET)
* @ApiRoute (/api/index/introduceDetail)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 1,//详情id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片
"content": " Lorem ipsum dolor sit amet, consectetu s"//内容(富文本)
}
})
*/
public function introduceDetail(){
if($this->request->isGet()){
$res = Common::findWhereData('platform',['id'=>1],'id,image,content');
$res['image'] = Common::absolutionUrlOne($res['image']);
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (服务介绍详情)
* @ApiSummary (服务介绍详情)
* @ApiMethod (GET)
* @ApiRoute (/api/index/serviceDetail)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 2,//详情id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片
"content": " Lorem ipsum dolor sit amet, consectetu s"//内容(富文本)
}
})
*/
public function serviceDetail(){
if($this->request->isGet()){
$res = Common::findWhereData('platform',['id'=>2],'id,image,content');
$res['image'] = Common::absolutionUrlOne($res['image']);
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (服务体验详情)
* @ApiSummary (服务体验详情)
* @ApiMethod (GET)
* @ApiRoute (/api/index/experienceDetail)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 3,//详情id
"content": " Lorem ipsum dolor sit amet, consectetu s"//内容
}
})
*/
public function experienceDetail(){
if($this->request->isGet()){
$res = Common::findWhereData('platform',['id'=>3],'id,content');
$res['content'] = cdnurl($res['content']);
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
}