/** * 创建用户 * @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; }
/** * 增加一个员工 * @param Object_UserInfo 用户 * @return int 返回-3,-2,-1,1<br / * -3:此员工已经加入了别的房间<br /> * -2:出口未打开<br /> * -1:已经有此员工<br /> * 1:正常加入员工<br /> */ public function addUser(Object_UserInfo $userClass) { if ($this->_entrance == false) { return -2; } if ($userClass['_roomId'] == $this->_id) { return -1; } if ($userClass['_roomId'] != 0) { return -3; } if (array_search($userClass['_userName'], $this->_userClassList) !== false) { return -1; } array_push($this->_userClassList, $userClass['_userName']); //记录此员工的userName $userClass->inRoom($this->_id); $userClass->setUpdateInfo(1); $this->_isUpdate = 1; return 1; }
/** * 更新拥有者 */ public function updateWorkOrderOwner(Object_UserInfo $userClass, $workOrder) { $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object'); $this->_modelWorkOrder->update(array('owner_user_id' => $userClass['_id']), "Id={$workOrder['work_order_id']}"); $userClass->addToOrderNum(1); //增加自身的工单数量 $userClass->setUpdateInfo(1); }