public function joinTogetherAction() { $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(); $ds = $conv->joinTogether($da, $user, $conv_id); $re["join_staff"] = $user->getUserName(); $re["nick_name"] = $user->nick_name; } 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 joinTogetherAction() { $re = array(); $user = $this->get('security.context')->getToken()->getUser(); $request = $this->getRequest(); $together_id = $request->get('together_id'); $da = $this->get('we_data_access'); $conv = new \Justsy\BaseBundle\Business\Conv(); $conv->joinTogether($da, $user, $together_id); $re = array('success' => '1', 'join_staff' => $user->getUserName(), 'nick_name' => $user->nick_name); $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }