SlidesController.php
1.3 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
<?php
// +----------------------------------------------------------------------
// | 文件说明:幻灯片
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Date: 2017-5-25
// +----------------------------------------------------------------------
namespace api\home\controller;
use api\home\model\SlideModel;
use cmf\controller\RestBaseController;
class SlidesController extends RestBaseController
{
/**
* [获取幻灯片]
* @Author: wuwu<15093565100@163.com>
* @DateTime: 2017-05-25T20:48:53+0800
* @since: 1.0
*/
public function read()
{
//slide为空或不存在抛出异常
$id = $this->request->param('id', 0, 'intval');
if (empty($id)) {
$this->error('缺少ID参数');
}
$map['id'] = $id;
$obj = new SlideModel();
$data = $obj->SlideList($map);
//剔除分类状态隐藏 剔除分类下显示数据为空
if ($data->isEmpty() || empty($data->toArray()[0]['items'])) {
$this->error('该组幻灯片显示数据为空');
}
$this->success("该组幻灯片获取成功!", $data);
}
}