public function publishOfficialTrendAction() { $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $da = $this->get('we_data_access'); $network_domain = $request->get('network_domain'); $conv_content = $request->get('trend'); $notifystaff = $request->get('notifystaff'); $attachs = $request->get('attachs'); $post_to_group = $request->get('post_to_group'); $circle_id = $user->get_circle_id($network_domain); $infotype = $request->get('infotype'); //信息类型:通知、公告、.... $top = $request->get('top'); //是否置顶 $time = $request->get('time'); //置顶时间 $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id"); $conv = new \Justsy\BaseBundle\Business\Conv(); if ($conv->newOfficialTrend($da, $user, $conv_id, $conv_content, $circle_id, $post_to_group, $notifystaff, $attachs, $infotype, "00", $this->container)) { if ($top == '1') { $conv->convTop($da, $conv_id, $time); } } $caption = ""; $receivedept = ""; $fafa_jid = array(); if ($infotype == "notice") { //通知 if ($post_to_group != "ALL") { $groupObj = new \Justsy\BaseBundle\Management\GroupMgr($da, $this->get('we_data_access_im')); $getGroupInfo = $groupObj->Get($post_to_group); $fafa_jid = $groupObj->getGroupMembersJid($post_to_group); //群组通知 $caption = $getGroupInfo["group_name"] . "—群组通知"; } else { //判断是否是外部圈子 $en_circle_id = $user->get_circle_id($user->edomain); //全体通知 $caption = "全体通知"; if ($en_circle_id == $circle_id) { $receivedept = "v" . $user->eno; } else { $circlemgr = new \Justsy\BaseBundle\Management\CircleMgr($da, $this->get('we_data_access_im')); $data = $circlemgr->Get($circle_id); $caption = $data["circle_name"] . "—圈子通知"; $fafa_jid = $circlemgr->getCircleMembersJid($circle_id); } } } else { if ($infotype == "bulletin") { if ($post_to_group != "ALL") { $groupObj = new \Justsy\BaseBundle\Management\GroupMgr($da, $this->get('we_data_access_im')); $getGroupInfo = $groupObj->Get($post_to_group); $fafa_jid = $groupObj->getGroupMembersJid($post_to_group); //群组公告 $caption = $getGroupInfo["group_name"] . "—群组公告"; } else { //全体公告 $caption = "全体公告"; //判断是否是外部圈子 $en_circle_id = $user->get_circle_id($user->edomain); if ($en_circle_id == $circle_id) { $receivedept = "v" . $user->eno; } else { $circlemgr = new \Justsy\BaseBundle\Management\CircleMgr($da, $this->get('we_data_access_im')); $data = $circlemgr->Get($circle_id); $caption = $data["circle_name"] . "—圈子公告"; //获取圈子成员 $fafa_jid = $circlemgr->getCircleMembersJid($circle_id); } } } } //发送即时消息 $ec = new \Justsy\OpenAPIBundle\Controller\ApiController(); $ec->setContainer($this->container); $im_sender = $this->container->getParameter('im_sender'); $message = $conv_content; $link = $this->generateUrl("JustsyBaseBundle_view_oneconv", array("conv_root_id" => $conv_id), true); $linkButtons = Utils::makeBusButton(array(array("code" => "action", "text" => "详细", "blank" => "1", "value" => ""))); $r = $ec->runonceRemindTask($im_sender, implode(",", $fafa_jid), $receivedept, $caption, $message, $link, $linkButtons); $re = array('success' => '1', 'conv_id' => $conv_id); $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }