Ejemplo n.º 1
0
 public function getattenmicroaccountAction()
 {
     $request = $this->getRequest();
     $da = $this->get("we_data_access");
     //访问权限校验
     $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($re);
         }
     }
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $baseinfoCtl = new \Justsy\BaseBundle\Management\Staff($da, $this->get("we_data_access_im"), $request->get("openid"), $this->get("logger"), $this->container);
     $currUser = $baseinfoCtl->getSessionUser();
     $mgr = new MicroAccountMgr($da, $this->get("we_data_access_im"), $currUser, $this->get("logger"), $this->container);
     $rows = $mgr->getMy();
     for ($i = 0; $i < count($rows); $i++) {
         $micro_account = $rows[$i]["number"];
         $group = $mgr->getgrouplist($micro_account);
         $rows[$i]["grouplist"] = $group;
     }
     $re["list"] = $rows;
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
Ejemplo n.º 2
0
 public function getattenmicroaccountAction()
 {
     $request = $this->getRequest();
     $da = $this->get("we_data_access");
     //$micro_use=$request->get('micro_use');
     $re = array("returncode" => ReturnCode::$SUCCESS);
     //    if($micro_use!=null && $micro_use!=1 && $micro_use!=0){
     //      $re = array("returncode" => ReturnCode::$SYSERROR,'msg'=>'参数micro_use无效');
     //      $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback')."(".json_encode($re).");" : json_encode($re));
     //      $response->headers->set('Content-Type', 'text/json');
     //      return $response;
     //    }
     $currUser = $this->get('security.context')->getToken()->getUser();
     $mgr = new MicroAccountMgr($da, $this->get("we_data_access_im"), $currUser, $this->get("logger"), $this->container);
     $rows = $mgr->getMy();
     for ($i = 0; $i < count($rows); $i++) {
         $micro_account = $rows[$i]["number"];
         $group = $mgr->getgrouplist($micro_account);
         $rows[$i]["grouplist"] = $group;
     }
     $re["list"] = $rows;
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }