From 5789d2b5f976f3fe487b6d19550526305fbeb815 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Tue, 4 Jun 2024 17:27:18 +0800 Subject: [PATCH] YS --- application/controllers/Admin/User.php | 13 ++- application/controllers/Api/Cage.php | 1 + application/controllers/Api/Squirrel.php | 8 ++ application/library/Ctrl/Admin.php | 6 +- application/views/admin/index/index.phtml | 4 +- application/views/admin/user/password.phtml | 96 +++++++++++++++++++++ 6 files changed, 120 insertions(+), 8 deletions(-) create mode 100644 application/views/admin/user/password.phtml diff --git a/application/controllers/Admin/User.php b/application/controllers/Admin/User.php index df8d979..1c5f2ba 100644 --- a/application/controllers/Admin/User.php +++ b/application/controllers/Admin/User.php @@ -111,10 +111,17 @@ class Admin_UserController extends Ctrl_Admin{ } return json_encode(array_merge($diff,$excelarray)); } - public function updatePassAction(){ - + public function passwordAction(){ } public function updatePsdAction(){ -// $_P[] + $password = empty($_POST['password'])||!isset($_POST['password'])?Tool_Fnc::apiMsg('请输入新密码', '500'):Tool_Fnc::safe_string($_POST['password']); + $repassword = empty($_POST['repassword'])||!isset($_POST['repassword'])?Tool_Fnc::apiMsg('请确认新密码', '500'):Tool_Fnc::safe_string($_POST['repassword']); + $id = $_SESSION['admin']['id']; + $adminModel = new AdminModel(); + if($password!=$repassword) Tool_Fnc::ajaxMsg('两次输入密码不一致', '500'); + $up['id'] = $id; + $up['password'] = md5($password); + if(!$adminModel->update($up)) Tool_Fnc::ajaxMsg('密码未改变', '500'); + Tool_Fnc::ajaxMsg('密码已变更', '1'); } } \ No newline at end of file diff --git a/application/controllers/Api/Cage.php b/application/controllers/Api/Cage.php index 1d0475f..b48085e 100644 --- a/application/controllers/Api/Cage.php +++ b/application/controllers/Api/Cage.php @@ -148,6 +148,7 @@ class Api_CageController extends Ctrl_Api{ $sql = "select count(*) num from squirrel where cage={$data[$key]['id']} and is_kill=0 and is_delete=0 and sex=1"; $mannum = $this->Cagemodel->query($sql); if(!empty($mannum)){ + if($val['type']==2 && $squirrel['sex']==1) unset($data[$key]); $data[$key]['mannum'] = $mannum[0]['num']; } //查询母鼠 diff --git a/application/controllers/Api/Squirrel.php b/application/controllers/Api/Squirrel.php index c42dc4a..e118586 100644 --- a/application/controllers/Api/Squirrel.php +++ b/application/controllers/Api/Squirrel.php @@ -355,5 +355,13 @@ class Api_SquirrelController extends Ctrl_Api{ } Tool_Fnc::apiMsg('获取成功', '200',$data); } + public function jianweiAction(){ + $number = empty($this->POST['number'])?Tool_Fnc::apiMsg('请输入编号', '500'):$this->POST['number']; + $bianhao = explode('-',$number); + $start = (int) filter_var($bianhao[0], FILTER_SANITIZE_NUMBER_INT); + $end = (int) filter_var($bianhao[1], FILTER_SANITIZE_NUMBER_INT); + echo $start; + echo $end;die; + } } diff --git a/application/library/Ctrl/Admin.php b/application/library/Ctrl/Admin.php index d0f9b68..3da34c1 100644 --- a/application/library/Ctrl/Admin.php +++ b/application/library/Ctrl/Admin.php @@ -9,9 +9,9 @@ class Ctrl_Admin extends Ctrl_Base { protected $disableController = false; //禁用控制器 protected $disableMethodPost = array(); //禁用POST提交控制器 - //public function init(){ - // if(!isset($_SESSION['admin'])){echo '';exit();} - //} + public function init(){ + if(!isset($_SESSION['admin'])){echo '';exit();} + } /** * Ajax 保存字段 */ diff --git a/application/views/admin/index/index.phtml b/application/views/admin/index/index.phtml index 9ca52fe..dd4bd0f 100644 --- a/application/views/admin/index/index.phtml +++ b/application/views/admin/index/index.phtml @@ -22,7 +22,7 @@ =empty($_SESSION['admin']['name'])?'未登录':$_SESSION['admin']['name']?>