Browse Source

分页优化

pull/1/head
pengda 9 months ago
parent
commit
87b093542d
  1. 30
      control/index.php

30
control/index.php

@ -57,7 +57,7 @@ class index extends publicBase {
$data = $m_case->getCaseByName($content, $page_num, $page_size); $data = $m_case->getCaseByName($content, $page_num, $page_size);
$total = $m_case->getCaseByNameTotal($content); $total = $m_case->getCaseByNameTotal($content);
$rdata = array( $rdata = array(
'total'=>$total, 'total' => $total,
'per_page' => $page_size, 'per_page' => $page_size,
'last_page' => ceil($total / $page_size), 'last_page' => ceil($total / $page_size),
'current_page' => $page_num, 'current_page' => $page_num,
@ -91,12 +91,12 @@ class index extends publicBase {
$data = array( $data = array(
'name' => trim($this->post('name')), 'name' => trim($this->post('name')),
'patient_name' => trim($this->post('patient_name')), 'patient_name' => trim($this->post('patient_name')),
'patient_age' => $this->post('patient_age')+0, 'patient_age' => $this->post('patient_age') + 0,
'patient_sex' => $this->post('patient_sex')+0, 'patient_sex' => $this->post('patient_sex') + 0,
'patient_say' => trim($this->post('patient_say')), 'patient_say' => trim($this->post('patient_say')),
'first_diagnosis' => trim($this->post('first_diagnosis')), 'first_diagnosis' => trim($this->post('first_diagnosis')),
'diagnosis' => trim($this->post('diagnosis')), 'diagnosis' => trim($this->post('diagnosis')),
'prescribe_num' => $this->post('prescribe_num')+0, 'prescribe_num' => $this->post('prescribe_num') + 0,
'prescribe_herb' => $this->post('prescribe_herb'), 'prescribe_herb' => $this->post('prescribe_herb'),
); );
@ -147,7 +147,7 @@ class index extends publicBase {
$total = $m_user_case->getUserCaseListCount($uid); $total = $m_user_case->getUserCaseListCount($uid);
$rdata = array( $rdata = array(
'total'=>$total, 'total' => $total,
'per_page' => $page_size, 'per_page' => $page_size,
'last_page' => ceil($total / $page_size), 'last_page' => ceil($total / $page_size),
'current_page' => $page_num, 'current_page' => $page_num,
@ -183,7 +183,15 @@ class index extends publicBase {
$data = $m_case->getCollectLog($page_num, $page_size); $data = $m_case->getCollectLog($page_num, $page_size);
$total = $m_case->getCollectLogTotal(); $total = $m_case->getCollectLogTotal();
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total / $page_size), 'list' => $data)); $rdata = array(
'total' => $total,
'per_page' => $page_size,
'last_page' => ceil($total / $page_size),
'current_page' => $page_num,
'data' => $data
);
$this->ajax_json(true, '获取成功', $rdata);
} }
public function ajax_login() { public function ajax_login() {
@ -196,7 +204,11 @@ class index extends publicBase {
$token = $m_user->getToken($user['uid']); $token = $m_user->getToken($user['uid']);
$this->ajax_json(true, '登录成功', array('uid' => $user['uid'], 'identifier' => $user['identifier'], 'token' => $token)); $this->ajax_json(true, '登录成功', array(
'uid' => $user['uid'],
'identifier' => $user['identifier'],
'token' => $token
));
} }
public function ajax_get_user() { public function ajax_get_user() {
@ -206,7 +218,7 @@ class index extends publicBase {
$obj = new mUser(); $obj = new mUser();
$uinfo = $obj->getUserByUid($uid); $uinfo = $obj->getUserByUid($uid);
if(empty($uinfo)) $this->ajax_json(false, '未登录或登录已经失效', array('code' => CODE_LOGIN_EXIPRE)); if (empty($uinfo)) $this->ajax_json(false, '未登录或登录已经失效', array('code' => CODE_LOGIN_EXIPRE));
$this->ajax_json(true, '', $uinfo); $this->ajax_json(true, '', $uinfo);
} }
@ -239,7 +251,7 @@ class index extends publicBase {
$pdf_url = $m_user_case->createPdf($uid, $data_key); $pdf_url = $m_user_case->createPdf($uid, $data_key);
$rdata = array( $rdata = array(
'total'=>$total, 'total' => $total,
'per_page' => $page_size, 'per_page' => $page_size,
'last_page' => ceil($total / $page_size), 'last_page' => ceil($total / $page_size),
'current_page' => $page_num, 'current_page' => $page_num,

Loading…
Cancel
Save