作者 开飞机的舒克

后台修改

... ... @@ -82,6 +82,7 @@ class Study extends Backend
$excel = new \PHPExcel();
try {
$excel->getProperties()->setTitle("积分表");
$excel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
$excel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
$excel->getActiveSheet()->getColumnDimension('C')->setWidth(10);
... ... @@ -108,9 +109,9 @@ class Study extends Backend
->setCellValue('G1', '学号')
->setCellValue('H1', '总积分');
if ($ids == 'all' || empty($ids)) { //判断当前数据为全部或者选中的
$list = $this->model->with('school')->select();
$list = $this->model->with('school,grade')->select();
} else {
$list = $this->model->with('school')->select($ids);
$list = $this->model->with('school,grade')->select($ids);
}
foreach ($list as $k => $val) {
... ... @@ -121,7 +122,7 @@ class Study extends Backend
->setCellValue('A' . $k, $val['id'])
->setCellValue('B' . $k, $val['name'])
->setCellValue('C' . $k, $val['gender'] ? '男' : '女')
->setCellValue('D' . $k, $val['grade'])
->setCellValue('D' . $k, $val['grade']['name'])
->setCellValue('E' . $k, $val['school']['title'])
->setCellValue('F' . $k, $val['unique'])
->setCellValue('G' . $k, $val['sno'])
... ...
... ... @@ -31,18 +31,20 @@ class Screen extends Api
$list = [];
$data = db('screen')->find();
$list['images'] = cdnurl($data['images'],true);
if ($data['starttime']<=$time || $data['endtime']>=$time){
$times = $data['endtime'] - $time;
$data['count_down'] = date('H:i:s',$times);
if ($data['starttime']<=$time && $data['endtime']>=$time){
$day = intval(($data['endtime']-$time)/86400);
$hour = intval((($data['endtime']-$time)%86400)/3600);
$minute = intval(((($data['endtime']-$time)%86400)%3600)/60);
$second = intval(((($data['endtime']-$time)%86400)%3600)%60);
$list['count_down'] = "距离活动结束还有".$day."天".$hour."时".$minute."分".$second."秒";
}else if ($data['endtime']<=$time){
$list['count_down'] = "距离活动结束还有00天00时00分00秒";
}
$res = db('campus c')
->join('school s','c.school_id = s.id')
->join('activity a','c.activity_id = a.id')
$list['screen_name'] = $data['title'];
$list['campus_name'] = db('campus c')
->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();
->value('title');
$list['time'] = date('Y-m-d H:i:s',time());
$list['campus'] = $res['date'].$res['school_name'].$res['activity_name'];
$list['team_rank'] = \db('study_score_log')
->field('SUM(score) as sum_score,team_id')
->where('campus_id',$data['campus_id'])
... ...