作者 开飞机的舒克

筛选学生的雷达维度积分

... ... @@ -4,6 +4,7 @@ namespace app\api\controller;
use app\common\controller\Api;
use app\common\model\Item;
use app\common\model\RadarScore;
use app\common\model\Study;
use app\common\model\StudyScoreLog;
use app\common\model\Team;
... ... @@ -316,20 +317,13 @@ class Bind extends Api
$data = \db('study')->where('id', $sid)->field('avatar,name,earn_score')->find();
$data['avatar'] = cdnurl($data['avatar'], true);
//获取雷达维度
$data['item'] = \db('study_score_log')
->distinct('item_id')
->field('item_id,SUM(score) as sum_score')
->order('sum_score','desc')
->group('item_id')
->where(['campus_id' => $cid, 'study_id' => $sid])
->paginate(9)
->each(function ($item, $key) {
$item['title'] = \db('item i')
->join('radar r', 'i.radar_id = r.id')
->where('i.id', $item['item_id'])
->value('r.title');
return $item;
});
//halt($sid);
$model = new RadarScore();
$list = collection($model->whereIn('campus_ids',$cid)->where('study_id',$sid)->field('radar_id,score')->select())->toArray();
foreach ($list as $k => $v){
$data[$k]['radar'] = \db('radar')->where('id',$v['radar_id'])->value('title');
$data[$k]['radar_score'] = $v['score'];
}
$this->success('获取成功', $data);
}
... ...
... ... @@ -6330,7 +6330,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-04-12 17:40:22 <a href="./" target="_blank">校园活动</a>
Generated on 2023-04-12 19:07:36 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...