예제 #1
0
 public function pcSyncAction()
 {
     $res = $this->get("request");
     $auth = $res->get("authcode");
     $interviewee = $res->get("interviewee");
     //$paras =  explode(",", trim(DES::decrypt($interviewee)));
     if ($auth == null || $auth == "") {
         $this->get("logger")->err("=====pcSyncAction Error:authcode为空!");
         return $this->render('JustsyBaseBundle:Account:pcsync_error.html.twig');
         //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
     }
     try {
         $auth = trim(DES::decrypt($auth));
         //解密参数串
         $paras = explode(",", trim(DES::decrypt($interviewee)));
         //授权码已过期
         $lng = time() - (int) $auth;
         if ($lng > 30 || $lng < 0) {
             $this->get("logger")->err("=====pcSyncAction Error:授权码已过期!");
             return $this->render('JustsyBaseBundle:Account:pcsync_error.html.twig');
             //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
         }
     } catch (\Exception $e) {
         $this->get("logger")->err($e);
         return $this->render('JustsyBaseBundle:Account:pcsync_error.html.twig');
         //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
     }
     try {
         if (count($paras) != 2 && count($paras) != 1) {
             $this->get("logger")->err("=====pcSyncAction Error:参数{$paras不正确!}");
             return $this->render('JustsyBaseBundle:Account:pcsync_error.html.twig');
             //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
         }
         $ec = new \Justsy\BaseBundle\Controller\PersonalHomeController();
         $ec->setContainer($this->container);
         //通过openID获取用户信息
         $user = $ec->loadUserByUsername($paras[0]);
         if ($user == null) {
             $this->get("logger")->err("=====pcSyncAction Error:{$paras用户信息未找到!}");
             return $this->render('JustsyBaseBundle:Account:pcsync_error.html.twig');
             //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
         }
         $network_domain = $user->edomain;
         //登记seesion
         $token = new UsernamePasswordToken($user, $user->getPassword(), "secured_area", $user->getRoles());
         $this->get("security.context")->setToken($token);
         $session = $res->getSession()->set('_security_' . 'secured_area', serialize($token));
         $event = new InteractiveLoginEvent($this->get("request"), $token);
         $this->get("event_dispatcher")->dispatch("security.interactive_login", $event);
         $account = "";
         if (count($paras) == 1) {
             $photo_url = $this->container->getParameter('FILE_WEBSERVER_URL') . $user->photo_path_big;
             $account = $user->getUsername();
             $list["account"] = $account;
             $list["name"] = $user->nick_name;
             $list["deptid"] = $user->dept_id;
             $list["deptname"] = $user->dept_name;
             $list["birthday"] = $user->birthday;
             $list["year"] = date('Y', strtotime($user->birthday));
             $list["month"] = date('n', strtotime($user->birthday));
             $list["day"] = date('j', strtotime($user->birthday));
             $list["birthday"] = $list["year"] . "年" . $list["month"] . "月" . $list["day"] . "日";
             $list["work_phone"] = $user->work_phone;
             $list["mobile"] = $user->mobile;
             $list["duty"] = $user->duty;
             $list["sex_id"] = empty($user->sex_id) ? "" : $user->sex_id;
             $list["isself"] = "1";
         } else {
             $user = $ec->getUserInfo($paras[1]);
             $user = $user["we_staff"]["rows"][0];
             $photo_url = $this->container->getParameter('FILE_WEBSERVER_URL') . $user["photo_path_big"];
             $account = $user["login_account"];
             $list["account"] = $account;
             $list["name"] = $user["nick_name"];
             $list["deptid"] = $user["dept_id"];
             $list["deptname"] = $user["dept_name"];
             $list["birthday"] = $user["birthday"];
             $list["year"] = date('Y', strtotime($list["birthday"]));
             $list["month"] = date('n', strtotime($list["birthday"]));
             $list["day"] = date('j', strtotime($list["birthday"]));
             $list["birthday"] = $list["year"] . "年" . $list["month"] . "月" . $list["day"] . "日";
             $list["work_phone"] = $user["work_phone"];
             $list["mobile"] = $user["mobile"];
             $list["duty"] = $user["duty"];
             $list["sex_id"] = empty($user["sex_id"]) ? "" : $user["sex_id"];
             $list["isself"] = "0";
         }
         $sql = "select a.mobile, a.mobile_bind,a.hometown,a.graduated,a.work_his,a.self_desc,a.specialty,a.hobby from we_staff a where a.login_account=?";
         $params = array();
         $params[] = $account;
         $da = $this->get("we_data_access");
         $ds = $da->GetData("we_staff_mobile", $sql, $params);
         $ds = $ds["we_staff_mobile"]["rows"][0];
         $list["mobile_bind"] = $ds["mobile_bind"];
         $list["self_desc"] = $ds["self_desc"];
         $list["hometown"] = $ds["hometown"];
         $list["graduated"] = $ds["graduated"];
         $list["work_his"] = $ds["work_his"];
         $list["specialty"] = $ds["specialty"];
         $list["hobby"] = $ds["hobby"];
         $list["direct_manages"] = "";
         $list["report_object"] = "";
         $list["path"] = $photo_url;
         $list["msg"] = null;
         $list["curr_network_domain"] = $network_domain;
         $perBase = new \Justsy\BaseBundle\Controller\CPerBaseInfoController();
         $perBase->setContainer($this->container);
         $list["InfoCompletePercent"] = $perBase->GetInfoCompletePercent($account);
         return $this->render('JustsyBaseBundle:Account:pcsync.html.twig', $list);
     } catch (\Exception $e) {
         $this->get("logger")->err($e);
         return $this->render('JustsyBaseBundle:Account:pcsync_error.html.twig');
         //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
     }
 }
예제 #2
0
         $network_domain = $request->get("network_domain");
         $group_id = (string) SysSeq::GetSeqNextValue($da, "we_groups", "group_id");
         $sqls = array("insert into we_groups(group_id,circle_id,group_name,group_desc,group_photo_path,join_method,create_staff,create_date)value(?,?,?,?,?,?,?,now())", "insert into we_group_staff(group_id,login_account)values(?,?)");
         $paras = array(array((string) $group_id, (string) $user->get_circle_id($network_domain), (string) $request->get("txtname"), (string) $request->get("txtdesc"), (string) $fileid == "" ? null : $fileid, (string) $request->get("radjoin"), (string) $user->getUsername()), array((string) $group_id, (string) $user->getUsername()));
     } else {
         $sqls = "update we_groups set group_name=?,group_desc=?,group_photo_path=?,join_method=? where group_id=?";
         $sqls_im = "update im_group set groupname=?,groupdesc=?,join_method=? where groupid=?";
         $paras = array((string) $request->get("txtname"), (string) $request->get("txtdesc"), (string) $fileid == "" ? null : $fileid, (string) $request->get("radjoin"), (string) $groupid);
         $paras_im = array((string) $request->get("txtname"), (string) $request->get("txtdesc"), (string) $request->get("radjoin"), (string) $groupid);
     }
     try {
         if ($groupid == 0) {
             $da->ExecSQLs($sqls, $paras);
         } else {
             $da->ExecSQL($sqls, $paras);
             $da_im->ExecSQL($sqls_im, $paras_im);
         }
         return $this->redirect($this->generateUrl("JustsyBaseBundle_group"));
     } catch (Exception $e) {
         return $this->render('JustsyBaseBundle:login:index.html.twig', array('name' => 'err'));
     }
 }
 //指定群的最新动态列表。专门为PC端提供
 //参数data:由openid,groupid组成
 public function trendListForPCAction()
 {
     $res = $this->get("request");
     $auth = $res->get("authcode");
     $paras = $res->get("data");
     if ($auth == null || $auth == "") {
         $this->get("logger")->err("=====pcSyncAction Error:authcode为空!");
         return $this->render('JustsyBaseBundle:Group:pcsync_error.html.twig');
         //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
     }
     //$paras =  explode(",", trim(DES::decrypt($paras)));
     try {
         $auth = trim(DES::decrypt($auth));
         //解密参数串
         $paras = explode(",", trim(DES::decrypt($paras)));
         //授权码已过期
         $lng = time() - (int) $auth;
         if ($lng > 30 || $lng < 0) {
             $this->get("logger")->err("=====pcSyncAction Error:授权码已过期!");
             return $this->render('JustsyBaseBundle:Group:pcsync_error.html.twig');
             //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
         }
     } catch (\Exception $e) {
         $this->get("logger")->err($e);
         return $this->render('JustsyBaseBundle:Group:pcsync_error.html.twig');
         //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
     }
     try {
         if (count($paras) != 2) {
             $this->get("logger")->err("=====pcSyncAction Error:参数{$paras不正确!}");
             return $this->render('JustsyBaseBundle:Group:pcsync_error.html.twig');
             //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
         }
         $ec = new \Justsy\BaseBundle\Controller\PersonalHomeController();
         $ec->setContainer($this->container);
         //通过openID获取用户信息
         $user = $ec->loadUserByUsername($paras[0]);
         if ($user == null) {
             $this->get("logger")->err("=====pcSyncAction Error:{$paras用户信息未找到!}");
             return $this->render('JustsyBaseBundle:Group:pcsync_error.html.twig');
             //$this->redirect($this->generateUrl('JustsyBaseBundle_login'));
         }
         //登记seesion
         $token = new UsernamePasswordToken($user, $user->getPassword(), "secured_area", $user->getRoles());
         $this->get("security.context")->setToken($token);
         $session = $res->getSession()->set('_security_' . 'secured_area', serialize($token));
         $event = new InteractiveLoginEvent($this->get("request"), $token);
         $this->get("event_dispatcher")->dispatch("security.interactive_login", $event);
         $photo_url = $this->container->getParameter('FILE_WEBSERVER_URL') . $user->photo_path_small;