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; }