diff --git a/module/Admin/src/Admin/Controller/UsersController.php b/module/Admin/src/Admin/Controller/UsersController.php index a835e96c..b7443d0d 100644 --- a/module/Admin/src/Admin/Controller/UsersController.php +++ b/module/Admin/src/Admin/Controller/UsersController.php @@ -11,6 +11,7 @@ namespace Admin\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; +use Zend\View\Model\JsonModel; use Sookon\Helpers\View as view; use Sookon\Helpers\Db; @@ -100,6 +101,45 @@ class UsersController extends AbstractActionController return view::Post($this,"用户密码重置失败!",-1); } } + + if($ac == "auth") + { + if($this->getRequest()->isXmlHttpRequest()) + { + $userid = $this->params()->fromPost('userid'); + $usertype = $this->params()->fromPost('usertype'); + + if(empty($userid) || empty($usertype)) + { + return new JsonModel(array('error'=>"参数错误")); + } + + $users = new \Westdc\Member\Member; + if($users->changeUsertype($userid,$usertype) > 0) + { + return new JsonModel(array('success'=>1)); + }else{ + return new JsonModel(array('error'=>"未发生任何变更")); + } + } + }//修改usetype + + if($ac == 'del') + { + if(!is_numeric($id) || $id < 1) + { + return view::Post($this,"参数错误",-1); + } + + $users = new \Westdc\Member\Member; + + if($users->deleteUser($id) > 0) + { + return view::Post($this,"删除成功",-1); + }else{ + return view::Post($this,"删除失败",-1); + } + }//删除 } # 邮件模板模块 diff --git a/module/Admin/view/admin/users/index.phtml b/module/Admin/view/admin/users/index.phtml index cd1ae99a..27b1c0b1 100644 --- a/module/Admin/view/admin/users/index.phtml +++ b/module/Admin/view/admin/users/index.phtml @@ -37,6 +37,7 @@ 姓名 单位 Email + 权限 添加时间 操作 @@ -48,16 +49,27 @@ + + + + + + + @@ -81,4 +93,96 @@ partial("layout/admin/users/nav") ?> - \ No newline at end of file + + + + \ No newline at end of file diff --git a/vendor/Westdc/Member/Member.php b/vendor/Westdc/Member/Member.php index 06b74ecb..e50070ba 100644 --- a/vendor/Westdc/Member/Member.php +++ b/vendor/Westdc/Member/Member.php @@ -122,5 +122,17 @@ class Member } } + public function changeUsertype($uid,$utype) + { + $sql = "UPDATE {$this->table->member} SET usertype='$utype' WHERE id=$uid"; + return $this->db->exec($sql); + } + + public function deleteUser($uid) + { + $sql = "DELETE FROM {$this->table->member} WHERE id=$uid"; + return $this->db->exec($sql); + } + } \ No newline at end of file