Exemple #1
0
 public function copyConv($da, $user, $conv_id, $conv_content, $post_to_circle, $post_to_group, $copy_id, $copy_last_id, $comefrom = "00")
 {
     $sqls = array();
     $all_params = array();
     $sqlInsert = 'insert into we_convers_list (conv_id, login_account, post_date, conv_type_id, conv_root_id, conv_content, post_to_group, post_to_circle, copy_num, reply_num, copy_id, copy_last_id, comefrom) values (?, ?, CURRENT_TIMESTAMP(), ?, ?, ?, ?, ?, 0, 0, ?, ?, ?)';
     $params = array();
     $params[] = (string) $conv_id;
     $params[] = (string) $user->getUserName();
     $params[] = (string) '05';
     $params[] = (string) $conv_id;
     $params[] = (string) $conv_content;
     $params[] = (string) $post_to_group;
     $params[] = (string) $post_to_circle;
     $params[] = (string) $copy_id;
     $params[] = (string) $copy_last_id;
     $params[] = (string) $comefrom;
     $sqls[] = $sqlInsert;
     $all_params[] = $params;
     $sqlUpdate = "update we_convers_list set copy_num=ifnull(copy_num, 0) + 1 where conv_id=?";
     $params = array();
     $params[] = (string) $copy_id;
     $sqls[] = $sqlUpdate;
     $all_params[] = $params;
     if ($copy_last_id && $copy_last_id != $copy_id) {
         $sqlUpdate = "update we_convers_list set copy_num=ifnull(copy_num, 0) + 1 where conv_id=?";
         $params = array();
         $params[] = (string) $copy_last_id;
         $sqls[] = $sqlUpdate;
         $all_params[] = $params;
     }
     $da->ExecSQLs($sqls, $all_params);
     \Justsy\BaseBundle\Controller\CInputAreaController::genAtMe($da, $conv_content, $conv_id, $user);
 }
 public function newConvVoteAction()
 {
     $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");
     $is_multi = $request->get("is_multi");
     $finishdate = $request->get("finishdate");
     $optionvalues = $request->get("optionvalues");
     $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) || empty($optionvalues)) {
             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));
         $optionvalues = array_map(function ($item) {
             return trim($item);
         }, empty($optionvalues) ? array() : explode(',', $optionvalues));
         $is_multi = $is_multi == "1" ? "1" : "0";
         $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
         $conv = new \Justsy\BaseBundle\Business\Conv();
         $conv->newVote($da, $user, $conv_id, $conv_content, $is_multi, $finishdate, $optionvalues, $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, "vote");
         $re["conv"] = $this->getVote($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;
 }