/**
  * 添加文章
  */
 public function add()
 {
     $this->checkLogin();
     $Department = new DepartmentModel();
     $departments = $Department->getAllDepartments();
     $category = new CategoryModel();
     $categories = $category->getCategories();
     $this->assign('categories', $categories);
     $this->assign('departments', $departments);
     $this->display();
 }
 public function deleteDepartment()
 {
     $this->checkLogin();
     $id = $_GET['DP_id'];
     $Department = new DepartmentModel();
     $result = $Department->deleteDepartment($id);
     if ($result == true) {
         $this->success('添加成功', 'index');
     } else {
         $this->error("添加失败");
     }
 }
Ejemplo n.º 3
0
 public function modifyPsd()
 {
     $this->checkLogin();
     $Department = new DepartmentModel();
     $array['DP_username'] = $_POST['DP_username'];
     $array['DP_tel'] = $_POST['DP_tel'];
     $array['DP_psd'] = md5($_POST['password']);
     $array['DP_id'] = session('userid');
     $result = $Department->modifyPsd($array);
     if ($result == true) {
         $this->success('修改成功', 'index');
     } else {
         $this->error("修改失败");
     }
 }
 public function loginCheck()
 {
     $Department = new DepartmentModel();
     $loginArray['username'] = $_POST['username'];
     $loginArray['password'] = $_POST['password'];
     $loginArray['DP_level'] = $_POST['type'];
     $result = $Department->loginCheck($loginArray);
     if ($result['status']) {
         $_SESSION['username'] = $loginArray['username'];
         $_SESSION['userid'] = $result['userid'];
         $_SESSION['userlevel'] = $_POST['type'];
         $result['type'] = $_POST['type'];
         $this->ajaxReturn($result);
     } else {
         $this->ajaxReturn($result);
     }
 }