RoomGrade.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace addons\exam\controller;
use addons\exam\model\BaseModel;
use addons\exam\model\RoomGradeModel;
/**
* 考场考试成绩接口
*/
class RoomGrade extends Base
{
protected $noNeedLogin = [''];
protected $noNeedRight = ['*'];
/**
* 获取成绩列表
*/
public function index()
{
$list = RoomGradeModel::with(
[
// 'user' => BaseModel::withSimpleUser(),
'cate' => BaseModel::withSimpleCate(),
'paper' => BaseModel::withSimplePaper(),
'room' => BaseModel::withSimpleRoom(),
]
)
->where('user_id', $this->auth->id)
->order('id desc')
->paginate(15, true);
$this->success('', compact('list'));
}
/**
* 排行榜
*/
public function rank()
{
if (!$room_id = input('room_id/d', '0')) {
$this->error('缺少考场信息');
}
$result = RoomGradeModel::rankData($room_id);
$this->success('', $result);
}
}