Browse Source

api

pull/1/head
pengda 9 months ago
parent
commit
1ceede29e4
  1. 99
      control/index.php

99
control/index.php

@ -11,93 +11,41 @@ class index extends publicBase {
} }
public function ajax_search() { public function ajax_search() {
$content = $_POST['content']; $content = $this->post('content');
if(empty($content))$this->ajax_json(false, '非法请求'); if(empty($content))$this->ajax_json(false, '非法请求');
$start = isset($_POST['start']) ? $_POST['start'] : 0; $start = $this->post('start') ? $this->post('start') : 0;
$pagesize = isset($_POST['pagesize']) ? $_POST['pagesize'] : 20; $pagesize = $this->post('pagesize') ? $this->post('pagesize') : 200;
$data = array( $mCase = new mCase();
array( $data = $mCase->getCaseByName($content,$start,$pagesize);
'id'=>1,
'name'=>"大陷胸丸方",
'source'=>"仲景伤寒论卷第四",
'search_num'=>100,
'sort'=>1,
),
array(
'id'=>2,
'name'=>"大陷胸汤方",
'source'=>"仲景伤寒论卷第四",
'search_num'=>88,
'sort'=>1,
)
);
$this->ajax_json(true, '获取成功', $data); $this->ajax_json(true, '获取成功', $data);
} }
public function ajax_case_detail() { public function ajax_case_detail() {
$id = $_GET['id']; $id = $this->get('id');
if(empty($id))$this->ajax_json(false, '非法请求'); if(empty($id))$this->ajax_json(false, '非法请求');
$data = array( $mCase = new mCase();
array( $data = $mCase->getCaseInfo($id);
'case'=>array(
'id'=>1,
'name'=>"大陷胸丸方",
'source'=>"仲景伤寒论卷第四",
"method"=> "",
'search_num'=>100,
'sort'=>1,
),
'case_herb'=>array(
array(
"id"=> "3",
"case_id"=> "1",
"herb_id"=> "1",
"num"=> "3",
"sort"=> "1",
),
array(
"id"=> "3",
"case_id"=> "1",
"herb_id"=> "2",
"num"=> "3",
"sort"=> "1",
)
),
'herb'=>array(
'1'=>array(
"id"=> "1",
"name"=> "知母",
"desc"=> "",
),
'2'=>array(
"id"=> "2",
"name"=> "石膏",
"desc"=> "",
),
)
)
);
$this->ajax_json(true, '获取成功', $data); $this->ajax_json(true, '获取成功', $data);
} }
public function ajax_save_user_case() { public function ajax_save_user_case() {
$uid = $_POST['uid']; $uid = $this->post('uid');
$token = $_POST['token']; $token = $this->post('token');
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求'); if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
$this->ajax_json(true, '保存成功'); $this->ajax_json(true, '保存成功');
} }
public function ajax_user_case_list() { public function ajax_user_case_list() {
$uid = $_POST['uid']; $uid = $this->post('uid');
$token = $_POST['token']; $token = $this->post('token');
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求'); if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
$id = $_POST['id']; $id = $this->post('id');
if($id){ if($id){
$data = array( $data = array(
'user_case' =>array( 'user_case' =>array(
@ -210,8 +158,8 @@ class index extends publicBase {
} }
public function ajax_collect_log() { public function ajax_collect_log() {
$start = isset($_GET['start']) ? $_GET['start'] : 0; $start = $this->get('start') ? $this->get('start') : 0;
$pagesize = isset($_GET['pagesize']) ? $_GET['pagesize'] : 20; $pagesize = $this->get('pagesize') ? $this->get('pagesize') : 200;
$data = array( $data = array(
array( array(
@ -230,7 +178,7 @@ class index extends publicBase {
} }
public function ajax_login(){ public function ajax_login(){
$code = $_GET['code']; $code = $this->get('code');
if(!$code)$this->ajax_json(false, '非法请求'); if(!$code)$this->ajax_json(false, '非法请求');
$data = array( $data = array(
@ -246,20 +194,17 @@ class index extends publicBase {
} }
public function ajax_pdf_url(){ public function ajax_pdf_url(){
$id = $_POST['id']; $uid = $this->post('uid');
$uid = $_POST['uid']; $token = $this->post('token');
$token = $_POST['token']; if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
if(empty($id) || empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
$this->ajax_json(true, '获取成功',array('pdf_url'=>'')); $this->ajax_json(true, '获取成功',array('pdf_url'=>''));
} }
public function ajax_mail(){ public function ajax_mail(){
$email = $_POST['email']; $uid = $this->post('uid');
$id = $_POST['id']; $token = $this->post('token');
$uid = $_POST['uid']; if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
$token = $_POST['token'];
if(empty($email) || empty($id) || empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
$this->ajax_json(true, '发送成功'); $this->ajax_json(true, '发送成功');
} }

Loading…
Cancel
Save