Esempio n. 1
0
 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 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;
 }