...
|
...
|
@@ -16,6 +16,8 @@ class Activity extends Api |
|
|
/**
|
|
|
* @ApiTitle (活动首页)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="row", type="string", required=false, description="每页显示行数[非必填]")
|
|
|
* @ApiParams (name="page", type="string", required=false, description="当前页[非必填]")
|
|
|
* @ApiReturn ({"code":状态码,
|
|
|
"msg":"提示信息"
|
|
|
"time": "时间戳",
|
...
|
...
|
@@ -29,16 +31,21 @@ class Activity extends Api |
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$row = $this->request->param('row');
|
|
|
$page = $this->request->param('page');
|
|
|
$row = $row ? $row : 10;
|
|
|
$page = $page ? $page : 1;
|
|
|
$data = db('activity')
|
|
|
->order('createtime DESC')
|
|
|
->select();
|
|
|
->paginate($row,false,['page'=>$page])
|
|
|
->each(function ($item,$key){
|
|
|
$item['images'] = cdnurl($item['images'], true);
|
|
|
$item['createtime'] = date('Y-m-d', $item['createtime']);
|
|
|
return $item;
|
|
|
});
|
|
|
if (!$data) {
|
|
|
$this->error('当前还没有活动', ['status' => 2]);
|
|
|
}
|
|
|
foreach ($data as $k => $v) {
|
|
|
$data[$k]['images'] = cdnurl($v['images'], true);
|
|
|
$data[$k]['createtime'] = date('Y-m-d', $v['createtime']);
|
|
|
}
|
|
|
$this->success('全部项目', $data);
|
|
|
|
|
|
}
|
...
|
...
|
@@ -58,18 +65,13 @@ class Activity extends Api |
|
|
*/
|
|
|
public function getSchoolItem()
|
|
|
{
|
|
|
$id = $this->request->param('id');
|
|
|
if (empty($id)) {
|
|
|
$this->error('参数错误', ['status' => 3]);
|
|
|
}
|
|
|
$data = db('campus c')
|
|
|
->join('activity a','a.id = c.activity_id')
|
|
|
->join('school s','s.id = c.school_id')
|
|
|
->where('c.activity_id', $id)
|
|
|
->field('c.*,a.title as activity_name,s.title as school_name')
|
|
|
->paginate(10,false);
|
|
|
if (empty($data)) {
|
|
|
$this->error('空空', ['status' => 3]);
|
|
|
$this->error('当前还没有校区', ['status' => 2]);
|
|
|
}
|
|
|
$this->success('项目校区', $data);
|
|
|
}
|
...
|
...
|
|