public function commit($parameters) { if (empty($parameters)) { $result = Utils::WrapResultError("无效的数据"); return $result; } $currUser = $parameters["user"]; if (empty($currUser)) { return Utils::WrapResultError("请登录后重试", ReturnCode::$NOTLOGIN); } try { //写业务表 $apply_id = SysSeq::GetSeqNextValue($this->conn, "we_app_notice", "id"); $sql = "insert into we_app_notice(id,title,content,author,publishdate,publishstaff,publisharea,isprivate,status,eno,appid)values(?,?,?,?,now(),?,?,?,'1',?,?)"; $this->conn->ExecSQL($sql, array((string) $apply_id, (string) $parameters["title"], (string) $parameters["content"], (string) $currUser->getUserName(), (string) $currUser->getUserName(), (string) $parameters["publisharea"], (string) $parameters["isprivate"], (string) $currUser->eno, (string) $parameters["appid"])); //消息内容 $message_body = array("appid" => $parameters["appid"], "title" => $parameters["title"], "id" => $apply_id); //获取发布范围内的人员jid $toDept = explode(",", $parameters["publisharea"]); $tojids = array(); $deptMgr = new Dept($this->conn, $this->conn_im, $this->container); for ($i = 0; $i < count($toDept); $i++) { //获取部门下的所有人员jid $staffjid = $deptMgr->getAllStaffJid($toDept[$i]); for ($i = 0; $i < count($staffjid); $i++) { $tojids[] = $staffjid[$i]["jid"]; if (count($tojids) >= 500) { //向审批人发送消息,一次性最多推送500个帐号 Utils::sendImMessage("", $tojids, "bus_app_msgpush", json_encode($message_body), $this->container, "", "", false, '', '0'); $tojids = array(); } } } if (count($tojids) > 0) { //向审批人发送消息 Utils::sendImMessage("", $tojids, "bus_app_msgpush", json_encode($message_body), $this->container, "", "", false, '', '0'); } $result = Utils::WrapResultOK(""); } catch (\Exception $e) { $this->logger->err($e); $result = Utils::WrapResultError($e->getMessage()); } return $result; }