Exemplo n.º 1
0
 public function replyConvAction()
 {
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $conv_root_id = $request->get("conv_id");
     $replayvalue = $request->get("replayvalue");
     $reply_to = $request->get("reply_to");
     $reply_to_name = $request->get("reply_to_name");
     $attachs = $request->get("attachs");
     try {
         if (empty($conv_root_id) || empty($replayvalue)) {
             throw new \Exception("param is null");
         }
         $attachs = array_map(function ($item) {
             return trim($item);
         }, empty($attachs) ? array() : explode(',', $attachs));
         $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
         $conv = new \Justsy\BaseBundle\Business\Conv();
         $conv->replyConv($da, $user, $conv_root_id, $conv_id, $replayvalue, $reply_to, $request->getSession()->get('comefrom'), $this->container, $attachs);
         $reply = array();
         $reply["reply_id"] = $conv_id;
         $reply["reply_staff"] = $user->getUserName();
         $reply_staff_obj = array();
         $reply_staff_obj["login_account"] = $user->getUserName();
         $reply_staff_obj["nick_name"] = $user->nick_name;
         $reply_staff_obj["photo_path"] = $user->photo_path;
         $reply_staff_obj["photo_path_small"] = $user->photo_path_small;
         $reply_staff_obj["photo_path_big"] = $user->photo_path_big;
         $reply["reply_staff_obj"] = $reply_staff_obj;
         $reply["reply_date"] = date('Y-m-d H:i:00');
         //处理返回内容
         $face = $this->get('templating.helper.assets')->geturl('bundles/fafatimewebase/images/face/');
         $reply["reply_content"] = $conv->replaceContent($replayvalue, $face);
         $reply["reply_to"] = $reply_to;
         $reply["reply_to_nickname"] = $reply_to_name;
         $reply["likes"] = array();
         $sql = "select a.conv_id, a.attach_id, b.file_name, b.file_ext, b.up_by_staff, b.up_date\n        from we_convers_attach a, we_files b\n        where a.attach_id=b.file_id\n        and a.attach_type='0' and a.conv_id = ?";
         $params = array();
         $params[] = $conv_id;
         $ds1 = $da->GetData("we_convers_attach_reply", $sql, $params);
         $reply["attachs"] = $this->genAttachs($ds1["we_convers_attach_reply"]["rows"]);
         $re["reply"] = $reply;
     } 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;
 }
Exemplo n.º 2
0
 public function replyConvPcAction()
 {
     $re = array();
     $FILE_WEBSERVER_URL = $this->container->getParameter('FILE_WEBSERVER_URL');
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $conv_root_id = $request->get('conv_root_id');
     $da = $this->get('we_data_access');
     $conv_content = $request->get('replayvalue');
     $reply_to = $request->get('reply_to');
     $reply_to_name = $request->get('reply_to_name');
     //    $notifystaff = $request->get('notifystaff');
     $attachs = $request->get('attachs');
     $attachs_name = $request->get('attachs_name');
     //    $post_to_group = $request->get('post_to_group');
     $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $conv->replyConv($da, $user, $conv_root_id, $conv_id, $conv_content, $reply_to, "00", $this->container, $attachs);
     $a = array();
     $a['this'] = $this;
     $row = array();
     $row["conv_id"] = $conv_id;
     $row["photo_url"] = "{$FILE_WEBSERVER_URL}{$user->photo_path}";
     $row["nick_name"] = $user->nick_name;
     $row["login_account"] = $user->getUserName();
     $row["reply_to"] = $reply_to;
     $row["reply_to_name"] = $reply_to_name;
     $row["conv_content"] = $conv_content;
     $row["post_date_d"] = "10秒前";
     $row["comefrom"] = "00";
     $row["comefrom_d"] = "Wefafa Web";
     $a['row'] = $row;
     $ds = array();
     $ds["we_convers_like"] = array();
     $ds["we_convers_like"]["rows"] = array();
     $ds["we_convers_attach_reply"] = array();
     $rowsattchs = array();
     for ($i = 0; $i < count($attachs); $i++) {
         $rowsattchs[] = array("conv_id" => $conv_id, "attach_id" => $attachs[$i], "file_name" => $attachs_name[$i], "file_ext" => "", "up_by_staff" => $user->getUserName(), "up_date" => "");
     }
     $ds["we_convers_attach_reply"]["rows"] = $rowsattchs;
     $a['ds'] = $ds;
     return $this->render('JustsyBaseBundle:CDisplayArea:reply_item_pc.html.twig', $a);
 }