public function agreejoin($paraObj) { $currUser = $paraObj["user"]; if (empty($currUser)) { return Utils::WrapResultError("请登录后重试", ReturnCode::$NOTLOGIN); } $wfl = new \Justsy\BaseBundle\Business\WeWorkflow($this->container); //根据申请帐号处理 $account = isset($paraObj["staff"]) ? $paraObj["staff"] : ""; if (!empty($account)) { $paraObj["appid"] = $paraObj["user"]->eno; $paraObj["submit_staff"] = $account; } $nodeinfo = $wfl->getNode($paraObj); if (empty($nodeinfo)) { return Utils::WrapResultError("申请已被取消或删除"); } $paraObj["node_id"] = $nodeinfo["node_id"]; $applystaff = $nodeinfo["submit_staff"]; //判断申请人是否已加入企业 $staffobj = new \Justsy\BaseBundle\Management\Staff($this->da, $this->container->get('we_data_access_im'), $applystaff, $this->logger, $this->container); $staffata = $staffobj->getInfo(); if ($staffata["eno"] != Utils::$PUBLIC_ENO) { if ($staffata["eno"] == $currUser->eno) { return Utils::WrapResultError("该帐号已加入企业"); } else { return Utils::WrapResultError("该帐号已加入其他企业"); } } $message = "你加入{$currUser->ename}的申请已审批通过"; Utils::sendImMessage("", $applystaff, "enterprise_joinagree", $message, $this->container, "", "", true, '', '0'); //员工加入处理 $eno = $paraObj["user"]->eno; $jid = SysSeq::GetSeqNextValue($this->da, "we_staff", "fafa_jid"); $jid .= "-" . $eno . "@fafacn.com"; $tr = $staffobj->swtichEno($eno); //更换企业号 if ($tr) { $staffobj->updateJid($staffata["fafa_jid"], $jid); } //更新im库中的jid $newinfo = $staffobj->getInfo(true); Utils::sendImMessage("", $newinfo["fafa_jid"], "enterprise_joinagree", $message, $this->container, "", "", true, '', '0'); //申请状态处理 $re = $wfl->agree($paraObj); if (!empty($re)) { //通知企业其他管理员 $endata = $this->getInfo($currUser->eno); $to = $endata["sys_manager"]; if (empty($to)) { $to = $endata["create_staff"]; } Utils::sendImMessage("", explode(";", $to), "enterprise_joinagree", json_encode($re), $this->container, "", "", true, '', '0'); } return Utils::WrapResultOK($re); }