作者 开飞机的舒克

更新大屏接口

... ... @@ -17,8 +17,6 @@ class Screen extends Api
* @ApiTitle (大屏管理)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="xq", type="string", required=true, description="校区id[必填]")
* @ApiParams (name="hd", type="string", required=true, description="活动id[必填]")
* @ApiReturn ({"code":状态码,
"msg":"提示信息"
"time": "时间戳",
... ... @@ -29,7 +27,6 @@ class Screen extends Api
"starttime": 校区活动开始时间,
"endtime": 校区活动结束时间,
"is_view": 是否展示,
"hd_name": "活动名称",
"createtime": 创建时间,
"updatetime": 更新时间,
"count_down": "倒计时",
... ... @@ -43,7 +40,7 @@ class Screen extends Api
"title": "坦克战队",
"score": "13.00",
"team_id": 1,
"study": 战队个人排行{
"study": 战队个人排行{
"data": [{
"name": "李四",
"earn_score": "12.00"
... ... @@ -51,33 +48,30 @@ class Screen extends Api
})
*/
public function index(){
$xq = $this->request->param('xq');
$hd = $this->request->param('hd');
if (empty($xq)) {
$this->error('参数错误', ['status' => 2]);
}
$time = time();
$data = db('data_screen')
->where('school_id',$xq)
->find();
$data = db('data_screen')->find();
$data['images'] = cdnurl($data['images'],true);
$data['hd_name'] = db('activity')
->field('title')
->where('id',$hd)
->find();
if ($data['starttime']<=$time || $data['endtime']>=$time){
$times = $data['endtime'] - $time;
$data['count_down'] = date('H:i:s',$times);
}
$res = db('campus c')
->join('school s','c.school_id = s.id')
->join('activity a','c.activity_id = a.id')
->where('c.id',$data['campus_id'])
->field('c.activity_id,c.school_id,c.date,s.title as school_name,a.title as activity_name')
->find();
$data['time'] = date('Y-m-d H:i:s',time());
$data['campus'] = $res['date'].$res['school_name'].$res['activity_name'];
$data['team_score'] = \db('study_score_log')
->field('SUM(score) as sum_score,team_id')
->where('school_id',$xq)
->where('campus_id',$data['campus_id'])
->group('team_id')
->order('sum_score DESC')
->paginate(4,false);
$data['study_score'] = db('study_score_log')
->field('study_id,SUM(score) as sum_score,team_id')
->where('school_id',$xq)
->where('campus_id',$data['campus_id'])
->order('sum_score DESC')
->group('study_id')
->paginate(10);
... ...