예제 #1
0
 public function getMLiveProductList100Action()
 {
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $barcode = $request->get("barcode");
     try {
         $barcode = empty($barcode) ? "%" : $barcode;
         $sql = "select a.id, a.code, a.product_name, a.designuserid, a.designfeeling, a.salessuggest, a.type, a.category, a.remark, \n  a.create_user, a.create_date, a.last_modified_user, a.last_modified_date, a.conv_id, \n  case when b.conv_id is null then '0' else '1' end hasconv\nfrom mlive_product a\nleft join we_convers_list b on a.conv_id=b.conv_id\nwhere a.code like ?\nlimit 0, 100";
         $params = array();
         $params[] = (string) $barcode;
         $ds = $da->GetData("mlive_product", $sql, $params);
         $conv = new \Justsy\BaseBundle\Business\Conv();
         foreach ($ds["mlive_product"]["rows"] as &$row) {
             if ($row["hasconv"] == "0") {
                 $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
                 $conv->newTrend($da, $user, $conv_id, "来自" . $row["designuserid"] . "的新设计:" . $row["product_name"] . "\n设计理念:" . $row["designfeeling"], $user->get_circle_id(""), "ALL", array(), array(), $request->getSession()->get('comefrom'), $this->container);
                 $row["conv_id"] = $conv_id;
                 $da->ExecSQL("update mlive_product set conv_id=? where id=?", array((string) $conv_id, (string) $row["id"]));
             }
         }
         $re["mlive_product_list"] = $ds["mlive_product"]["rows"];
     } 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 publishTrendAction()
 {
     $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('trend');
     $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->newTrend($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, "trend");
     $re = array('success' => '1', 'conv_id' => $conv_id);
     $response = new Response(json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #3
0
 public function newPrivateTrendAction()
 {
     $re = array("returncode" => "0000");
     $request = $this->getRequest();
     $check = $this->accessCheck();
     if ($check['returncode'] != ReturnCode::$SUCCESS) {
         return $this->responseJson($request, $check);
     }
     $user = $check['data']->getSessionUser();
     $da = $this->get('we_data_access');
     $conv_content = $request->get("conv_content");
     $attachs = $request->get("attachs");
     $circle_id = $this->getECircle($da, $user->eno);
     $notifystaffs = $request->get("notifystaffs");
     try {
         if (empty($conv_content)) {
             throw new \Exception("param is null");
         }
         $attachs = array_map(function ($item) {
             return trim($item);
         }, empty($attachs) ? array() : explode(',', $attachs));
         $notifystaffs = array_map(function ($item) {
             //判断是指定的Openidg还是帐号,是OPENID则要转换为帐号
             if (strpos("@", $item) === false) {
                 $sql = "select login_account from we_staff where openid=?";
                 $ds = $da->GetData("item", $sql, array((string) $item));
                 if ($ds && count($ds["item"]["rows"]) > 0) {
                     return $ds["item"]["rows"][0]["login_account"];
                 } else {
                     return "";
                 }
             }
             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->newTrend($da, $user, $conv_id, $conv_content, $circle_id, "PRIVATE", $notifystaffs, $attachs, $request->getSession()->get('comefrom'), $this->container);
         $re["conv"] = $conv_id;
     } catch (\Exception $e) {
         $re["returncode"] = "9999";
         $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;
 }