Exemple #1
0
 public function getcirclememberAction()
 {
     //判断请求域。是wefafa或子域则不验证授权令牌
     $isWeFaFaDomain = $this->checkWWWDomain();
     $res = $this->get("request");
     $da = $this->get("we_data_access");
     if (!$isWeFaFaDomain) {
         $token = $this->checkAccessToken($res, $da);
         if (!$token) {
             $re = array("returncode" => "9999");
             $re["code"] = "err0105";
             $re["msg"] = "参数Appid或Openid或Access_token未指定或无效.";
             $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
             $response->headers->set('Content-Type', 'text/json');
             return $response;
         }
     }
     $opneid = $res->get("openid");
     $ds = $this->checkOpenid($da, $opneid);
     if ($ds === false) {
         $re = array("returncode" => "9999");
         $re["code"] = "err0105";
         $re["msg"] = "参数openid未指定或无效.";
         $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
         $response->headers->set('Content-Type', 'text/json');
         return $response;
     }
     $circleid = $res->get("circleid");
     $obj = new \Justsy\BaseBundle\Management\CircleMgr($da, $this->get("we_data_access_im"), $circleid);
     $isPriv = $obj->IsExist($opneid);
     if ($isPriv === false) {
         $re = array("returncode" => "9999");
         $re["code"] = "err0105";
         $re["msg"] = "权限不足,不能获取该圈子的成员信息.";
         $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
         $response->headers->set('Content-Type', 'text/json');
         return $response;
     }
     $datalist = $obj->getCircleMembers($circleid);
     $re = array("returncode" => "0000");
     $re["members"] = $datalist == null ? array() : $datalist;
     $response = new Response($res->get('jsoncallback') ? $res->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
 public function getCircleMemberAction(Request $request)
 {
     $user = $this->get('security.context')->getToken()->getUser();
     $circleMgr = new \Justsy\BaseBundle\Management\CircleMgr($this->get("we_data_access"), $this->get("we_data_access_im"));
     $circleid = $request->get("circleid");
     $result = $circleMgr->getCircleMembers($circleid, $user->getUserName());
     $response = new Response(json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }