作者 开飞机的舒克

更新大屏接口

@@ -17,8 +17,6 @@ class Screen extends Api @@ -17,8 +17,6 @@ class Screen extends Api
17 * @ApiTitle (大屏管理) 17 * @ApiTitle (大屏管理)
18 * @ApiMethod (POST) 18 * @ApiMethod (POST)
19 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 19 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
20 - * @ApiParams (name="xq", type="string", required=true, description="校区id[必填]")  
21 - * @ApiParams (name="hd", type="string", required=true, description="活动id[必填]")  
22 * @ApiReturn ({"code":状态码, 20 * @ApiReturn ({"code":状态码,
23 "msg":"提示信息" 21 "msg":"提示信息"
24 "time": "时间戳", 22 "time": "时间戳",
@@ -29,7 +27,6 @@ class Screen extends Api @@ -29,7 +27,6 @@ class Screen extends Api
29 "starttime": 校区活动开始时间, 27 "starttime": 校区活动开始时间,
30 "endtime": 校区活动结束时间, 28 "endtime": 校区活动结束时间,
31 "is_view": 是否展示, 29 "is_view": 是否展示,
32 - "hd_name": "活动名称",  
33 "createtime": 创建时间, 30 "createtime": 创建时间,
34 "updatetime": 更新时间, 31 "updatetime": 更新时间,
35 "count_down": "倒计时", 32 "count_down": "倒计时",
@@ -43,7 +40,7 @@ class Screen extends Api @@ -43,7 +40,7 @@ class Screen extends Api
43 "title": "坦克战队", 40 "title": "坦克战队",
44 "score": "13.00", 41 "score": "13.00",
45 "team_id": 1, 42 "team_id": 1,
46 - "study": 战队个人排行{ 43 + "study": 战队个人排行{
47 "data": [{ 44 "data": [{
48 "name": "李四", 45 "name": "李四",
49 "earn_score": "12.00" 46 "earn_score": "12.00"
@@ -51,33 +48,30 @@ class Screen extends Api @@ -51,33 +48,30 @@ class Screen extends Api
51 }) 48 })
52 */ 49 */
53 public function index(){ 50 public function index(){
54 - $xq = $this->request->param('xq');  
55 - $hd = $this->request->param('hd');  
56 - if (empty($xq)) {  
57 - $this->error('参数错误', ['status' => 2]);  
58 - }  
59 $time = time(); 51 $time = time();
60 - $data = db('data_screen')  
61 - ->where('school_id',$xq)  
62 - ->find(); 52 + $data = db('data_screen')->find();
63 $data['images'] = cdnurl($data['images'],true); 53 $data['images'] = cdnurl($data['images'],true);
64 - $data['hd_name'] = db('activity')  
65 - ->field('title')  
66 - ->where('id',$hd)  
67 - ->find();  
68 if ($data['starttime']<=$time || $data['endtime']>=$time){ 54 if ($data['starttime']<=$time || $data['endtime']>=$time){
69 $times = $data['endtime'] - $time; 55 $times = $data['endtime'] - $time;
70 $data['count_down'] = date('H:i:s',$times); 56 $data['count_down'] = date('H:i:s',$times);
71 } 57 }
  58 + $res = db('campus c')
  59 + ->join('school s','c.school_id = s.id')
  60 + ->join('activity a','c.activity_id = a.id')
  61 + ->where('c.id',$data['campus_id'])
  62 + ->field('c.activity_id,c.school_id,c.date,s.title as school_name,a.title as activity_name')
  63 + ->find();
  64 + $data['time'] = date('Y-m-d H:i:s',time());
  65 + $data['campus'] = $res['date'].$res['school_name'].$res['activity_name'];
72 $data['team_score'] = \db('study_score_log') 66 $data['team_score'] = \db('study_score_log')
73 ->field('SUM(score) as sum_score,team_id') 67 ->field('SUM(score) as sum_score,team_id')
74 - ->where('school_id',$xq) 68 + ->where('campus_id',$data['campus_id'])
75 ->group('team_id') 69 ->group('team_id')
76 ->order('sum_score DESC') 70 ->order('sum_score DESC')
77 ->paginate(4,false); 71 ->paginate(4,false);
78 $data['study_score'] = db('study_score_log') 72 $data['study_score'] = db('study_score_log')
79 ->field('study_id,SUM(score) as sum_score,team_id') 73 ->field('study_id,SUM(score) as sum_score,team_id')
80 - ->where('school_id',$xq) 74 + ->where('campus_id',$data['campus_id'])
81 ->order('sum_score DESC') 75 ->order('sum_score DESC')
82 ->group('study_id') 76 ->group('study_id')
83 ->paginate(10); 77 ->paginate(10);