From 9e015d3a44f936b272ca30b701f2f7603b7c3e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Sun, 27 Dec 2020 09:01:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E7=BB=A9=E5=9C=A8?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=8D=E7=BD=AE=E7=9A=84=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/model/Chengji.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 7014845f..78d586e0 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -210,19 +210,14 @@ class Chengji extends BaseModel return true; } - arsort($cj); + asort($cj); $khids = array_keys($cj); # 获取考号即键值 $data = array(); # 新数据容器 foreach ($khids as $key => $value) { $data[$key]['id'] = $value; - $data[$key][$col[0]] = $key +1 ; - if($key > 0 && $cj[$khids[$key-1]] == $cj[$value]) - { - $data[$key][$col[0]] = $data[$key-1][$col[0]]; - } - $data[$key][$col[1]] = 1 - ($data[$key][$col[0]]-1)/$cnt; - $data[$key][$col[1]] = round($data[$key][$col[1]] * 100 , 2) ; + $data[$key][$col[0]] = $cnt - $key; + $data[$key][$col[1]] = round(($key) / $cnt * 100, 2); } $temp = $this->saveAll($data);