public function getVersionChange($type, $number) { $da = $this->get("we_data_access"); $eno = $this->get('security.context')->getToken()->getUser()->eno; $verchange = new \Justsy\BaseBundle\Management\VersionChange($da, $this->get("logger")); $result = $verchange->GetVersionChange($type, $number, $eno); return $result; }
$list = array(); $list["curr_network_domain"] = $user->edomain; $list["account"] = $user->getUsername(); $list["trend"] = true; $da = $this->get("we_data_access"); $table = $da->GetData("group", "select group_id,group_name from we_groups where fafa_groupid=?", array((string) $paras[1])); if ($table && $table["group"]["recordcount"] > 0) { $list["groupId"] = $table["group"]["rows"][0]["group_id"]; $list["groupName"] = $table["group"]["rows"][0]["group_name"]; } else { $list["groupId"] = $paras[1]; $list["groupName"] = $paras[1]; } $list['view'] = true; $list['publish'] = true; $list['group_c'] = $user->IsFunctionCreateGroup($user->edomain); $list['group_s'] = $user->IsExistsFunction("GROUP_S"); return $this->render('JustsyBaseBundle:Group:pcsync.html.twig', $list); } catch (\Exception $e) { $this->get("logger")->err($e); return $this->render('JustsyBaseBundle:Group:pcsync_error.html.twig'); //$this->redirect($this->generateUrl('JustsyBaseBundle_login')); } } public function quitGroupAction($group_id) { $re = array(); $user = $this->get('security.context')->getToken()->getUser(); $request = $this->getRequest(); $da = $this->get('we_data_access'); $sql = "select fafa_groupid,group_name from we_groups where group_id=?"; $ds = $da->GetData('we_groups', $sql, array((string) $group_id)); $fafa_groupid = $ds['we_groups']['rows'][0]['fafa_groupid']; $group_name = $ds['we_groups']['rows'][0]['group_name'];
public function exitgroupAction() { $re = array("returncode" => ReturnCode::$SUCCESS); $user = $this->get('security.context')->getToken()->getUser(); $request = $this->getRequest(); $group_id = $request->get("group_id"); $circle_id = $request->get("circle_id"); $da = $this->get('we_data_access'); try { if (empty($group_id)) { $re["returncode"] = ReturnCode::$SYSERROR; $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } $this->get("logger")->err("---------quit group --------------" . $group_id); $this->get("logger")->err("---------quit group --------------" . $user->getUserName()); $sql = "select fafa_groupid,group_name from we_groups where group_id=? or fafa_groupid=? "; $ds = $da->GetData('we_groups', $sql, array((string) $group_id, (string) $group_id)); $fafa_groupid = $ds['we_groups']['rows'][0]['fafa_groupid']; $group_name = $ds['we_groups']['rows'][0]['group_name']; $sql = "call p_quitgroup(?, ?, 0)"; $params = array(); $params[] = (string) $group_id; $params[] = (string) $user->getUserName(); $ds = $da->GetData("p_quitgroup", $sql, $params); //变更版本信息 $this->get("logger")->err("---------quit group --------------"); $eno = $user->eno; $verchange = new \Justsy\BaseBundle\Management\VersionChange($da, $this->get("logger")); $result = $verchange->SetVersionChange(2, $group_id, $eno); if ($ds["p_quitgroup"]["rows"][0]["recode"] == "0") { $send = new \Justsy\BaseBundle\Controller\GroupController(); $send->setContainer($this->container); //向客户端发送即时通知 $message = Utils::makeHTMLElementTag('employee', $user->fafa_jid, $user->nick_name) . "退出了群组【" . Utils::makeHTMLElementTag('group', $fafa_groupid, $group_name) . "】"; $send->sendPresenceGroup($fafa_groupid, "group_deletemeber", $message); } else { $re["returncode"] = ReturnCode::$SYSERROR; $this->get('logger')->err("quitGroup Error group_id:" . $group_id . " msg:" . $ds["p_quitgroup"]["rows"][0]["remsg"]); } } 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 agreeJoinAction($para) { //_urlSource $res = $this->get('request'); $urlSource = $res->get("_urlSource"); //获取操作源。FaFaWin:从PC客户端操作的 $paraArr = explode(",", trim(DES::decrypt($para))); $da = $this->get("we_data_access"); //检查帐号是否存在 $sql = "select a.eno,a.fafa_jid,a.nick_name,b.eshortname,a.login_account from we_staff a,we_enterprise b where a.eno=b.eno and login_account=?"; $ds = $da->GetData('we_staff', $sql, array((string) $paraArr[1])); if (!$ds || $ds['we_staff']['recordcount'] == 0) { if (empty($urlSource)) { return $this->render('JustsyBaseBundle:Circle:join_err.html.twig', array('error' => '申请人帐号不存在!')); } else { $response = new Response("{\"succeed\":0,\"msg\":\"申请人帐号不存在!\"}"); $response->headers->set('Content-Type', 'text/json'); return $response; } } $row = $ds['we_staff']['rows'][0]; $eno = $row['eno']; $appy_user_jid = $row['fafa_jid']; $nick_name = $row['nick_name']; $eshortname = $row['eshortname']; $appy_login_account = $row['login_account']; $sql = "select count(1) as cnt from we_circle_staff where circle_id=? and login_account=?"; $ds = $da->GetData('we_circle_staff', $sql, array((string) $paraArr[0], (string) $paraArr[1])); if ($ds && $ds['we_circle_staff']['rows'][0]['cnt'] > 0) { if (empty($urlSource)) { return $this->render('JustsyBaseBundle:Circle:join_err.html.twig', array('error' => '申请人已加入该圈子!')); } else { $response = new Response("{\"succeed\":0,\"msg\":\"申请人已加入该圈子!\"}"); $response->headers->set('Content-Type', 'text/json'); return $response; } } else { $sqls = array(); $paras = array(); //判断圈子是否有人 $sql = "select min(a.circle_name) circle_name,min(a.fafa_groupid) fafa_groupid, count(1) as cnt from we_circle a, we_circle_staff b where a.circle_id=b.circle_id and b.circle_id=?"; $ds = $da->GetData('we_circle_staff', $sql, array((string) $paraArr[0])); $circle_name = $ds['we_circle_staff']['rows'][0]['circle_name']; $fafa_groupid = $ds['we_circle_staff']['rows'][0]['fafa_groupid']; if ($ds && $ds['we_circle_staff']['rows'][0]['cnt'] == 0) { $sqls[] = "update we_circle set create_staff=? where circle_id=?"; $paras[] = array((string) $paraArr[1], (string) $paraArr[0]); } //圈子id+nick_name不能重复 $sql = "select count(1) cnt from we_circle_staff where circle_id=? and nick_name=?"; $ds = $da->GetData("cnt", $sql, array((string) $paraArr[0], (string) $nick_name)); if ($ds && $ds['cnt']['rows'][0]['cnt'] > 0) { $nick_name = $nick_name . "(" . $eshortname . ")"; } $sqls[] = "insert into we_circle_staff (circle_id,login_account,nick_name) values (?,?,?)"; $paras[] = array((string) $paraArr[0], (string) $paraArr[1], (string) $nick_name); //10-加入外部圈子-5 $sqls[] = "insert into we_staff_points (login_account,point_type,point_desc,point,point_date)\n values (?,?,?,?,now())"; $paras[] = array((string) $paraArr[1], (string) '10', (string) '成功加入外部圈子' . $circle_name . ',获得积分5', (int) 5); $da->ExecSQLs($sqls, $paras); $apply = new \Justsy\BaseBundle\Management\ApplyMgr($da, null); $apply->SetCircleApplyInvalid($paraArr[1], $paraArr[0]); //变更版本信息 //$curuser = $this->get('security.context')->getToken()->getUser(); //$eno = $curuser->eno; $verchange = new \Justsy\BaseBundle\Management\VersionChange($da, $this->get("logger")); $result = $verchange->SetVersionChange(3, $paraArr[0], $eno); //发送即时消息通知申请人及成员 $message = Utils::makeHTMLElementTag('employee', $appy_user_jid, $nick_name) . "加入了圈子【" . Utils::makeHTMLElementTag('circle', $fafa_groupid, $circle_name) . "】"; $excludeLst = array(); $excludeLst[] = $appy_login_account; //排除自己 $this->sendPresenceCirlce($paraArr[0], "circle_addmember", $message, "", $excludeLst); $message = "你已成功加入圈子【" . $circle_name . "】。"; $im_sender = $this->container->getParameter('im_sender'); Utils::sendImMessage($im_sender, $appy_user_jid, "圈子消息", $message, $this->container, "", "", false, Utils::$systemmessage_code); $backurl = $this->generateUrl("JustsyBaseBundle_enterprise", array('network_domain' => $paraArr[0]), true); if (empty($urlSource)) { return $this->render('JustsyBaseBundle:Error:success.html.twig', array('backurl' => $backurl)); } else { $response = new Response("{\"succeed\":1,\"name\":\"" . $circle_name . "\",\"circleurl\":\"" . $backurl . "\"}"); $response->headers->set('Content-Type', 'text/json'); return $response; } } }
public function attentionAction($attenaccount) { $this->get("logger")->err("---------------------------2222222222222222------------------"); $curuser = $this->get('security.context')->getToken()->getUser(); $isme = $curuser->getUsername(); $da = $this->get('we_data_access'); $staffMgr = new \Justsy\BaseBundle\Management\Staff($da, $this->get('we_data_access_im'), $curuser->getUserName(), $this->get("logger")); $staffMgr->attentionTo($attenaccount); //变更版本信息 $eno = $curuser->eno; $this->get("logger")->err("----------------------------eno:" . $eno . "----------------------"); $verchange = new \Justsy\BaseBundle\Management\VersionChange($da, $this->get("logger")); $result = $verchange->SetVersionChange(1, $attenaccount, $eno); $result = $verchange->SetVersionChange(1, $isme, $eno); $this->get("logger")->err("-----------------444444-------------------"); //发送关注消息 $msgId = SysSeq::GetSeqNextValue($da, "we_message", "msg_id"); $sql = "insert into we_message(msg_id,sender,recver,send_date,title,content)values(?,?,?,now(),?,?)"; $da->ExecSQL($sql, array((int) $msgId, (string) $isme, (string) $attenaccount, "好友请求", "你的好友<a style='cursor:pointer;color:#1A65A5' class='employee_name' login_account='{$isme}'>" . $curuser->nick_name . "</a>关注了你")); //查询是否互关注 $sql = "select f_checkAttentionWithAccount(?,?) cnt"; $ds = $da->GetData("both", $sql, array((string) $isme, (string) $attenaccount)); $IsBoth = $ds["both"]["rows"][0]["cnt"]; $im_sender = $this->container->getParameter('im_sender'); $fafa_jid = Utils::getJidByAccount($da, $attenaccount); if ($IsBoth != 2) { //发送即时消息 $message = "您的好友 " . Utils::makeHTMLElementTag("employee", $curuser->fafa_jid, $curuser->nick_name) . " 关注了您"; $link = $this->generateUrl("JustsyBaseBundle_component_emp_attention", array("attenaccount" => $isme), true); $linkButtons = Utils::makeBusButton(array(array("code" => "action", "text" => "关注TA", "value" => "atten"))); Utils::sendImMessage($im_sender, $fafa_jid, "好友请求", $message, $this->container, $link, $linkButtons, false, Utils::$systemmessage_code); $response = new Response("{\"succeed\":1,\"both\":{$IsBoth}}"); //提醒交换名片 $msg_id = SysSeq::GetSeqNextValue($da, "we_message", "msg_id"); $sql = "insert into we_message (msg_id,sender,recver,send_date,title,content,msg_type) values(?,?,?,now(),?,?,'02')"; $params = array($msg_id, $isme, $attenaccount, '好友请求', "<a login_account='" . $isme . "' class='account_baseinfo'>" . $curuser->nick_name . "</a>希望与您成为好友"); $da->ExecSQL($sql, $params); } else { //互相添加好友 $staffMgr->bothAddFriend($this->container, $attenaccount); //加入对方的人脉圈子 $msg_id = SysSeq::GetSeqNextValue($da, "we_message", "msg_id"); $sql = "insert into we_message (msg_id,sender,recver,send_date,title,content,msg_type) values(?,?,?,now(),?,?,'02')"; $params = array($msg_id, $isme, $attenaccount, '好友消息', "<a login_account='" . $isme . "' class='account_baseinfo'>" . $curuser->nick_name . "</a>与您成为了好友,并进入了您的人脉圈"); $da->ExecSQL($sql, $params); $response = new Response("{\"succeed\":1,\"both\":{$IsBoth},\"msg\":\"\"}"); } $response->headers->set('Content-Type', 'text/json'); return $response; }