作者 开飞机的舒克

筛选学生的雷达维度积分

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