|
|
@ -134,7 +134,13 @@ class admin extends publicBase { |
|
|
|
//只取出当前页显示 |
|
|
|
$list = $mformula->getFormulaList($condition, $curpage, $page->pagesize); |
|
|
|
|
|
|
|
//管理员列表 |
|
|
|
$m_admin_user = new mAdminUser(); |
|
|
|
$user_list = $m_admin_user->getUserList(); |
|
|
|
$user_list = array_column($user_list, null, 'id'); |
|
|
|
|
|
|
|
$this->view['list'] = $list; |
|
|
|
$this->view['user_list'] = $user_list; |
|
|
|
} |
|
|
|
|
|
|
|
public function formula_add() { |
|
|
@ -148,14 +154,17 @@ class admin extends publicBase { |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_save_formula() { |
|
|
|
$user_info = $this->get_uinfo(); |
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
|
$name = trim($this->post('name')); |
|
|
|
$source = trim($this->post('source')); |
|
|
|
$method = trim($this->post('method')); |
|
|
|
$remark = trim($this->post('remark')); |
|
|
|
$herbs = $this->post('herbs'); |
|
|
|
|
|
|
|
$mformula = new mFormula(); |
|
|
|
$id = $mformula->saveFormula(0, $id, $name, $source, $method, $herbs); |
|
|
|
$id = $mformula->saveFormula(0, $id, $name, $source, $method, $herbs, $remark, $user_info['id']); |
|
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
|
|
$this->ajax_json(true, '操作成功', array('id' => $id)); |
|
|
@ -170,13 +179,21 @@ class admin extends publicBase { |
|
|
|
$this->ajax_json(true, '识别成功', $data); |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_delete_formula() { |
|
|
|
public function ajax_update_formula() { |
|
|
|
$user_info = $this->get_uinfo(); |
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
|
$is_delete = $this->post('is_delete') + 0; |
|
|
|
$is_delete = $this->post('is_delete'); |
|
|
|
$remark = trim($this->post('remark')); |
|
|
|
|
|
|
|
$data = array(); |
|
|
|
if (!empty($is_delete)) $data['is_delete'] = $is_delete + 0; |
|
|
|
if (!empty($remark)) $data['remark'] = $remark; |
|
|
|
$data['user_id'] = $user_info['id']; |
|
|
|
|
|
|
|
$mformula = new mFormula(); |
|
|
|
$id = $mformula->deleteFormula(0, $id, $is_delete); |
|
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
|
$res = $mformula->updateFormula($id, $data); |
|
|
|
if (!$res) $this->ajax_json(true, '操作失败'); |
|
|
|
|
|
|
|
$this->ajax_json(true, '操作成功'); |
|
|
|
} |
|
|
|