From 1190dfa5e0bbcd5d77a3388f6e041618217778c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Thu, 7 Jan 2021 11:59:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B6=85=E8=BF=87=E7=AE=97?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/model/Chengji.php | 18 ++++++++++++++---- app/login/view/index/shangma_log.html | 14 +++++++++++++- app/studentSearchChengji/view/index/index.html | 4 ++-- app/teacherSearchChengji/view/index/index.html | 2 +- config/shangma.php | 2 +- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index bb5d323a..2cda378f 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -214,17 +214,27 @@ class Chengji extends BaseModel return true; } - asort($cj); + arsort($cj); $khids = array_keys($cj); # 获取考号即键值 $data = array(); # 新数据容器 + $mc = 1; foreach ($khids as $key => $value) { - $data[$key]['id'] = $value; - $data[$key][$col[0]] = $cnt - $key; - $data[$key][$col[1]] = round(($key) / $cnt * 100, 2); + if($cnt == 1) + { + $data[$key]['id'] = $value; + $data[$key][$col[0]] = 1; + $data[$key][$col[1]] = 100; + }else{ + $data[$key]['id'] = $value; + $data[$key][$col[0]] = $mc; + $data[$key][$col[1]] = round(($cnt - $mc) / ($cnt - 1) * 100, 2); + } + $mc++; } $temp = $this->saveAll($data); + return true; } diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html index 0b93fb14..babcbb7b 100755 --- a/app/login/view/index/shangma_log.html +++ b/app/login/view/index/shangma_log.html @@ -44,6 +44,19 @@