diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 86b24b46..ccd6148f 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -139,6 +139,11 @@ class Chengji extends BaseModel ,'subject_id' => '' ,'searchval' => '' ,'user_id' => '' + ,'page' => 1 + ,'limit' => 10 + ,'field' => 'id' + ,'order' => 'desc' + ,'all' => false ); $src = array_cover($srcfrom, $src); $cjList = $this @@ -178,7 +183,6 @@ class Chengji extends BaseModel ]) ->select(); - // 重新整理成绩 $data = array(); foreach ($cjList as $key => $value) { @@ -208,7 +212,23 @@ class Chengji extends BaseModel $data[$key]['update_time'] = $value->update_time; } + + if ($src['order'] == 'asc') { + $src['order'] = SORT_ASC; + } else { + $src['order'] = SORT_DESC; + } + // halt($src['order']); + + $data = \app\facade\Tools::sortArrByManyField($data, $src['field'], $src['order']); + if($src['all'] != true) + { + $start = ($src['page'] - 1) * $src['limit']; + $data = array_slice($data, $start, $src['limit']); + } + return $data; + } diff --git a/app/luru/controller/Index.php b/app/luru/controller/Index.php index 44b7e467..96eb8ea8 100755 --- a/app/luru/controller/Index.php +++ b/app/luru/controller/Index.php @@ -52,12 +52,15 @@ class Index extends AdminBase ,'subject_id' => '' ,'searchval' ,'user_id' => session('user_id') + ,'all' => false ], 'POST'); // 根据条件查询数据 $cj = new Chengji; - $data = $cj->searchLuru($src); - $data = reset_data($data, $src); + $data = $cj->searchLuru($src); + $src['all'] = true; + $cnt = count($cj->searchLuru($src)); + $data = reset_data($data, $cnt); return json($data); } diff --git a/app/luru/view/index/yilu_cnt_table.html b/app/luru/view/index/yilu_cnt_table.html index 917d6365..b9bfc26a 100644 --- a/app/luru/view/index/yilu_cnt_table.html +++ b/app/luru/view/index/yilu_cnt_table.html @@ -120,8 +120,13 @@ layui.use(['table', 'form', 'canyuKaoshi'], function() { str = d.chengji[colname].xkcnt; } } - if (d.chengji.stucnt != str && str != 0) { - str = ''+str+'' + if (d.chengji.stucnt != str) { + if (str == 0) { + str = ''; + } else { + var cha = str - d.chengji.stucnt; + str = str + ' (' + cha + ')' + } } return str; }