public function listAction() { $da = $this->get("we_data_access"); $da_im = $this->get('we_data_access_im'); $request = $this->getRequest(); //访问权限校验 $api = new \Justsy\OpenAPIBundle\Controller\ApiController(); $api->setContainer($this->container); $isWeFaFaDomain = $api->checkWWWDomain(); if (!$isWeFaFaDomain) { $token = $api->checkAccessToken($request, $da); if (!$token) { $re = array("returncode" => "9999"); $re["code"] = "err0105"; $re["msg"] = "参数Appid或Openid或Access_token未指定或无效."; return $this->responseJson($request, $re); } } $openid = $request->get("openid"); $staffinfo = new \Justsy\BaseBundle\Management\Staff($da, $da_im, $openid, $this->get("logger"), $this->container); $staffdata = $staffinfo->getInfo(); if (empty($staffdata)) { $result = Utils::WrapResultError("无效操作帐号"); return $this->responseJson($request, $result); } $verCrl = new \Justsy\AdminAppBundle\Controller\VersionController(); $verCrl->setContainer($this->container); return $this->responseJson($request, $verCrl->SearchVersionAction()); }
public function accessCheck() { $da = $this->get("we_data_access"); $da_im = $this->get('we_data_access_im'); $request = $this->getRequest(); //访问权限校验 $api = new ApiController(); $api->setContainer($this->container); $isWeFaFaDomain = $api->checkWWWDomain(); if (!$isWeFaFaDomain) { $token = $api->checkAccessToken($request, $da); if (!$token) { $re = array("returncode" => "9999"); $re["code"] = "err0105"; $re["msg"] = "参数Appid或Openid或Access_token未指定或无效."; return $re; } } $openid = $request->get("openid"); $staffinfo = new Staff($da, $da_im, $openid, $this->get("logger"), $this->container); $staffdata = $staffinfo->getInfo(); if (empty($staffdata)) { return Utils::WrapResultError("无效操作帐号"); } return Utils::WrapResultOk($staffinfo); }
public function removeMonitorAction() { $da = $this->get("we_data_access"); $da_im = $this->get('we_data_access_im'); $request = $this->getRequest(); //访问权限校验 $api = new ApiController(); $api->setContainer($this->container); $isWeFaFaDomain = $api->checkWWWDomain(); if (!$isWeFaFaDomain) { $token = $api->checkAccessToken($request, $da); if (!$token) { $re = array("returncode" => "9999"); $re["code"] = "err0105"; $re["msg"] = "参数Appid或Openid或Access_token未指定或无效."; return $this->responseJson($request, $re); } } $openid = $request->get("openid"); $staffinfo = new Staff($da, $da_im, $openid, $this->get("logger"), $this->container); $staffdata = $staffinfo->getInfo(); if (empty($staffdata)) { $result = Utils::WrapResultError("无效操作帐号"); return $this->responseJson($request, $result); } $to = $request->get("to"); if (empty($to)) { $result = Utils::WrapResultError("无效的帐号"); return $this->responseJson($request, $result); } $to = $staffinfo->getStaffInfo($to); if (empty($to)) { $result = Utils::WrapResultError("无效的帐号"); return $this->responseJson($request, $result); } try { $sql = 'delete from t_module_location_monitor where staff=?'; $da->ExecSQL($sql, array((string) $to['jid'])); $sql = 'delete from t_module_location where staff=?'; $da->ExecSQL($sql, array((string) $to['login_account'])); } catch (\Exception $e) { } $senddata = array('opt' => 'stop'); $msg = Utils::WrapMessage('sendlocation', $senddata, array()); //$msgxml = Utils::WrapMessageXml($this->module["jid"],$msg,'sendlocation-id'); $api->sendMsg("", $to['jid'], 'sendlocation', json_encode($msg)); return $this->responseJson($request, Utils::WrapResultOk("")); }
public function push_receiverlistAction() { $da = $this->get("we_data_access"); $da_im = $this->get('we_data_access_im'); $request = $this->getRequest(); //访问权限校验 $api = new \Justsy\OpenAPIBundle\Controller\ApiController(); $api->setContainer($this->container); $isWeFaFaDomain = $api->checkWWWDomain(); if (!$isWeFaFaDomain) { $token = $api->checkAccessToken($request, $da); if (!$token) { $re = array("returncode" => "9999"); $re["code"] = "err0105"; $re["msg"] = "参数Appid或Openid或Access_token未指定或无效."; return $this->responseJson($request, $re); } } $openid = $request->get("openid"); $staffinfo = new \Justsy\BaseBundle\Management\Staff($da, $da_im, $openid, $this->get("logger"), $this->container); $staffdata = $staffinfo->getInfo(); if (empty($staffdata)) { $result = Utils::WrapResultError("无效操作帐号"); return $this->responseJson($request, $result); } $appid = $request->get('appid'); $appmgr = new \Justsy\BaseBundle\Management\App($this->container); $appdata = $appmgr->getappinfo(array('appid' => $appid)); if (empty($appdata)) { $result = Utils::WrapResultError("无效应用标识"); return $this->responseJson($request, $result); } $data = $request->get("data"); //部门名称 if (empty($data)) { $result = Utils::WrapResultError("无效的数据"); return $this->responseJson($request, $result); } $data = json_decode($data, true); $noticeMgr = new \Justsy\BaseBundle\Management\PromptlyNotice($this->container, $staffdata, $appdata); $result = $noticeMgr->getReceiverList($data); return $this->responseJson($request, $result); }
private function getToken($appid, $appkey) { $code = $this->makeCode($appid, $appkey); $api = new ApiController(); $json = $api->getProxySession($appid, $code, "test-fafa-app"); return $json["access_token"]; }
private function getSecurityDomains() { if (!empty(ApiController::$securityDomains)) { return ApiController::$securityDomains; } $mayDomain = array("localhost"); $configWeFaFa = $this->container->getParameter('open_api_url'); //获取配置的wefafa地址 $tmp = parse_url($configWeFaFa); $host = $tmp["host"]; //$this->get("logger")->err(">>>>>>>>>>>>>>>>>>>open_api_url>host:".$host); if (Utils::is_ip($host)) { $mayDomain[] = $host; } else { $host = substr($host, strpos($host, ".") + 1); $mayDomain[] = $host; } $configWeFaFa = $this->container->getParameter('fafa_appcenter_url'); //获取配置的应用中心地址 $tmp = parse_url($configWeFaFa); $host = $tmp["host"]; //$this->get("logger")->err(">>>>>>>>>>>>>>>>>>>fafa_appcenter_url>host:".$host); if (Utils::is_ip($host)) { $mayDomain[] = $host; } else { $host = substr($host, strpos($host, ".") + 1); $mayDomain[] = $host; } ApiController::$securityDomains = $mayDomain; return ApiController::$securityDomains; }