作者 开飞机的舒克

后台修改

@@ -82,6 +82,7 @@ class Study extends Backend @@ -82,6 +82,7 @@ class Study extends Backend
82 82
83 $excel = new \PHPExcel(); 83 $excel = new \PHPExcel();
84 try { 84 try {
  85 + $excel->getProperties()->setTitle("积分表");
85 $excel->getActiveSheet()->getColumnDimension('A')->setWidth(10); 86 $excel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
86 $excel->getActiveSheet()->getColumnDimension('B')->setWidth(10); 87 $excel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
87 $excel->getActiveSheet()->getColumnDimension('C')->setWidth(10); 88 $excel->getActiveSheet()->getColumnDimension('C')->setWidth(10);
@@ -108,9 +109,9 @@ class Study extends Backend @@ -108,9 +109,9 @@ class Study extends Backend
108 ->setCellValue('G1', '学号') 109 ->setCellValue('G1', '学号')
109 ->setCellValue('H1', '总积分'); 110 ->setCellValue('H1', '总积分');
110 if ($ids == 'all' || empty($ids)) { //判断当前数据为全部或者选中的 111 if ($ids == 'all' || empty($ids)) { //判断当前数据为全部或者选中的
111 - $list = $this->model->with('school')->select(); 112 + $list = $this->model->with('school,grade')->select();
112 } else { 113 } else {
113 - $list = $this->model->with('school')->select($ids); 114 + $list = $this->model->with('school,grade')->select($ids);
114 } 115 }
115 116
116 foreach ($list as $k => $val) { 117 foreach ($list as $k => $val) {
@@ -121,7 +122,7 @@ class Study extends Backend @@ -121,7 +122,7 @@ class Study extends Backend
121 ->setCellValue('A' . $k, $val['id']) 122 ->setCellValue('A' . $k, $val['id'])
122 ->setCellValue('B' . $k, $val['name']) 123 ->setCellValue('B' . $k, $val['name'])
123 ->setCellValue('C' . $k, $val['gender'] ? '男' : '女') 124 ->setCellValue('C' . $k, $val['gender'] ? '男' : '女')
124 - ->setCellValue('D' . $k, $val['grade']) 125 + ->setCellValue('D' . $k, $val['grade']['name'])
125 ->setCellValue('E' . $k, $val['school']['title']) 126 ->setCellValue('E' . $k, $val['school']['title'])
126 ->setCellValue('F' . $k, $val['unique']) 127 ->setCellValue('F' . $k, $val['unique'])
127 ->setCellValue('G' . $k, $val['sno']) 128 ->setCellValue('G' . $k, $val['sno'])
@@ -31,18 +31,20 @@ class Screen extends Api @@ -31,18 +31,20 @@ class Screen extends Api
31 $list = []; 31 $list = [];
32 $data = db('screen')->find(); 32 $data = db('screen')->find();
33 $list['images'] = cdnurl($data['images'],true); 33 $list['images'] = cdnurl($data['images'],true);
34 - if ($data['starttime']<=$time || $data['endtime']>=$time){  
35 - $times = $data['endtime'] - $time;  
36 - $data['count_down'] = date('H:i:s',$times); 34 + if ($data['starttime']<=$time && $data['endtime']>=$time){
  35 + $day = intval(($data['endtime']-$time)/86400);
  36 + $hour = intval((($data['endtime']-$time)%86400)/3600);
  37 + $minute = intval(((($data['endtime']-$time)%86400)%3600)/60);
  38 + $second = intval(((($data['endtime']-$time)%86400)%3600)%60);
  39 + $list['count_down'] = "距离活动结束还有".$day."天".$hour."时".$minute."分".$second."秒";
  40 + }else if ($data['endtime']<=$time){
  41 + $list['count_down'] = "距离活动结束还有00天00时00分00秒";
37 } 42 }
38 - $res = db('campus c')  
39 - ->join('school s','c.school_id = s.id')  
40 - ->join('activity a','c.activity_id = a.id') 43 + $list['screen_name'] = $data['title'];
  44 + $list['campus_name'] = db('campus c')
41 ->where('c.id',$data['campus_id']) 45 ->where('c.id',$data['campus_id'])
42 - ->field('c.activity_id,c.school_id,c.date,s.title as school_name,a.title as activity_name')  
43 - ->find(); 46 + ->value('title');
44 $list['time'] = date('Y-m-d H:i:s',time()); 47 $list['time'] = date('Y-m-d H:i:s',time());
45 - $list['campus'] = $res['date'].$res['school_name'].$res['activity_name'];  
46 $list['team_rank'] = \db('study_score_log') 48 $list['team_rank'] = \db('study_score_log')
47 ->field('SUM(score) as sum_score,team_id') 49 ->field('SUM(score) as sum_score,team_id')
48 ->where('campus_id',$data['campus_id']) 50 ->where('campus_id',$data['campus_id'])