|
@ -10,6 +10,7 @@ include_once(SERVER_ROOT . "/model/mPage.php"); |
|
|
class index extends publicBase { |
|
|
class index extends publicBase { |
|
|
|
|
|
|
|
|
private function _check_login() { |
|
|
private function _check_login() { |
|
|
|
|
|
// return array('uid'=>$this->post('uid')); |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
if ($uid < 0 || !$token) $this->ajax_json(false, '参数错误', array('code' => CODE_LOGIN_EXIPRE)); |
|
|
if ($uid < 0 || !$token) $this->ajax_json(false, '参数错误', array('code' => CODE_LOGIN_EXIPRE)); |
|
@ -98,6 +99,7 @@ class index extends publicBase { |
|
|
$uinfo = $this->_check_login(); |
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
$id = $this->post('id') + 0; |
|
|
|
|
|
$is_delete = $this->post('is_delete') + 0; |
|
|
$name = trim($this->post('name')); |
|
|
$name = trim($this->post('name')); |
|
|
$source = trim($this->post('source')); |
|
|
$source = trim($this->post('source')); |
|
|
$method = trim($this->post('method')); |
|
|
$method = trim($this->post('method')); |
|
@ -111,27 +113,39 @@ class index extends publicBase { |
|
|
if (!$request_times) $this->ajax_json(false, $mformula->getError()); |
|
|
if (!$request_times) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
|
|
|
//新增药方 |
|
|
//新增药方 |
|
|
$id = $mformula->formula($uinfo['uid'], $id, $name, $source, $method, $herbs); |
|
|
$id = $mformula->formula($uinfo['uid'], $id, $name, $source, $method, $herbs, $is_delete); |
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '成功', array('id' => $id)); |
|
|
$this->ajax_json(true, '请求成功', array('id' => $id)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// public function ajax_update_formula() { |
|
|
public function ajax_delete_formula() { |
|
|
// $uinfo = $this->_check_login(); |
|
|
$uinfo = $this->_check_login(); |
|
|
// |
|
|
|
|
|
// $id = $this->post('id') + 0; |
|
|
$id = $this->post('id') + 0; |
|
|
// $name = trim($this->post('name')); |
|
|
|
|
|
// $source = trim($this->post('source')); |
|
|
$mformula = new mFormula(); |
|
|
// $method = trim($this->post('method')); |
|
|
$id = $mformula->deleteFormula($uinfo['uid'], $id); |
|
|
// $herbs = $this->post('herbs'); |
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
// |
|
|
|
|
|
// $mformula = new mFormula(); |
|
|
$this->ajax_json(true, '请求成功'); |
|
|
// $res = $mformula->saveFormula($uinfo['uid'], $id, $name, $source, $method, $herbs); |
|
|
} |
|
|
// if (!$res) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
// |
|
|
// public function ajax_update_formula() { |
|
|
// $this->ajax_json(true, '保存成功'); |
|
|
// $uinfo = $this->_check_login(); |
|
|
// } |
|
|
// |
|
|
|
|
|
// $id = $this->post('id') + 0; |
|
|
|
|
|
// $name = trim($this->post('name')); |
|
|
|
|
|
// $source = trim($this->post('source')); |
|
|
|
|
|
// $method = trim($this->post('method')); |
|
|
|
|
|
// $herbs = $this->post('herbs'); |
|
|
|
|
|
// |
|
|
|
|
|
// $mformula = new mFormula(); |
|
|
|
|
|
// $res = $mformula->saveFormula($uinfo['uid'], $id, $name, $source, $method, $herbs); |
|
|
|
|
|
// if (!$res) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
// |
|
|
|
|
|
// $this->ajax_json(true, '保存成功'); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
public function ajax_user_formula() { |
|
|
public function ajax_user_formula() { |
|
|
$uinfo = $this->_check_login(); |
|
|
$uinfo = $this->_check_login(); |
|
|