|
|
@ -47,17 +47,24 @@ class index extends publicBase { |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_search() { |
|
|
|
$content = $this->post('content'); |
|
|
|
if (empty($content)) $this->ajax_json(false, '请输入方名'); |
|
|
|
$content = trim($this->post('content')); |
|
|
|
$content = empty($content) ? '' : $content; |
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 100; |
|
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 20; |
|
|
|
|
|
|
|
$m_case = new mCase(); |
|
|
|
$data = $m_case->getCaseByName($content, $page_num, $page_size); |
|
|
|
$total = $m_case->getCaseByNameTotal($content); |
|
|
|
$rdata = array( |
|
|
|
'total'=>$total, |
|
|
|
'per_page' => $page_size, |
|
|
|
'last_page' => ceil($total / $page_size), |
|
|
|
'current_page' => $page_num, |
|
|
|
'data' => $data |
|
|
|
); |
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total / $page_size), 'list' => $data)); |
|
|
|
$this->ajax_json(true, '获取成功', $rdata); |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_case_detail() { |
|
|
@ -174,7 +181,7 @@ class index extends publicBase { |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_login() { |
|
|
|
$code = $this->get('code'); |
|
|
|
$code = $this->post('code'); |
|
|
|
if (!$code) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
@ -186,6 +193,18 @@ class index extends publicBase { |
|
|
|
$this->ajax_json(true, '登录成功', array('uid' => $user['uid'], 'identifier' => $user['identifier'], 'token' => $token)); |
|
|
|
} |
|
|
|
|
|
|
|
public function get_user() { |
|
|
|
$uid = $this->post('uid'); |
|
|
|
$token = $this->post('token'); |
|
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '未登录或登录已经失效', array('code' => CODE_LOGIN_EXIPRE)); |
|
|
|
|
|
|
|
$obj = new mUser(); |
|
|
|
$uinfo = $obj->getUserByUid($uid); |
|
|
|
if(empty($uinfo)) $this->ajax_json(false, '未登录或登录已经失效', array('code' => CODE_LOGIN_EXIPRE)); |
|
|
|
|
|
|
|
$this->ajax_json(true, '', $uinfo); |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_contact_us() { |
|
|
|
$this->ajax_json(true, '获取成功', array('img_url' => CONTACT_US_IMG_URL)); |
|
|
|
} |
|
|
|