作者 开飞机的舒克

后台优化

@@ -155,7 +155,7 @@ class Bind extends Api @@ -155,7 +155,7 @@ class Bind extends Api
155 if (empty($unique) && empty($id)) { 155 if (empty($unique) && empty($id)) {
156 $this->error('参数错误', ['status' => 2]); 156 $this->error('参数错误', ['status' => 2]);
157 } 157 }
158 - $study = db('study')->where('unique', $unique)->field('id,grade_id,name,team_id,earn_score')->find(); 158 + $study = db('study')->where('unique', $unique)->field('id,grade,name,team_id,earn_score')->find();
159 $item = db('item')->where('id', $id)->field('score,title,campus_id')->find(); 159 $item = db('item')->where('id', $id)->field('score,title,campus_id')->find();
160 $team = \db('team')->where('id', $study['team_id'])->field('title,score')->find(); 160 $team = \db('team')->where('id', $study['team_id'])->field('title,score')->find();
161 $sum1 = $team['score'] + $item['score']; //合计战队总分 161 $sum1 = $team['score'] + $item['score']; //合计战队总分
@@ -188,6 +188,11 @@ class Bind extends Api @@ -188,6 +188,11 @@ class Bind extends Api
188 $this->error('连接错误', ['status' => 3]); 188 $this->error('连接错误', ['status' => 3]);
189 } 189 }
190 $data = db('study')->where('unique', $unique)->field('name,gender')->find(); 190 $data = db('study')->where('unique', $unique)->field('name,gender')->find();
  191 + if ($data['gender'] == 1){
  192 + $data['gender'] = '男';
  193 + }else{
  194 + $data['gender'] = '女';
  195 + }
191 $this->success('扫码成功', $data); 196 $this->success('扫码成功', $data);
192 } 197 }
193 198
@@ -36,8 +36,8 @@ class Index extends Api @@ -36,8 +36,8 @@ class Index extends Api
36 public function index() 36 public function index()
37 { 37 {
38 $userinfo = $this->auth->getUserinfo(); 38 $userinfo = $this->auth->getUserinfo();
39 - $bind = \db('user')->where('id',$userinfo['id'])->value('bind_study');  
40 - if ($bind == 0){ 39 + $bind = \db('user')->where('id', $userinfo['id'])->value('bind_study');
  40 + if ($bind == 0) {
41 $this->error('空', ['status' => 2]); 41 $this->error('空', ['status' => 2]);
42 } 42 }
43 $sid = \db('study')->where('user_id', $userinfo['id'])->find(); 43 $sid = \db('study')->where('user_id', $userinfo['id'])->find();
@@ -167,10 +167,10 @@ class Index extends Api @@ -167,10 +167,10 @@ class Index extends Api
167 ->field('t.title,t.score,l.team_id,l.campus_id') 167 ->field('t.title,t.score,l.team_id,l.campus_id')
168 ->order('t.score DESC') 168 ->order('t.score DESC')
169 ->paginate($row, false, ['page' => $page]) 169 ->paginate($row, false, ['page' => $page])
170 - ->each(function ($item,$key){  
171 - $res = db('study_score_log')->where('campus_id',$item['campus_id'])->sum('score'); 170 + ->each(function ($item, $key) {
  171 + $res = db('study_score_log')->where('campus_id', $item['campus_id'])->sum('score');
172 $item['score'] = floor($item['score']); 172 $item['score'] = floor($item['score']);
173 - $item['percent'] = round(($item['score']*0.6) / $res * 100,2); 173 + $item['percent'] = round(($item['score'] * 0.6) / $res * 100, 2);
174 return $item; 174 return $item;
175 }); 175 });
176 //最终显示 176 //最终显示
@@ -5303,7 +5303,7 @@ @@ -5303,7 +5303,7 @@
5303 5303
5304 </div> 5304 </div>
5305 <div class="col-md-6" align="right"> 5305 <div class="col-md-6" align="right">
5306 - Generated on 2023-03-17 19:09:28 <a href="./" target="_blank">校园活动</a> 5306 + Generated on 2023-03-20 11:20:40 <a href="./" target="_blank">校园活动</a>
5307 </div> 5307 </div>
5308 </div> 5308 </div>
5309 5309