コード例 #1
0
 public function delConvReplyAction()
 {
     $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())) {
             $conv->delReplyByID($da, $conv_id);
             $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;
 }
コード例 #2
0
 public function delReplyAction()
 {
     $re = array();
     $user = $this->get('security.context')->getToken()->getUser();
     $request = $this->getRequest();
     $conv_id = $request->get('conv_id');
     $da = $this->get('we_data_access');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     //不是自己的不能删除
     if ($conv->checkIsOwenConv($da, $conv_id, $user->getUserName())) {
         $conv->delReplyByID($da, $conv_id);
         $re = array('success' => '1');
     } else {
         $re = array('success' => '0');
     }
     $response = new Response(json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }