コード例 #1
0
 public function deleteStaffAction()
 {
     $request = $this->getRequest();
     $success = true;
     $msg = "";
     $login_account = $request->get("login_account");
     $success = true;
     $msg = "";
     $staffMgr = new \Justsy\BaseBundle\Management\Staff($this->get("we_data_access"), $this->get('we_data_access_im'), $login_account, $login_account, $this->container);
     $staffdata = $staffMgr->getInfo();
     $toList = $staffMgr->getFriendAndColleagueJid();
     $success = $staffMgr->leave();
     if ($success) {
         //推送消息
         $user = $this->get('security.context')->getToken()->getUser();
         Utils::sendImMessage($user->fafa_jid, implode(",", $toList), "removeStaff", json_encode($staffdata), $this->container, "", "", false, Utils::$systemmessage_code);
     } else {
         $success = false;
         $msg = "删除用户账号失败!";
     }
     $result = array("success" => $success, "msg" => $msg);
     $response = new Response(json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #2
0
 public function employeemgrAction($network_domain)
 {
     $request = $this->get("request");
     $user = $this->get('security.context')->getToken()->getUser();
     $action = $request->get("action");
     $account = $request->get("account");
     $re = array('s' => 1);
     try {
         $accounts = explode(",", $account);
         for ($i = 0; $i < count($accounts); $i++) {
             $staffmgr = new Staff($this->get("we_data_access"), $this->get("we_data_access_im"), $accounts[$i]);
             if ($action == "disable") {
                 $staffmgr->disable(null);
             } else {
                 if ($action == "delete") {
                     $staffmgr->deleteImportPhy();
                 } else {
                     if ($action == "leave") {
                         //
                         $staffmgr->leave();
                     } else {
                         if ($action == "invite") {
                             try {
                                 $staffmgr->invite();
                             } catch (\Exception $e) {
                                 //已注册的用户不能再邀请
                                 continue;
                             }
                             //发送邮件
                             $activeurl = $this->generateUrl("JustsyBaseBundle_empimport_setpass", array('account' => DES::encrypt($account)), true);
                             $txt = $this->renderView('JustsyBaseBundle:Register:mail.html.twig', array('realName' => $user->nick_name, 'account' => $account, 'activeurl' => $activeurl));
                             Utils::saveMail($this->get("we_data_access"), $this->container->getParameter('mailer_user'), $account, "欢迎加入Wefafa企业协作网络", $txt);
                         }
                     }
                 }
             }
         }
     } catch (\Exception $e) {
         $re = array('s' => 0, 'msg' => "操作失败");
     }
     $response = new Response(json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }