Exemplo n.º 1
0
 public function sendPresence($conv_id, $da, $circle_id, $post_to_group, $type)
 {
     $groupid = "";
     $group_type = "group";
     $fafa_jid = array();
     $jid = "";
     if ($circle_id == "10000") {
         return;
     }
     $user = $this->get('security.context')->getToken()->getUser();
     if ($post_to_group != "ALL" && $post_to_group != "PRIVATE") {
         $groupObj = new \Justsy\BaseBundle\Management\GroupMgr($da, $this->get('we_data_access_im'), $this->container);
         $getGroupInfo = $groupObj->Get($post_to_group);
         $jid = $getGroupInfo["fafa_groupid"];
         $fafa_jid = $groupObj->getGroupMembersJid($post_to_group, "1");
         //获取允许接收群组动态通知的成员列表
         $groupid = $post_to_group;
     } else {
         $group_type = "circle";
         $groupid = $circle_id;
         $circlemgr = new \Justsy\BaseBundle\Management\CircleMgr($da, $this->get('we_data_access_im'));
         $getGroupInfo = $circlemgr->Get($circle_id);
         $jid = $getGroupInfo["fafa_groupid"];
         //判断是否是私密,私密时不向圈子成员发出席
         if ($post_to_group == "PRIVATE") {
             $group_type = "private";
         } else {
             if ($circle_id == "9999") {
                 $staffMgr = new \Justsy\BaseBundle\Management\Staff($da, $this->get('we_data_access_im'), $user, $this->get("logger"), $this->container);
                 $fafa_jid = $staffMgr->getFriendJidList($conv_id);
             } else {
                 $fafa_jid = $circlemgr->getCircleMembersJid($circle_id, "1");
             }
         }
     }
     $cc_jid = array();
     //获取抄送的人员jid
     $sql = "select b.fafa_jid from we_convers_notify a ,we_staff b where a.cc_login_account=b.login_account and conv_id=?";
     $ds = $da->getData("ds", $sql, array((string) $conv_id));
     if ($ds && count($ds["ds"]["rows"]) > 0) {
         for ($i = 0; $i < count($ds["ds"]["rows"]); $i++) {
             $cc_jid[] = $ds["ds"]["rows"][$i]["fafa_jid"];
         }
     }
     //发送即时消息
     $ec = new \Justsy\OpenAPIBundle\Controller\ApiController();
     $ec->setContainer($this->container);
     $message = array($group_type . "id" => $groupid, "t" => $type, "jid" => $jid);
     $link = $this->generateUrl("JustsyBaseBundle_view_oneconv", array("conv_root_id" => $conv_id), true);
     $linkButtons = Utils::makeBusButton(array(array("code" => "action", "text" => "详细", "blank" => "1", "value" => "")));
     //分次发送通知。每次200个号
     $c = 0;
     $sendAry = array();
     for ($i = 0; $i < count($fafa_jid); $i++) {
         $sendAry[] = $fafa_jid[$i];
         $c++;
         if ($c >= 200) {
             $r = $ec->sendPresence($user->fafa_jid, implode(",", $sendAry), "", json_encode($message), $link, $linkButtons, false, $group_type . "_newtrend");
             $c = 0;
             $sendAry = array();
         }
     }
     if ($c > 0) {
         $r = $ec->sendPresence($user->fafa_jid, implode(",", $sendAry), "", json_encode($message), $link, $linkButtons, false, $group_type . "_newtrend", "0");
     }
     if (count($cc_jid) > 0) {
         //给抄送人员推消息
         $r = $ec->sendMsg($user->fafa_jid, implode(",", $cc_jid), "", json_encode($message), $link, $linkButtons, false, "private_newtrend");
     }
 }
Exemplo n.º 2
0
 $sql = "call p_quitgroup(?, ?, 0)";
 $params = array();
 $params[] = (string) $group_id;
 $params[] = (string) $user->getUserName();
 $ds = $da->GetData("p_quitgroup", $sql, $params);
 if ($ds["p_quitgroup"]["rows"][0]["recode"] == "0") {
     //向客户端发送即时通知
     $message = Utils::makeHTMLElementTag('employee', $user->fafa_jid, $user->nick_name) . "退出了群组【" . Utils::makeHTMLElementTag('group', $fafa_groupid, $group_name) . "】";
     $this->sendPresenceGroup($fafa_groupid, "group_deletemeber", $message);
     $re = array('success' => '1');
     //变更版本信息
Exemplo n.º 3
0
 public function getOfficialTrendWinAction($conv_root_id)
 {
     $FILE_WEBSERVER_URL = $this->container->getParameter('FILE_WEBSERVER_URL');
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $ds = $conv->getOfficialTrend($da, $user, $conv_root_id, $FILE_WEBSERVER_URL);
     if (count($ds["we_convers_list"]["rows"]) == 0) {
         return new Response("");
     }
     $isGroup = $ds["we_convers_list"]["rows"][0]["post_to_group"];
     if ($isGroup != "ALL") {
         //获取群组logo
         $groupmgr = new \Justsy\BaseBundle\Management\GroupMgr($da, null);
         $groupdata = $groupmgr->Get($isGroup);
         if ($groupdata != null) {
             $ds["we_convers_list"]["rows"][0]["en_logo_path"] = $FILE_WEBSERVER_URL . (empty($groupdata["group_photo_path"]) ? "default_group.png" : $groupdata["group_photo_path"]);
         }
     } else {
         //判断是否是非企业圈子
         $circleid = $ds["we_convers_list"]["rows"][0]["post_to_circle"];
         if ($user->get_circle_id("") != $circleid) {
             $circlemgr = new \Justsy\BaseBundle\Management\CircleMgr($da, null);
             $data = $circlemgr->Get($circleid);
             if ($data != null) {
                 $ds["we_convers_list"]["rows"][0]["en_logo_path"] = $FILE_WEBSERVER_URL . (empty($data["logo_path"]) ? "default_cirle.png" : $data["logo_path"]);
             }
         }
     }
     if ($ds["we_convers_list"]["rows"][0]["auth_level"] != 'S') {
         $ds["we_convers_list"]["rows"][0]["vip_level"] = \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($ds["we_convers_list"]["rows"][0]["total_point"]);
     } else {
         $ds["we_convers_list"]["rows"][0]["vip_level"] = "1";
         //
     }
     $css_level = (int) ($ds["we_convers_list"]["rows"][0]["we_level"] / 10);
     $para = array('this' => $this, 'ds' => $ds, 'css_level' => $css_level, "trend" => $this->getRequest()->get("trend"));
     return $this->render('JustsyBaseBundle:CDisplayArea:officialtrend_win.html.twig', $para);
 }