From 2ddc0df796ac79aa9eb104e8caaeab0d0550cd6e Mon Sep 17 00:00:00 2001 From: pengda <10266652509@qq.com> Date: Thu, 19 Sep 2024 10:39:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=AF=E6=96=B9=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- control/index.php | 12 ++++++++---- model/mFormula.php | 6 +++--- model/mUserCase.php | 14 ++++++-------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/control/index.php b/control/index.php index b617df0..61f25b7 100644 --- a/control/index.php +++ b/control/index.php @@ -43,7 +43,11 @@ class index extends publicBase { } if (empty($user_info)) { - $robj->setex(_QR_ADMIN_USER_INFO, 12 * 60 * 60, json_encode(array('name' => 'admin', 'password' => bin2hex(openssl_random_pseudo_bytes(8))))); + $email = ADMIN_PASSWORD_GET_EMAIL; + $pass = bin2hex(openssl_random_pseudo_bytes(8)); + $robj->setex(_QR_ADMIN_USER_INFO, 12 * 60 * 60, json_encode(array('name' => 'admin', 'password' => $pass))); + + $m_user->sendMail(array($email), '医案录入后台', '新密码是:' . $pass); } } @@ -191,7 +195,7 @@ class index extends publicBase { $condition = array(); - $condition['uid'] = array(0,$uinfo['uid']); + $condition['uid'] = array(0, $uinfo['uid']); if ($content) $condition['name'] = $content; $mformula = new mFormula(); @@ -273,7 +277,7 @@ class index extends publicBase { $uinfo = $this->_check_login(); $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_user_case = new mUserCase(); $data = $m_user_case->getUserCaseList($uinfo['uid'], $page_num, $page_size); @@ -305,7 +309,7 @@ class index extends publicBase { public function ajax_collect_log() { $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; $mformula = new mFormula(); $data = $mformula->getCollectLog($page_num, $page_size); diff --git a/model/mFormula.php b/model/mFormula.php index 1fe723a..4aec974 100644 --- a/model/mFormula.php +++ b/model/mFormula.php @@ -235,7 +235,7 @@ class mFormula extends mBase { public function insertHerb($info) { $herb_id = $this->obj->insert($this->herb_tbl, $info); if (!$herb_id) { - $this->setError('添加药材失败'); + $this->writeLog('formula', 'update_error_log', '添加药材失败|' . json_encode($info)); return false; } @@ -265,7 +265,7 @@ class mFormula extends mBase { } else { $temp['herb_id'] = $this->insertHerb(array('uid' => $uid, 'name' => $name)); if (!$temp['herb_id']) { - $this->writeLog('formula', 'update_error_log', '添加药材失败|' . $uid . '|' . $name); + $this->setError('添加药材失败'); return false; } } @@ -502,7 +502,7 @@ class mFormula extends mBase { public function updateFormulaUseLog($uid, $formula_id) { $res = $this->obj->increase($this->formula_use_log_tbl, array('sql' => '`uid`=? and `formula_id`=?', 'vals' => array($uid, $formula_id)), 'use_num'); if (!$res) { - $this->setError('添加药方药材失败'); + $this->writeLog('formula', 'update_error_log', '药方使用次数更新失败|' . $uid . '|' . $formula_id); return false; } diff --git a/model/mUserCase.php b/model/mUserCase.php index cb8d5bf..44b3830 100644 --- a/model/mUserCase.php +++ b/model/mUserCase.php @@ -17,7 +17,7 @@ class mUserCase extends mBase { public function insertUserCase($info) { $id = $this->obj->insert($this->tbl, $info); if (empty($id)) { - $this->setError('添加医案失败'); + $this->writeLog('user_case', 'insert_error_log', '添加医案失败|' . json_encode($info, JSON_UNESCAPED_UNICODE)); return false; } @@ -27,7 +27,7 @@ class mUserCase extends mBase { public function updateUserCase($id, $info) { $res = $this->obj->update($this->tbl, $info, array('sql' => '`id`=?', 'vals' => array($id))); if (!$res) { - $this->setError('更新失败'); + $this->writeLog('user_case', 'update_error_log', '更新医案失败|' . $id . '|' . json_encode($info, JSON_UNESCAPED_UNICODE)); return false; } @@ -56,7 +56,7 @@ class mUserCase extends mBase { $res = $this->updateUserCase($id, $data); if (!$res) { - $this->writeLog('user_case', 'update_error_log', '更新医案失败|' . $uid . '|' . json_encode($data, JSON_UNESCAPED_UNICODE)); + $this->setError('更新失败'); return false; } @@ -151,7 +151,7 @@ class mUserCase extends mBase { $herb_id = $mformula->insertHerb(array('uid' => $uid, 'name' => $item['name'])); if (!$herb_id) { - $this->writeLog('formula', 'insert_error_log', '添加药材失败|' . $uid . '|' . $item['name']); + $this->setError('添加药材失败'); return false; } @@ -171,7 +171,7 @@ class mUserCase extends mBase { $id = $this->insertUserCase($data); if (!$id) { - $this->writeLog('user_case', 'insert_error_log', '添加医案失败|' . $uid . '|' . json_encode($data, JSON_UNESCAPED_UNICODE)); + $this->setError('添加医案失败'); return false; } @@ -179,7 +179,7 @@ class mUserCase extends mBase { //更新用户药方使用次数 $res = $mformula->updateFormulaUseLog($uid, $formula_id); if (!$res) { - $this->writeLog('formula', 'update_error_log', '药方使用次数更新失败|' . $uid . '|' . $formula_id); + $this->setError('药方使用次数更新失败'); return false; } } @@ -227,7 +227,6 @@ class mUserCase extends mBase { $user_case['prescribe_herb'] = $prescribe_herb; - return $user_case; } @@ -295,7 +294,6 @@ class mUserCase extends mBase { $value['formula_info'] = ''; if (isset($formula_arr[$value['formula_id']])) { - $formula_info = $formula_arr[$value['formula_id']]; $value['formula_info'] .= "选 ";