/** * 检查用户密码是否正确 * 检查是否存在此机构号 * * @param string $head * @return boolean */ private function check($head, &$result) { try { //检查用户/密码 if ($head["user"] != "webbusiness" & $head["pass"] != "web4321") { $result = $this->createResult($head["type"], -2); return false; } //检查是否有此机构号 if (!trim($head["organid"])) { $result = $this->createResult($head["type"], -3); return false; } if ($head["organid"] == 'super') { return true; } $model = new DeptModel(); $rs = $model->find("organid = '" . $head["organid"] . "' and type = 'organ'"); if (!$rs) { $result = $this->createResult($head["type"], -3); return false; } else { $this->company = $rs["DeptNo"]; } //$this->company = '000003'; return true; } catch (Exception $e) { $this->addLog("NotException error from checkUser:"******"type"]); return false; } }
/** * 添加员工 * * @param array $data * @return int $id */ private function memberAdd($info) { $data["UserNo"] = $info["EmployeeId"]; $data["UserName"] = $info["Name"]; $data["LoginName"] = $info["LoginName"]; $data["Password"] = "******"; $data["Verify"] = "%"; $data["Mobil"] = $info["Mobile"]; $data["Nodetype"] = "x"; $data["OrganId"] = $info["OrganId"]; $data["DeptId"] = $info["DeptId"]; $data["UserId"] = $info["UserId"]; $model = new DeptModel(); if ($info["DeptId"]) { $result = $model->find("DeptId = '" . $info["DeptId"] . "' and Type ='Department'"); if (!$result) { $this->addLog("member-no parent dept:" . $info["DeptId"]); return false; } } else { $result = $model->find("OrganId = '" . $info["OrganId"] . "' and Type ='Organ'"); if (!$result) { $this->addLog("member-no organ organ:" . $info["OrganId"]); return false; } } $data["Upnode"] = $result["DeptNo"]; $model = new MemberModel(); //添加 $result = $model->add($data); return $result; }