public function newConvAskAction() { $re = array("returncode" => ReturnCode::$SUCCESS); $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $da = $this->get('we_data_access'); $conv_content = $request->get("conv_content"); $attachs = $request->get("attachs"); $circle_id = $request->get("circle_id"); $group_id = $request->get("group_id"); $notifystaffs = $request->get("notifystaffs"); try { if (empty($conv_content) || empty($circle_id) || empty($group_id)) { throw new \Exception("param is null"); } $attachs = array_map(function ($item) { return trim($item); }, empty($attachs) ? array() : explode(',', $attachs)); $notifystaffs = array_map(function ($item) { return trim($item); }, empty($notifystaffs) ? array() : explode(',', $notifystaffs)); $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id"); $conv = new \Justsy\BaseBundle\Business\Conv(); $conv->newAsk($da, $user, $conv_id, $conv_content, $circle_id, $group_id, $notifystaffs, $attachs, $request->getSession()->get('comefrom'), $this->container); $cInput = new CInputAreaController(); $cInput->setContainer($this->container); $cInput->sendPresence($conv_id, $da, $circle_id, $group_id, "ask"); $re["conv"] = $this->getAsk($da, $user, $conv_id, ""); } 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 publishAskAction() { $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $da = $this->get('we_data_access'); $network_domain = $request->get('network_domain'); $conv_content = $request->get('question'); $notifystaff = $request->get('notifystaff'); $attachs = $request->get('attachs'); $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->newAsk($da, $user, $conv_id, $conv_content, $user->get_circle_id($network_domain), $post_to_group, $notifystaff, $attachs, "00", $this->container); $this->sendPresence($conv_id, $da, $user->get_circle_id($network_domain), $post_to_group, "ask"); $re = array('success' => '1', 'conv_id' => $conv_id); $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }