...
|
...
|
@@ -22,7 +22,7 @@ class Index extends Api |
|
|
* @ApiTitle (首页)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="xq", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiParams (name="campus", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiParams (name="row", type="string", required=false, description="每页显示行数[非必填]")
|
|
|
* @ApiParams (name="page", type="string", required=false, description="当前页[非必填]")
|
|
|
* @ApiReturn ({"code":状态码,
|
...
|
...
|
@@ -46,12 +46,12 @@ class Index extends Api |
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$xq = $this->request->param('xq');
|
|
|
$campus = $this->request->param('campus');
|
|
|
$row = $this->request->param('row');
|
|
|
$page = $this->request->param('page');
|
|
|
$row = $row ? $row : 10;
|
|
|
$page = $page ? $page : 1;
|
|
|
if (empty($xq)) {
|
|
|
if (empty($campus)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
$userinfo = $this->auth->getUserinfo();
|
...
|
...
|
@@ -59,7 +59,7 @@ class Index extends Api |
|
|
//个人排行榜
|
|
|
$data = \db('study_score_log')
|
|
|
->field('id,SUM(score) as sum_score,study_id')
|
|
|
->where('school_id', $xq)
|
|
|
->where('campus_id', $campus)
|
|
|
->group('study_id')
|
|
|
->order('sum_score DESC')
|
|
|
->paginate($row, false, ['page' => $page])
|
...
|
...
|
@@ -68,7 +68,7 @@ class Index extends Api |
|
|
return $item;
|
|
|
});
|
|
|
$data['active_study_score'] = \db('study_score_log')
|
|
|
->where(['study_id' => $sid, 'school_id' => $xq])
|
|
|
->where(['study_id' => $sid, 'campus_id' => $campus])
|
|
|
->sum('score');
|
|
|
$data['active_study_info'] = \db('study')->where('id', $sid)->value('name');
|
|
|
$this->success('获取成功', [$data, 'status' => 1]);
|
...
|
...
|
@@ -118,7 +118,7 @@ class Index extends Api |
|
|
* @ApiTitle (战队排行榜)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="xq", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiParams (name="campus", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiParams (name="row", type="string", required=false, description="每页显示行数[非必填]")
|
|
|
* @ApiParams (name="page", type="string", required=false, description="当前页[非必填]")
|
|
|
* @ApiReturn ({"code":状态码,
|
...
|
...
|
@@ -146,14 +146,14 @@ class Index extends Api |
|
|
$page = $this->request->param('page');
|
|
|
$row = $row ? $row : 10;
|
|
|
$page = $page ? $page : 1;
|
|
|
$xq = $this->request->param('xq');
|
|
|
if (empty($xq)) {
|
|
|
$campus = $this->request->param('campus');
|
|
|
if (empty($campus)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
$data = \db('study_score_log l')
|
|
|
->distinct('l.team_id')
|
|
|
->join('team t', 't.id = l.team_id')
|
|
|
->where('l.school_id', $xq)
|
|
|
->where('l.campus_id', $campus)
|
|
|
->field('t.title,t.score,l.team_id')
|
|
|
->order('t.score DESC')
|
|
|
->paginate($row, false, ['page' => $page]);
|
...
|
...
|
@@ -165,7 +165,7 @@ class Index extends Api |
|
|
* @ApiTitle (个人排行榜)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="xq", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiParams (name="campus", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiParams (name="row", type="string", required=false, description="每页显示行数[非必填]")
|
|
|
* @ApiParams (name="page", type="string", required=false, description="当前页[非必填]")
|
|
|
* @ApiReturn ({"code":状态码,
|
...
|
...
|
@@ -187,19 +187,19 @@ class Index extends Api |
|
|
*/
|
|
|
public function personRank()
|
|
|
{
|
|
|
$xq = $this->request->param('xq');
|
|
|
$campus = $this->request->param('campus');
|
|
|
$row = $this->request->param('row');
|
|
|
$page = $this->request->param('page');
|
|
|
$user = $this->auth->getUserinfo();
|
|
|
$row = $row ? $row : 10;
|
|
|
$page = $page ? $page : 1;
|
|
|
if (empty($xq)) {
|
|
|
if (empty($campus)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
//个人排行榜
|
|
|
$data = \db('study_score_log')
|
|
|
->field('id,SUM(score) as sum_score,study_id')
|
|
|
->where('school_id', $xq)
|
|
|
->where('campus_id', $campus)
|
|
|
->group('study_id')
|
|
|
->order('sum_score DESC')
|
|
|
->paginate($row, false, ['page' => $page])
|
...
|
...
|
|