...
|
...
|
@@ -36,8 +36,8 @@ class Index extends Api |
|
|
public function index()
|
|
|
{
|
|
|
$userinfo = $this->auth->getUserinfo();
|
|
|
$bind = \db('user')->where('id',$userinfo['id'])->value('bind_study');
|
|
|
if ($bind == 0){
|
|
|
$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();
|
...
|
...
|
@@ -167,10 +167,10 @@ class Index extends Api |
|
|
->field('t.title,t.score,l.team_id,l.campus_id')
|
|
|
->order('t.score DESC')
|
|
|
->paginate($row, false, ['page' => $page])
|
|
|
->each(function ($item,$key){
|
|
|
$res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score');
|
|
|
->each(function ($item, $key) {
|
|
|
$res = db('study_score_log')->where('campus_id', $item['campus_id'])->sum('score');
|
|
|
$item['score'] = floor($item['score']);
|
|
|
$item['percent'] = round(($item['score']*0.6) / $res * 100,2);
|
|
|
$item['percent'] = round(($item['score'] * 0.6) / $res * 100, 2);
|
|
|
return $item;
|
|
|
});
|
|
|
//最终显示
|
...
|
...
|
|