...
|
...
|
@@ -22,7 +22,6 @@ class Index extends Api |
|
|
/**
|
|
|
* @ApiTitle (首页)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="campus", type="string", required=true, description="校区id[必填]")
|
|
|
* @ApiReturn ({"code":状态码,
|
|
|
"msg":"提示信息"
|
|
|
"time": "时间戳",
|
...
|
...
|
@@ -36,18 +35,12 @@ class Index extends Api |
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$campus = $this->request->param('campus');
|
|
|
if (empty($campus)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
$userinfo = $this->auth->getUserinfo();
|
|
|
$bind = \db('user')->where('id',$userinfo['id'])->value('bind_study');
|
|
|
if ($bind == 0){
|
|
|
$this->error('空', ['status' => 2]);
|
|
|
}
|
|
|
$sid = \db('study')->where('user_id', $userinfo['id'])->find();
|
|
|
$count = \db('study_score_log')->where(
|
|
|
[
|
|
|
'study_id' => $sid['id'],
|
|
|
'campus_id' => $campus,
|
|
|
]
|
|
|
)->sum('score');
|
|
|
$data = \db('study_score_log')
|
|
|
->field('study_id, SUM(score) as sum_score')
|
|
|
->group('study_id')->order('sum_score', 'desc')
|
...
|
...
|
|