|
@ -47,7 +47,7 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
public function ajax_search() { |
|
|
public function ajax_search() { |
|
|
$content = $this->post('content'); |
|
|
$content = $this->post('content'); |
|
|
if(empty($content))$this->ajax_json(false, '请输入方名'); |
|
|
if (empty($content))$this->ajax_json(false, '请输入方名'); |
|
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$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') : 100; |
|
@ -61,11 +61,11 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
public function ajax_case_detail() { |
|
|
public function ajax_case_detail() { |
|
|
$id = $this->get('id')+0; |
|
|
$id = $this->get('id')+0; |
|
|
if(empty($id))$this->ajax_json(false, '非法请求'); |
|
|
if (empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_case = new mCase(); |
|
|
$m_case = new mCase(); |
|
|
$data = $m_case->getCaseInfo($id); |
|
|
$data = $m_case->getCaseInfo($id); |
|
|
if(!$data)$this->ajax_json(false, $m_case->getError()); |
|
|
if (!$data) $this->ajax_json(false, $m_case->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $data); |
|
|
$this->ajax_json(true, '获取成功', $data); |
|
|
} |
|
|
} |
|
@ -74,11 +74,11 @@ class index extends publicBase { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$case_id = $this->post('case_id')+0; |
|
|
$case_id = $this->post('case_id')+0; |
|
|
if(empty($uid) || empty($token) || empty($case_id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($case_id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
if(!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$data = array( |
|
|
$data = array( |
|
|
'name' => trim($this->post('name')), |
|
|
'name' => trim($this->post('name')), |
|
@ -94,7 +94,7 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$id = $m_user_case->createUserCase($uid, $case_id, $data); |
|
|
$id = $m_user_case->createUserCase($uid, $case_id, $data); |
|
|
if(!$id) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$id) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '保存成功',array('id' => $id)); |
|
|
$this->ajax_json(true, '保存成功',array('id' => $id)); |
|
|
} |
|
|
} |
|
@ -103,11 +103,11 @@ class index extends publicBase { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$id = $this->post('id')+0; |
|
|
$id = $this->post('id')+0; |
|
|
if(empty($uid) || empty($token) || empty($id))$this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
if(!$is_login)$this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$data = array( |
|
|
$data = array( |
|
|
'name' => trim($this->post('name')), |
|
|
'name' => trim($this->post('name')), |
|
@ -116,7 +116,7 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$res = $m_user_case->updateUserCase($uid, $id, $data); |
|
|
$res = $m_user_case->updateUserCase($uid, $id, $data); |
|
|
if(!$res)$this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$res) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '保存成功',array('id' => $id)); |
|
|
$this->ajax_json(true, '保存成功',array('id' => $id)); |
|
|
} |
|
|
} |
|
@ -124,18 +124,18 @@ class index extends publicBase { |
|
|
public function ajax_user_case_list() { |
|
|
public function ajax_user_case_list() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
if(!$is_login)$this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$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') : 100; |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$data = $m_user_case->getUserCaseList($uid, $page_num, $page_size); |
|
|
$data = $m_user_case->getUserCaseList($uid, $page_num, $page_size); |
|
|
if(!$data)$this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
$total = $m_user_case->getUserCaseListCount($uid); |
|
|
$total = $m_user_case->getUserCaseListCount($uid); |
|
|
|
|
|
|
|
|
$return = array( |
|
|
$return = array( |
|
@ -152,15 +152,15 @@ class index extends publicBase { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$id = $this->post('id')+0; |
|
|
$id = $this->post('id')+0; |
|
|
if(empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
if(!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$data = $m_user_case->getUserCaseInfo($uid, $id); |
|
|
$data = $m_user_case->getUserCaseInfo($uid, $id); |
|
|
if(!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $data); |
|
|
$this->ajax_json(true, '获取成功', $data); |
|
|
} |
|
|
} |
|
@ -178,14 +178,14 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
public function ajax_login(){ |
|
|
public function ajax_login(){ |
|
|
$code = $this->get('code'); |
|
|
$code = $this->get('code'); |
|
|
if(!$code)$this->ajax_json(false, '非法请求'); |
|
|
if (!$code)$this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$openid = $m_user->getOpenid($code); |
|
|
$openid = $m_user->getOpenid($code); |
|
|
if(!$openid)$this->ajax_json(false, $m_user->getError()); |
|
|
if (!$openid)$this->ajax_json(false, $m_user->getError()); |
|
|
|
|
|
|
|
|
$user = $m_user->getUserByOpenid($openid); |
|
|
$user = $m_user->getUserByOpenid($openid); |
|
|
if($user){ |
|
|
if ($user){ |
|
|
$token = $m_user->getToken($user['uid']); |
|
|
$token = $m_user->getToken($user['uid']); |
|
|
$this->ajax_json(true, '登录成功', array('uid' => $user['uid'], 'token'=> $token)); |
|
|
$this->ajax_json(true, '登录成功', array('uid' => $user['uid'], 'token'=> $token)); |
|
|
} |
|
|
} |
|
@ -193,10 +193,10 @@ class index extends publicBase { |
|
|
//获取唯一uid串 |
|
|
//获取唯一uid串 |
|
|
$uid = $m_user->createUniqueUid($openid); |
|
|
$uid = $m_user->createUniqueUid($openid); |
|
|
$user = $m_user->getUserByUid($uid); |
|
|
$user = $m_user->getUserByUid($uid); |
|
|
if($user)$this->ajax_json(false, 'uid生成失败'); |
|
|
if ($user)$this->ajax_json(false, 'uid生成失败'); |
|
|
|
|
|
|
|
|
$id = $m_user->createUser(array('uid'=>$uid,'openid'=>$openid)); |
|
|
$id = $m_user->createUser(array('uid'=>$uid,'openid'=>$openid)); |
|
|
if(!$id)$this->ajax_json(false, '用户创建失败'); |
|
|
if (!$id)$this->ajax_json(false, '用户创建失败'); |
|
|
|
|
|
|
|
|
$token = $m_user->getToken($user['uid']); |
|
|
$token = $m_user->getToken($user['uid']); |
|
|
$this->ajax_json(true, '登录成功', array('uid' => $user['uid'], 'token'=> $token)); |
|
|
$this->ajax_json(true, '登录成功', array('uid' => $user['uid'], 'token'=> $token)); |
|
@ -209,18 +209,18 @@ class index extends publicBase { |
|
|
public function export_user_case_list(){ |
|
|
public function export_user_case_list(){ |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
if(empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
if(!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$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') : 100; |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$data = $m_user_case->getUserCaseList($uid, $page_num, $page_size, true, true); |
|
|
$data = $m_user_case->getUserCaseList($uid, $page_num, $page_size, true, true); |
|
|
if(!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
$total = $m_user_case->getUserCaseListCount($uid); |
|
|
$total = $m_user_case->getUserCaseListCount($uid); |
|
|
|
|
|
|
|
|
$data_key = sprintf(RQ_USER_CASE_DATA, $uid, 0); |
|
|
$data_key = sprintf(RQ_USER_CASE_DATA, $uid, 0); |
|
@ -236,15 +236,15 @@ class index extends publicBase { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$id = $this->post('id')+0; |
|
|
$id = $this->post('id')+0; |
|
|
if(empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
if(!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$data = $m_user_case->getUserCaseInfo($uid, $id, true); |
|
|
$data = $m_user_case->getUserCaseInfo($uid, $id, true); |
|
|
if(!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
$data_key = sprintf(RQ_USER_CASE_DATA, $uid, $id); |
|
|
$data_key = sprintf(RQ_USER_CASE_DATA, $uid, $id); |
|
|
|
|
|
|
|
@ -255,8 +255,7 @@ class index extends publicBase { |
|
|
$this->ajax_json(true, '获取成功',array('pdf_url'=> $pdf_url)); |
|
|
$this->ajax_json(true, '获取成功',array('pdf_url'=> $pdf_url)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function export_pdf() |
|
|
public function export_pdf(){ |
|
|
{ |
|
|
|
|
|
$key = $this->get('key'); |
|
|
$key = $this->get('key'); |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
@ -269,26 +268,26 @@ class index extends publicBase { |
|
|
public function ajax_mail(){ |
|
|
public function ajax_mail(){ |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
if(empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$mUser = new mUser(); |
|
|
$mUser = new mUser(); |
|
|
$is_login = $mUser->validateToken($uid,$token); |
|
|
$is_login = $mUser->validateToken($uid,$token); |
|
|
if(!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$email = $this->post('email'); |
|
|
$email = $this->post('email'); |
|
|
if(empty($email)) $this->ajax_json(false, '邮箱地址不能为空'); |
|
|
if (empty($email)) $this->ajax_json(false, '邮箱地址不能为空'); |
|
|
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) $this->ajax_json(false, '邮箱地址无效'); |
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) $this->ajax_json(false, '邮箱地址无效'); |
|
|
|
|
|
|
|
|
$pdf_url = $this->post('pdf_url'); |
|
|
$pdf_url = $this->post('pdf_url'); |
|
|
if(empty($pdf_url)) $this->ajax_json(false, 'pdf地址不能为空'); |
|
|
if (empty($pdf_url)) $this->ajax_json(false, 'pdf地址不能为空'); |
|
|
if(!filter_var($pdf_url, FILTER_VALIDATE_URL)) $this->ajax_json(false, 'pdf地址无效'); |
|
|
if (!filter_var($pdf_url, FILTER_VALIDATE_URL)) $this->ajax_json(false, 'pdf地址无效'); |
|
|
|
|
|
|
|
|
$directory_name = basename(dirname($pdf_url)); |
|
|
$directory_name = basename(dirname($pdf_url)); |
|
|
if($directory_name != $uid) $this->ajax_json(false, '非法请求'); |
|
|
if ($directory_name != $uid) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$mUserCase = new mUserCase(); |
|
|
$mUserCase = new mUserCase(); |
|
|
$res = $mUserCase->sendMail(array($email),date('Y年m月d日',time()).'-医案导出','',sprintf(USER_CASE_PDF_PATH, $uid) . basename($pdf_url)); |
|
|
$res = $mUserCase->sendMail(array($email),date('Y年m月d日',time()).'-医案导出','',sprintf(USER_CASE_PDF_PATH, $uid) . basename($pdf_url)); |
|
|
if(!$res) $this->ajax_json(true, '发送失败'); |
|
|
if (!$res) $this->ajax_json(true, '发送失败'); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '发送成功'); |
|
|
$this->ajax_json(true, '发送成功'); |
|
|
} |
|
|
} |
|
|