From 7642f60e3bb49174597350220d0e7cb11803fe7a Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Wed, 22 May 2024 16:07:32 +0800 Subject: [PATCH] YS --- application/controllers/Admin/Cage.php | 25 +++ application/controllers/Admin/Login.php | 2 +- application/controllers/Admin/Squirrel.php | 22 +- application/controllers/Api/Login.php | 7 +- application/controllers/Api/Squirrel.php | 3 +- application/models/Squirrel.php | 6 +- application/views/admin/cage/index.phtml | 222 ++++++++++++++++++ application/views/admin/index/ceil.phtml | 4 +- application/views/admin/index/company.phtml | 62 +---- application/views/admin/index/index.phtml | 47 ++-- application/views/admin/login/index.phtml | 12 +- application/views/admin/squirrel/index.phtml | 224 +++++++++++++++++++ public/style/logo.png | Bin 0 -> 6951 bytes 13 files changed, 537 insertions(+), 99 deletions(-) create mode 100644 application/controllers/Admin/Cage.php create mode 100644 application/views/admin/cage/index.phtml create mode 100644 application/views/admin/squirrel/index.phtml create mode 100644 public/style/logo.png diff --git a/application/controllers/Admin/Cage.php b/application/controllers/Admin/Cage.php new file mode 100644 index 0000000..c5b5c30 --- /dev/null +++ b/application/controllers/Admin/Cage.php @@ -0,0 +1,25 @@ +table} where is_delete=0"; + $count = $CageModel->query($sql); + $sql = "select * from {$CageModel->table} where is_delete=0 order by id desc limit {$offset},{$limit} "; + $data = $CageModel->query($sql); + foreach($data as $key => &$val){ + $val['type'] = $val['type']==1?'库存笼':'繁殖笼'; + } + $return['code'] = 0; + $return['count'] = count($count); + $return['data'] = $data; + $return['msg'] = "成功"; + echo json_encode($return);die; + } +} \ No newline at end of file diff --git a/application/controllers/Admin/Login.php b/application/controllers/Admin/Login.php index b8713ed..9279317 100644 --- a/application/controllers/Admin/Login.php +++ b/application/controllers/Admin/Login.php @@ -11,7 +11,7 @@ class Admin_LoginController extends Ctrl_Base{ $tMO = new AdminModel; $tRow = $tMO->field('*')->where("admin = '{$pName}' and status=1")->fRow(); - if(md5($pPasswd) != $tRow['password']){Tool_Fnc::ajaxMsg('密码不正确'); } + if(md5($pPasswd) != $tRow['password']){Tool_Fnc::ajaxMsg('账号密码不正确'); } $_SESSION['admin'] = array('id'=> $tRow['id'],'name' => $tRow['admin']); setcookie('admin[id]',$tRow['id'],time()+60*60*24*365,'/'); diff --git a/application/controllers/Admin/Squirrel.php b/application/controllers/Admin/Squirrel.php index 4f83e9a..a178425 100644 --- a/application/controllers/Admin/Squirrel.php +++ b/application/controllers/Admin/Squirrel.php @@ -1,9 +1,25 @@ field("*")->fList(); - $data['total'] = count($data['items']); - Tool_Fnc::apiMsg('获取成功',20000,$data); + $p = $_REQUEST; + $page = $p['page']; + $limit = $p['limit']; + $offset = ($page-1)*$limit; + $sql = "select * from {$SquirrelModel->table} where is_delete=0"; + $count = $SquirrelModel->query($sql); + $sql = "select * from {$SquirrelModel->table} where is_delete=0 order by id desc limit {$offset},{$limit} "; + $data = $SquirrelModel->query($sql); + foreach($data as $key => &$val){ + $val['sex'] = $val['sex']==1?'公':'母'; + } + $return['code'] = 0; + $return['count'] = count($count); + $return['data'] = $data; + $return['msg'] = "成功"; + echo json_encode($return);die; } } \ No newline at end of file diff --git a/application/controllers/Api/Login.php b/application/controllers/Api/Login.php index 817bf67..98d75fe 100644 --- a/application/controllers/Api/Login.php +++ b/application/controllers/Api/Login.php @@ -94,6 +94,7 @@ $group = empty($this->POST['group'])||!isset($this->POST['group'])? Tool_Fnc::apiMsg('请选择课题组', '500'):Tool_fnc::safe_string($this->POST['group']); //导师 $teacher = empty($this->POST['teacher'])||!isset($this->POST['teacher'])? Tool_Fnc::apiMsg('请选择导师', '500'):Tool_fnc::safe_string($this->POST['teacher']); + $phone = empty($this->POST['phone'])||!isset($this->POST['phone'])? Tool_Fnc::apiMsg('请输入手机号', '500'):Tool_fnc::safe_string($this->POST['phone']); //查询用户名是否存在 $Userinfo = $this->Usermodel->field('*')->where("username='{$username}' and type={$type} and is_delete=0")->fRow(); if(!empty($Userinfo)) Tool_Fnc::apiMsg('当前选择人员类型已存在此用户名,请重新填写用户名', '500'); @@ -105,6 +106,7 @@ $data['specialized'] = $specialized; $data['group'] = $group; $data['teacher'] = $teacher; + $data['phone'] = $phone; $ret = $this->Usermodel->save($data); if(!$ret) Tool_Fnc::apiMsg('注册失败', '500'); Tool_Fnc::apiMsg('注册成功,等待管理员审核通过', '200'); @@ -128,7 +130,9 @@ //导师 $teacher = empty($this->POST['teacher'])||!isset($this->POST['teacher'])? Tool_Fnc::apiMsg('请选择导师', '500'):Tool_fnc::safe_string($this->POST['teacher']); //查询用户名是否存在 - $Userinfo = $this->Usermodel->field('*')->where("username='{$username}' and type={$type} and is_delete=0 and id!={$data['id']}")->fRow(); + $phone = empty($this->POST['phone'])||!isset($this->POST['phone'])? Tool_Fnc::apiMsg('请输入手机号', '500'):Tool_fnc::safe_string($this->POST['phone']); + + $Userinfo = $this->Usermodel->field('*')->where("username='{$username}' and is_delete=0 and id!={$data['id']}")->fRow(); if(!empty($Userinfo)) Tool_Fnc::apiMsg('当前选择人员类型已存在此用户名,请重新填写用户名', '500'); $data['username'] = $username; // $data['password'] = md5($password.Yaf_Registry::get("config")->psd->default->appsecret); @@ -138,6 +142,7 @@ $data['specialized'] = $specialized; $data['group'] = $group; $data['teacher'] = $teacher; + $data['phone'] = $phone; $ret = $this->Usermodel->save($data); if(!$ret) Tool_Fnc::apiMsg('信息未变更', '500'); Tool_Fnc::apiMsg('编辑成功', '200'); diff --git a/application/controllers/Api/Squirrel.php b/application/controllers/Api/Squirrel.php index 89dec7d..c65718a 100644 --- a/application/controllers/Api/Squirrel.php +++ b/application/controllers/Api/Squirrel.php @@ -282,7 +282,8 @@ class Api_SquirrelController extends Ctrl_Api{ Tool_Fnc::apiMsg('获取成功', '200',$data); } public function getparentsAction(){ - $return = $this->Squirrelmodel->partent(); + $cage = empty($this->POST['cage'])||!isset($this->POST['cage'])?"":Tool_Fnc::safe_string($this->POST['cage']); + $return = $this->Squirrelmodel->partent($cage); Tool_Fnc::apiMsg('获取成功', '200',$return); } public function getIconAction(){ diff --git a/application/models/Squirrel.php b/application/models/Squirrel.php index e8bd540..9b86082 100644 --- a/application/models/Squirrel.php +++ b/application/models/Squirrel.php @@ -77,9 +77,11 @@ class SquirrelModel extends Orm_Base{ public function getOneInfo($squirrel){ return $this->field('id,number,sex,birthday,father,mother,strains_id as strains,gene,hair_color,cage,remark')->where("id={$squirrel}")->fRow(); } - public function partent(){ + public function partent($cage){ $time = date('Y-m-d',time()); - $data=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}'")->fList(); + $exec=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}'"); + if(!empty($cage))$exec->where("cage={$cage}"); + $data = $exec->fList(); return $data; } public function getIcon($squirrel){ diff --git a/application/views/admin/cage/index.phtml b/application/views/admin/cage/index.phtml new file mode 100644 index 0000000..a58c417 --- /dev/null +++ b/application/views/admin/cage/index.phtml @@ -0,0 +1,222 @@ + + +
+ +