public function oauthRedirect($req, $res)
    {/*{{{*/
        $code = $req->getRequest('code', '');
        $openId = WeiXinConnection::openId($code)->openid;

        if (false == $this->user->isNull())
        {
            OAuthClient::getInstance()->bindWeiXinUser($this->user, $openId);
            $res->setRedirect($res->router->urlfor('weixin/message', array('message' => '绑定成功,返回后便可使用相关功能')));
        } else {
            $res->setRedirect($res->router->urlfor('weixin/message', array('message' => '登陆出错了,请返回上一页重试')));
        }
    }/*}}}*/
Example #2
0
 public function testCreateMenu()
 {/*{{{*/
     $res = WeiXinConnection::createMenu(IntentionWeiXinFoo::menuCreateJson());
     $this->assertEquals($res->errcode, 0);
 }/*}}}*/