コード例 #1
0
 public function indexAction($name)
 {
     $user = $this->get('security.context')->getToken()->getUser();
     $this->photo_url = $this->container->getParameter('FILE_WEBSERVER_URL') . $user->photo_path_big;
     $this->InfoCompletePercent = $this->GetInfoCompletePercent($user->getUsername());
     //发升级通知
     if ($user->level > 1 && $user->level > $user->we_level) {
         $user->we_level = $user->level;
         $sqls = array();
         $all_params = array();
         $sql = "update we_staff set we_level = ? where login_account=?";
         $params = array();
         $params[] = (string) $user->level;
         $params[] = (string) $user->getUserName();
         $sqls[] = $sql;
         $all_params[] = $params;
         $da = $this->get('we_data_access');
         $ds = $da->ExecSQLs($sqls, $all_params);
         $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
         $conv_content = "【喜讯】@{$user->nick_name} 的Wefafa等级已升至 {$user->level} 级![强] ";
         $circle_id = $user->get_circle_id($user->edomain);
         $group_id = "ALL";
         $conv = new \Justsy\BaseBundle\Business\Conv();
         $conv->newSysTrend($da, $conv_id, $conv_content, $circle_id, $group_id, array(), array());
     }
     return $this->render('JustsyBaseBundle:CPerBaseInfo:index.html.twig', array('this' => $this));
 }
コード例 #2
0
ファイル: ShareController.php プロジェクト: 3116246/haolinju
 public function wefafaShareAction(Request $request)
 {
     $result = true;
     $da = $this->container->get('we_data_access');
     $conv_id = SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
     $account = $request->get("account");
     $content = $request->get("content");
     $reason = $request->get("reason");
     //分享理由
     $group_id = $request->get("group_id");
     $circle_id = $request->get("circle_id");
     $ref_url = $request->get("ref_url");
     $tmp = parse_url($ref_url);
     $host = $tmp["host"];
     $attachs = null;
     //		if(!empty($host) && !Utils::is_ip($host))
     //		{
     //			  $host = strpos($host,".")===false? $host : substr($host, strpos($host,".")+1);
     //		}
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $conv->newShareTrend($da, $account, $conv_id, $reason, $content, $circle_id, $group_id, $ref_url, $attachs, $host, $this->container);
     //	  $sql = "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,comefrom)values(?,?,now(),?,?,?,?,?,?)";
     //	  $parameter = array($conv_id,$account,"98",$conv_id,$content,$group_id,$circle_id,$ref_url);
     //	  try{
     //	    $da->ExecSQL($sql,$parameter);
     //	  }
     //	  catch (\Exception $e){
     //	    $result = false;
     //	  }
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($result) . ");" : json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #3
0
ファイル: ReplyController.php プロジェクト: 3116246/haolinju
 public function replaceFaceEmote($str)
 {
     $pre = $this->get('templating.helper.assets')->geturl('bundles/fafatimewebase/images/face/');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $str1 = $conv->replaceContent($str, $pre);
     return $str1;
 }
コード例 #4
0
 public function indexpcAction($network_domain)
 {
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $this->collect_type = $request->get('collect_type');
     $this->conv_type = $request->get('conv_type');
     $this->pageindex = $request->get('pageindex');
     if ($this->pageindex) {
     } else {
         $this->pageindex = 1;
     }
     $this->q = $request->get('q');
     $this->label_name = $request->get('label_name');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $x = $conv->getLabel($da, $user);
     $this->labels = $x["we_convers_label"];
     $this->conv_root_ids = $this->getCollectConv($network_domain, $this->conv_type, $this->label_name);
     return $this->render('JustsyBaseBundle:Collect:index_pc.html.twig', array('curr_network_domain' => $network_domain, 'this' => $this));
 }
コード例 #5
0
 public function sendsharemsgAction()
 {
     $da = $this->get("we_data_access");
     $da_im = $this->get("we_data_access_im");
     $re = array("returncode" => ReturnCode::$SUCCESS, 'msg' => '');
     $res = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     try {
         //获取接收者
         $openids = $res->get("openids");
         $groupid = $res->get("groupid");
         $circleid = $res->get("circleid");
         //分享到指定的圈子中,需要单独 处理。不走实时消息通道
         if (empty($openids) && empty($groupid) && empty($circleid)) {
             $toType = $res->get("totype");
             //分享目标类型,当openids\groupid\circleid存在时无效
             //分享到其他网站或者平台上,暂时支持微信朋友圈\QQ空间
             $re = "";
             $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
             $response->headers->set('Content-Type', 'text/json');
             return $response;
         }
         //获取推送的分享图片地址
         $imgurl = $res->get("imgurl");
         //获取推送的分享内容
         $content = $res->get("content");
         $shareitem = array();
         $shareitem["content"] = $content;
         if (!empty($imgurl)) {
             $shareitem["image"] = array("value" => $imgurl, "type" => "URL");
         }
         $shareitem["iosclass"] = $res->get("iosclass");
         $shareitem["androidclass"] = $res->get("androidclass");
         $shareitem["bizdata"] = $res->get("bizdata");
         if (!empty($circleid)) {
             $ref_url = json_encode(array("iosclass" => $shareitem["iosclass"], "androidclass" => $shareitem["androidclass"], "bizdata" => $shareitem["bizdata"]));
             //分享到圈子
             $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
             $conv = new \Justsy\BaseBundle\Business\Conv();
             $conv->newShareTrend($da, $user->getUserName(), $conv_id, $content, $imgurl, $circleid, "ALL", $ref_url, array(), "00", null);
             $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
             $response->headers->set('Content-Type', 'text/json');
             return $response;
         }
         $msgBody = array();
         $msgBody["snssharemsg"] = array("shareitem" => $shareitem);
         $tolist = array();
         if (!empty($groupid)) {
             $groupmgr = new \Justsy\BaseBundle\Management\GroupMgr($da, $da_im);
             //$groupdata = $groupmgr->GetByIM($groupid);
             $tolist = $groupmgr->getGroupMembersJidByIM($groupid);
             $msgBody["snssharemsg"]["shareitem"]["groupid"] = $groupid;
         }
         if (!empty($openids)) {
             $tolist = array_merge($tolist, explode(",", $openids));
         }
         $cnt = count($tolist);
         if ($cnt > 0) {
             $api = new \Justsy\OpenAPIBundle\Controller\ApiController();
             $api->setContainer($this->container);
             $re = $api->sendMsg2($user->fafa_jid, implode(",", $tolist), json_encode($msgBody), "sharemsg", true);
         }
     } catch (\Exception $e) {
         $re["returncode"] = ReturnCode::$SYSERROR;
         $re["msg"] = "系统错误";
         $this->get('logger')->err($e);
     }
     $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #6
0
ファイル: GroupController.php プロジェクト: 3116246/haolinju
     } else {
         $pageindex = 1;
     }
     $pagestart = ($pageindex - 1) * $pagesize;
     $sql .= " limit {$pagestart}, 100 ";
     $sql = " select * from ({$sql}) as _ttt_ where 1=1 ";
     if ($endid) {
         $sql .= " and (0+conv_root_id)<? ";
         $para[] = (double) $endid;
     }
     $sql .= " limit 0, 15 ";
     $da = $this->get('we_data_access');
     $ds = $da->GetData("we_convers_list", $sql, $para);
     //生成html返回
     $conv_root_ids = array_map(function ($row) {
         return $row["conv_root_id"];
     }, $ds["we_convers_list"]["rows"]);
     if ($type == 'all' && empty($endid) && count($conv_root_ids) > 0) {
         //更新用户最后读的信息ID
         $conv = new \Justsy\BaseBundle\Business\Conv();
         $conv->updateLastReadID_Group($da, $user, $groupid, $conv_root_ids[0]);
     }
     return $this->forward("JustsyBaseBundle:CDisplayArea:getConv", array("conv_root_ids" => $conv_root_ids, 'trend' => true));
 }
 public function getGroupConversPcAction($type, $groupid)
 {
     $request = $this->get("request");
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $circleId = $user->get_circle_id($request->get("network_domain"));
     $endid = $request->get('endid');
     $pre450num = $request->get('pre450num');
     $pageindex = $request->get('pageindex');
     $pagesize = 45;
     $sql = '';
     $para = array();
     if ($type == 'all') {
         $sql = "select conv_root_id from we_convers_list a where a.conv_id=a.conv_root_id and a.post_to_group=?";
         $para[] = (string) $groupid;
     } else {
         if ($type == 'atten') {
             $sql = "select a.conv_root_id \r        from we_convers_list a, we_staff_atten b\r        where a.conv_id=a.conv_root_id\r          and a.login_account=b.atten_id \r          and b.atten_type='01'\r          and a.post_to_group=?\r          and a.post_to_circle=?\r          and b.login_account=?";
             $para[] = (string) $groupid;
             $para[] = (string) $circleId;
             $para[] = (string) $user->getUsername();
         } else {
             if ($type == 'publish') {
                 $sql = "select a.conv_root_id \r        from we_convers_list a\r        where a.conv_id=a.conv_root_id\r          and a.post_to_group=?\r          and a.post_to_circle=?\r          and a.login_account=?";
                 $para[] = (string) $groupid;
                 $para[] = (string) $circleId;
                 $para[] = (string) $user->getUsername();
             }
         }
     }
     if ($pre450num) {
         $sql = "select count(*) c from ({$sql} limit 0, 450) as _ttt_";
         $ds = $da->GetData("we_convers_list", $sql, $para);
         $re = array("pre450num" => $ds["we_convers_list"]["rows"][0]["c"]);
         $response = new Response(json_encode($re));
         $response->headers->set('Content-Type', 'text/json');
         return $response;
     }
     $sql .= " order by post_date desc";
     if ($pageindex) {
コード例 #7
0
 public function getAllConvUnreadPcAction()
 {
     $user = $this->get('security.context')->getToken()->getUser();
     $request = $this->getRequest();
     $network_domain = $request->get('network_domain');
     $maxid = $request->get('maxid');
     $onlycount = $request->get('onlycount');
     $class = $request->get('class');
     $sql = "select a.conv_root_id \nfrom we_convers_list a\nwhere a.conv_id=a.conv_root_id\n  and a.post_to_circle=?\n  and (a.post_to_group in ('ALL', case when a.login_account=? then 'PRIVATE' else '' end)\n    or exists(select 1 from we_convers_notify wcn where wcn.conv_id=a.conv_id and wcn.cc_login_account=?))\n  and exists(select 1 from dual where a.login_account=? union select 1 from we_staff_atten wsa where wsa.login_account=? and wsa.atten_type='01' and wsa.atten_id=a.login_account)\n  and (0+a.conv_root_id)>? and 0<>?";
     if ($class == "conv") {
         //所有会话,无类别区分
         $sql .= " and not exists(select 1 from we_conv_hide b where b.conv_id=a.conv_id and b.login_account=?)";
     } else {
         if ($class == "official") {
             //官方的
             $sql .= " and a.conv_type_id='06'";
         } else {
             if ($class == "ask") {
                 //提问
                 $sql .= " and a.conv_type_id='01'";
             } else {
                 if ($class == "together") {
                     //活动
                     $sql .= " and a.conv_type_id='02'";
                 } else {
                     if ($class == "vote") {
                         //投票
                         $sql .= " and a.conv_type_id='03'";
                     } else {
                         if ($class == "trend") {
                             //动态
                             $sql .= " and a.conv_type_id='00'";
                         }
                     }
                 }
             }
         }
     }
     $params = array();
     $params[] = (string) $user->get_circle_id($network_domain);
     $params[] = (string) $user->getUserName();
     $params[] = (string) $user->getUserName();
     $params[] = (string) $user->getUserName();
     $params[] = (string) $user->getUserName();
     $params[] = (double) $maxid;
     $params[] = (double) $maxid;
     if ($class == 'conv') {
         $params[] = (string) $user->getUserName();
     }
     if ($onlycount) {
         $sql .= " and a.login_account<>? ";
         $params[] = (string) $user->getUserName();
         $sql = "select count(*) c from ({$sql}) as _ttt_";
         $da = $this->get('we_data_access');
         $ds = $da->GetData("we_convers_list", $sql, $params);
         $re = array("unreadcount" => $ds["we_convers_list"]["rows"][0]["c"]);
         $response = new Response(json_encode($re));
         $response->headers->set('Content-Type', 'text/json');
         return $response;
     }
     $sql .= " order by (0+a.conv_id) desc";
     $da = $this->get('we_data_access');
     $ds = $da->GetData("we_convers_list", $sql, $params);
     //生成html返回
     $conv_root_ids = array_map(function ($row) {
         return $row["conv_root_id"];
     }, $ds["we_convers_list"]["rows"]);
     if (count($conv_root_ids) > 0) {
         //更新用户最后读的信息ID
         $conv = new \Justsy\BaseBundle\Business\Conv();
         $conv->updateLastReadID_Circle($da, $user, $user->get_circle_id($network_domain), $conv_root_ids[0]);
     }
     return $this->forward("JustsyBaseBundle:CDisplayArea:getConvPc", array("conv_root_ids" => $conv_root_ids, "trend" => true));
 }
コード例 #8
0
 public function publishVoteAction()
 {
     $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('title');
     $is_multi = $request->get('is_multi');
     $optionvalues = $request->get('optionvalues');
     $notifystaff = $request->get('notifystaff');
     $attachs = $request->get('attachs');
     $post_to_group = $request->get('post_to_group');
     $finishdate = $request->get('finishdate');
     $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, $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, "vote");
     $re = array('success' => '1', 'conv_id' => $conv_id);
     $response = new Response(json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #9
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;
 }
コード例 #10
0
 public function convHideAction()
 {
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $oper = $request->get("oper");
     $conv_id = $request->get("conv_id");
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $da = $this->get('we_data_access');
     $s = '1';
     $m = '';
     if ($oper == 'true') {
         if (!$conv->convHide($da, $conv_id, $user->getUserName())) {
             $s = '0';
             $m = '操作失败';
         }
     } else {
         if ($oper == 'false') {
             if (!$conv->convCancelHide($da, $conv_id, $user->getUserName())) {
                 $s = '0';
                 $m = '操作失败';
             }
         }
     }
     $response = new Response(json_encode(array('s' => $s, 'm' => $m)));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #11
0
ファイル: Announcer.php プロジェクト: 3116246/haolinju
 public function publishFriendCircle($parameter)
 {
     $da = $this->conn;
     $da_im = $this->conn_im;
     $user = $parameter["user"];
     $conv_content = isset($parameter["content"]) ? $parameter["content"] : null;
     $fileid = isset($parameter["fileid"]) ? $parameter["fileid"] : array();
     $conv_type_id = "00";
     $post_to_group = "ALL";
     $post_to_circle = "9999";
     $conv_id = SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id");
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $success = $conv->Broadcast($da, $da_im, $user, $conv_id, $conv_type_id, $conv_content, $post_to_group, $post_to_circle, $fileid, "00", $this->container);
     //发布成功才发送出席
     if ($success) {
         $inputArea = new \Justsy\BaseBundle\Controller\CInputAreaController();
         $inputArea->setContainer($this->container);
         $inputArea->sendPresence($conv_id, $da, "9999", "ALL", "trend");
     }
     return array('success' => $success, 'conv_id' => $conv_id);
 }
コード例 #12
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;
 }