Index.php
1.1 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
<?php
namespace app\api\controller;
use app\api\model\News;
use app\common\controller\Api;
/**
* 首页接口
*/
class Index extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* @ApiTitle (首页轮播图)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
'data':'轮播图数组'
})
*/
public function banner()
{
$model = new News();
$list = $model->where('status','normal')->column('image');
$this->success('banner',$list);
}
/**
* @ApiTitle (首页分类)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
'data':'轮播图数组'
})
*/
public function category()
{
$model = new Cat();
$list = $model->where('status','normal')->column('image');
$this->success('banner',$list);
}
}