public function edit($postArr) { if (empty($postArr['Id'])) { return array('msg' => '参数错误', 'status' => -1, 'href' => 2); } if (empty($postArr['name'])) { return array('msg' => '项目名称不能为空', 'status' => -1, 'href' => 2); } if (empty($postArr['principal_user_id'])) { return array('msg' => '请选择项目负责人', 'status' => -1, 'href' => 2); } if (empty($postArr['detail'])) { $postArr['detail'] = '暂无内容'; } $updateArr = array('name' => $postArr['name'], 'principal_user_id' => $postArr['principal_user_id'], 'detail' => $postArr['detail']); $this->update($updateArr, "Id={$postArr['Id']}"); $this->_modelUser = $this->_getGlobalData('Model_User', 'object'); $this->_modelUser->execute("update {$this->_modelUser->tName()} set project_id=0 where project_id = {$postArr['Id']}"); if (count($postArr['user_id'])) { $this->_modelUser->execute("update {$this->_modelUser->tName()} set project_id={$postArr['Id']} where Id in (" . implode(',', $postArr['user_id']) . ")"); } $this->_modelUser->createCache(); $this->createCache(); return array('msg' => '项目修改成功', 'status' => 1, 'href' => Tools::url('ProgramProject', 'Index', array('zp' => 'Program'))); }
/** * 删除部门 */ private function _departmentDel() { if ($this->_modelDepartment->delById($_GET['Id'])) { $this->_modelUser->update(array('department_id' => '0'), "department_id={$_GET['Id']}"); //将这个部门的所有员工都更新为0,无部门 $this->_modelDepartment->createCache(); $this->_modelUser->createCache(); $this->_utilMsg->showMsg('删除部门成功'); } else { $this->_utilMsg->showMsg('删除部门失败', -2); } }
/** * 创建用户 * @param array $userInfo 用户信息 * @return boolean */ public function createUser($userInfo) { $this->_modelUser = $this->_getGlobalData('Model_User', 'object'); $this->_modelUser->add($userInfo); $userInfo['Id'] = $this->_modelUser->returnLastInsertId(); $userClass = new Object_UserInfo(); $userClass->registerUserInfo($userInfo); $userClass->setUpdateInfo(1); $userClass = null; $this->_modelUser->createCache(); return true; }
public function cCreateCache() { $this->_modelUser = $this->getGlobal('model/User', 'Model_User'); $this->_modelUser->createCache(); $this->success('创建缓存成功', url('setup/user/index')); }