...
|
...
|
@@ -53,15 +53,15 @@ class Screen extends Backend |
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
|
$list = $this->model
|
|
|
->with(['campus'])
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
|
->with(['campus'])
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
|
|
|
|
foreach ($list as $row) {
|
|
|
$row->visible(['id','title','campus_id','images','starttime','endtime','is_view']);
|
|
|
$row->visible(['id', 'title', 'campus_id', 'images', 'starttime', 'endtime', 'is_view']);
|
|
|
$row->visible(['campus']);
|
|
|
$row->getRelation('campus')->visible(['title']);
|
|
|
$row->getRelation('campus')->visible(['title']);
|
|
|
}
|
|
|
|
|
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
...
|
...
|
@@ -73,7 +73,7 @@ class Screen extends Backend |
|
|
|
|
|
public function details($ids)
|
|
|
{
|
|
|
$row = $this->model->get(['id'=>$ids]);
|
|
|
$row = $this->model->get(['id' => $ids]);
|
|
|
if (!$row) {
|
|
|
$this->error(__('No Results were found'));
|
|
|
}
|
...
|
...
|
@@ -82,61 +82,21 @@ class Screen extends Backend |
|
|
}
|
|
|
$data = $row->toArray();
|
|
|
$res = db('study_score_log l')
|
|
|
->join('team t','l.team_id = t.id')
|
|
|
->where('campus_id',$data['campus_id'])
|
|
|
->join('team t', 'l.team_id = t.id')
|
|
|
->where('campus_id', $data['campus_id'])
|
|
|
->field('l.team_id,sum(l.score) as sum_score,t.title')
|
|
|
->group('l.team_id')
|
|
|
->order('sum_score','desc')
|
|
|
->order('sum_score', 'desc')
|
|
|
->select();
|
|
|
$list = [];
|
|
|
// foreach ($res as $k1){
|
|
|
// foreach ($k1 as $k2 => $v){
|
|
|
//// dump($k2);
|
|
|
//// dump($v);
|
|
|
// $list['title'] = $v;
|
|
|
// $list['score'] = $v;
|
|
|
// }
|
|
|
// }
|
|
|
foreach ($res as $k => $v){
|
|
|
$list['title'] = $v['title'];
|
|
|
$list['score'] = $v['sum_score'];
|
|
|
foreach ($res as $k => $v) {
|
|
|
$list[] = [
|
|
|
'title' => $v['title'],
|
|
|
'score' => $v['sum_score'],
|
|
|
];
|
|
|
}
|
|
|
//dump($list);
|
|
|
$this->view->assign("row", $list);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
public function detail($ids)
|
|
|
{
|
|
|
$row = $this->model->get(['id'=>$ids]);
|
|
|
if (!$row) {
|
|
|
$this->error(__('No Results were found'));
|
|
|
}
|
|
|
if ($this->request->isAjax()) {
|
|
|
$this->success("Ajax请求成功", null, ['id' => $ids]);
|
|
|
}
|
|
|
$data = $row->toArray();
|
|
|
$res = db('study_score_log l')
|
|
|
->join('study s','l.study_id = s.id')
|
|
|
->where('campus_id',$data['campus_id'])
|
|
|
->field('l.team_id,sum(l.score) as sum_score,s.name')
|
|
|
->group('l.study_id')
|
|
|
->order('sum_score','desc')
|
|
|
->select();
|
|
|
$list = [];
|
|
|
// foreach ($res as $k1){
|
|
|
// foreach ($k1 as $k2 => $v){
|
|
|
//// dump($k2);
|
|
|
//// dump($v);
|
|
|
// $list['title'] = $v;
|
|
|
// $list['score'] = $v;
|
|
|
// }
|
|
|
// }
|
|
|
foreach ($res as $k => $v){
|
|
|
$list['name'] = $v['name'];
|
|
|
$list['score'] = $v['sum_score'];
|
|
|
}
|
|
|
//dump($list);
|
|
|
$this->view->assign("row", $list);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
} |
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|