作者 开飞机的舒克

后台优化

... ... @@ -155,7 +155,7 @@ class Bind extends Api
if (empty($unique) && empty($id)) {
$this->error('参数错误', ['status' => 2]);
}
$study = db('study')->where('unique', $unique)->field('id,grade_id,name,team_id,earn_score')->find();
$study = db('study')->where('unique', $unique)->field('id,grade,name,team_id,earn_score')->find();
$item = db('item')->where('id', $id)->field('score,title,campus_id')->find();
$team = \db('team')->where('id', $study['team_id'])->field('title,score')->find();
$sum1 = $team['score'] + $item['score']; //合计战队总分
... ... @@ -188,6 +188,11 @@ class Bind extends Api
$this->error('连接错误', ['status' => 3]);
}
$data = db('study')->where('unique', $unique)->field('name,gender')->find();
if ($data['gender'] == 1){
$data['gender'] = '男';
}else{
$data['gender'] = '女';
}
$this->success('扫码成功', $data);
}
... ...
... ... @@ -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;
});
//最终显示
... ...
... ... @@ -5303,7 +5303,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-17 19:09:28 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-20 11:20:40 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...