public function getAllConvAction($class) { $user = $this->get('security.context')->getToken()->getUser(); $request = $this->getRequest(); $network_domain = $request->get('network_domain'); $endid = $request->get('endid'); $pre450num = $request->get('pre450num'); $pageindex = $request->get('pageindex'); $pagesize = 45; $sql = "select a.conv_root_id \nfrom we_convers_list a \nwhere a.conv_id=a.conv_root_id\n and a.post_to_circle=?\n and (a.post_to_group in ('ALL', case when a.login_account=? then 'PRIVATE' else '' end)\n or exists(select 1 from we_convers_notify wcn where wcn.conv_id=a.conv_id and wcn.cc_login_account=?))\n and not exists(select 1 from we_conv_top p where p.conv_id=a.conv_id and p.timeout>now())\n and exists(select 1 from dual where a.login_account=? union select 1 from we_staff_atten wsa,we_staff_atten wsb where wsa.login_account=? and wsa.atten_type='01' and wsa.atten_id=a.login_account and wsb.login_account=wsa.atten_id and wsb.atten_id=? and wsb.atten_type='01')"; if ($class == "conv") { //所有会话,无类别区分 $sql .= " and not exists(select 1 from we_conv_hide c where c.conv_id=a.conv_id and c.login_account=?)"; //广播信息 $Announcer = new \Justsy\BaseBundle\Management\Announcer($this->container); $loign_accounts = $Announcer->broadcaster_staff($user->eno, $user->dept_id, $user->fafa_jid); if (count($loign_accounts) > 0) { $sql .= " or a.login_account in ('" . implode("','", $loign_accounts) . "') "; } } else { if ($class == "official") { //官方的 $sql .= " and a.conv_type_id='06'"; } else { if ($class == "ask") { //所有提问 $sql .= " and a.conv_type_id='01'"; } else { if ($class == "together") { //所有活动 $sql .= " and a.conv_type_id='02'"; } else { if ($class == "vote") { //所有投票 $sql .= " and a.conv_type_id='03'"; } else { if ($class == "trend") { $sql .= " and a.conv_type_id='00'"; } } } } } } $params = array(); $params[] = (string) $user->get_circle_id($network_domain); $params[] = (string) $user->getUserName(); $params[] = (string) $user->getUserName(); $params[] = (string) $user->getUserName(); $params[] = (string) $user->getUserName(); $params[] = (string) $user->getUserName(); if ($class == 'conv') { $params[] = (string) $user->getUserName(); } if ($pre450num) { $sql = "select count(*) c from ({$sql} limit 0, 450) as _ttt_"; $da = $this->get('we_data_access'); $ds = $da->GetData("we_convers_list", $sql, $params); $re = array("pre450num" => $ds["we_convers_list"]["rows"][0]["c"]); $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } $sql .= " order by (0+a.conv_id) desc"; if ($pageindex) { } else { $pageindex = 1; } $pagestart = ($pageindex - 1) * $pagesize; $sql .= " limit {$pagestart}, 100 "; $sql = " select * from ({$sql}) as _ttt_ where 1=1 "; if ($endid) { $sql .= " and (0+conv_root_id)<? "; $params[] = (double) $endid; } $sql .= " limit 0, 15 "; $da = $this->get('we_data_access'); $ds = $da->GetData("we_convers_list", $sql, $params); //生成html返回 $conv_root_ids = array_map(function ($row) { return $row["conv_root_id"]; }, $ds["we_convers_list"]["rows"]); $isshow_relation_static_trend = false; if (count($conv_root_ids) < 14 && empty($endid)) { $isshow_relation_static_trend = true; } if ($pageindex == 1 && empty($endid) && count($conv_root_ids) > 0) { //更新用户最后读的信息ID $conv = new \Justsy\BaseBundle\Business\Conv(); $conv->updateLastReadID_Circle($da, $user, $user->get_circle_id($network_domain), $conv_root_ids[0]); } return $this->forward("JustsyBaseBundle:CDisplayArea:getConv", array("conv_root_ids" => $conv_root_ids, "isshow_relation_static_trend" => $isshow_relation_static_trend, "trend" => true)); }
public function delTrendAction() { $re = array(); $user = $this->get('security.context')->getToken()->getUser(); $request = $this->getRequest(); $conv_root_id = $request->get('conv_root_id'); $da = $this->get('we_data_access'); $conv = new \Justsy\BaseBundle\Business\Conv(); //不是自己的不能删除 if ($conv->checkIsOwenConv($da, $conv_root_id, $user->getUserName())) { $result = $conv->delConvByRootID($da, $conv_root_id); if ($result) { //出席接收人员 $staffmgr = new \Justsy\BaseBundle\Management\Staff($da, $this->get('we_data_access_im'), $user, $this->get("logger"), $this->container); $send_jid = $staffmgr->getFriendJidList($conv_root_id); if ($send_jid && count($send_jid) > 0) { Utils::sendImPresence($user->fafa_jid, implode(",", $send_jid), "del_dynamic", $conv_root_id, $this->container, "", "", false, Utils::$systemmessage_code); } $AnnouncerMgr = new \Justsy\BaseBundle\Management\Announcer($this->container); $AnnouncerMgr->delConvers($conv_root_id); $re = array('success' => '1'); } else { $re = array('success' => '0'); } } else { $re = array('success' => '0'); } $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }
public function delConvTrendAction() { $re = array("returncode" => ReturnCode::$SUCCESS); $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $da = $this->get('we_data_access'); $conv_id = $request->get("conv_id"); try { if (empty($conv_id)) { throw new \Exception("param is null"); } $conv = new \Justsy\BaseBundle\Business\Conv(); //不是自己的不能删除 if ($conv->checkIsOwenConv($da, $conv_id, $user->getUserName())) { $result = $conv->delConvByRootID($da, $conv_id); if ($result) { //出席接收人员 $staffMgr = new \Justsy\BaseBundle\Management\Staff($da, $this->get("we_data_access_im"), $user, $this->get("logger"), $this->container); $send_jid = $staffMgr->getFriendJidList($conv_id); if ($send_jid && count($send_jid) > 0) { Utils::sendImPresence($user->fafa_jid, implode(",", $send_jid), "del_dynamic", $conv_id, $this->container, "", "", false, Utils::$systemmessage_code); } //删除动态人员范围表(后台广播) $announcerMgr = new \Justsy\BaseBundle\Management\Announcer($this->container); $announcerMgr->delConvers($conv_id); $re["returncode"] = ReturnCode::$SUCCESS; } else { $re["returncode"] = ReturnCode::$NOTAUTHORIZED; } $re["returncode"] = ReturnCode::$SUCCESS; } else { $re["returncode"] = ReturnCode::$NOTAUTHORIZED; } } catch (\Exception $e) { $re["returncode"] = ReturnCode::$SYSERROR; $this->get('logger')->err($e); } $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }
public function getFriendLoginAccountList($broadcaster = "") { $jid = ""; $eno = ""; $deptid = ""; if ($this->userInfo != null) { $jid = $this->userInfo->fafa_jid; $eno = $this->userInfo->eno; $deptid = $this->userInfo->dept_id; } else { $userInfo = $this->getInfo(); $jid = $userInfo["fafa_jid"]; $eno = $userInfo["eno"]; $deptid = $userInfo["dept_id"]; } $paras = array(); $domain = $this->container->getParameter('edomain'); $sql = "select jid from rosterusers where username=? and subscription='B' and jid not in(?,?,?,?,?)"; $paras[] = (string) $jid; $paras[] = "admin-" . $eno . "@" . $domain; $paras[] = "sale-" . $eno . "@" . $domain; $paras[] = "front-" . $eno . "@" . $domain; $paras[] = "service-" . $eno . "@" . $domain; $paras[] = "guest-" . $eno . "@" . $domain; $ds = $this->conn_im->getData("t", $sql, $paras); $list = array(); if ($ds && count($ds["t"]["rows"]) > 0) { for ($i = 0; $i < count($ds["t"]["rows"]); $i++) { $list[] = $ds["t"]["rows"][$i]["jid"]; } } if (count($list) > 0) { $sql = "select login_account from we_staff where fafa_jid in('" . implode("','", $list) . "')"; $ds = $this->conn->getData("t", $sql, array()); $list = array(); if ($ds && count($ds["t"]["rows"]) > 0) { for ($i = 0; $i < count($ds["t"]["rows"]); $i++) { $list[] = $ds["t"]["rows"][$i]["login_account"]; } } } if (!empty($broadcaster) && $broadcaster == "1") { $Announcer = new \Justsy\BaseBundle\Management\Announcer($this->container); $jid = $Announcer->broadcaster_staff($eno, $deptid, $jid); if (count($list) > 0 && count($jid) > 0) { $list = array_merge($list, $jid); } else { if (count($list) == 0) { $list = $jid; } } } return $list; }