示例#1
0
 public function joinCircleAction()
 {
     $code = ReturnCode::$SUCCESS;
     $msg = '';
     try {
         $user = $this->get('security.context')->getToken()->getUser();
         $request = $this->getRequest();
         //$circle_id=$request->get('circleId');
         $circle = new \Justsy\BaseBundle\Controller\CircleController();
         $circle->setContainer($this->container);
         $reponses = $circle->applyJoinAction();
         $res = $reponses->getContent();
         if ($res != '1') {
             $msg = '操作失败';
             if ($res == '99999') {
                 $msg = '所申请的圈子数已超过限制';
             }
             $code = ReturnCode::$SYSERROR;
             if ($res == '99999' || $res == '-2' || $res == '-3' || $res == '0') {
                 $code = ReturnCode::$OUTOFRANGE;
             }
             if ($res == '-2') {
                 $msg = '您所加入的圈子数已达到限制';
             }
             if ($res == '-3') {
                 $msg = '该圈子已满员';
             }
             if ($res == '0') {
                 $msg = '您之前已提交过加入申请,请耐心等待审核结果。';
             }
         }
     } catch (\Exception $e) {
         $this->get('logger')->err($e);
         $msg = '系统错误';
         $code = ReturnCode::$SYSERROR;
     }
     $re = array('returncode' => $code, 'msg' => $msg);
     $response = new Response(json_encode($re));
     $response->headers->set('Content-Type', 'Application/json');
     return $response;
 }