/** * 查询自定义菜单 */ public function getMenu() { //GetMenuUrl $accessToken = AccessTokenService::getAccessToken(); $url = Config::get('constants.GetMenuUrl'); $url = $url . "?access_token=" . $accessToken; $res = HttpClientService::curlGet($url); return $res; }
/** * 通过code换取网页授权access_token * getOAuth2AccessToken * @param $code * @return mixed */ public static function getOAuth2AccessToken($code) { $appId = Config::get('constants.AppID'); $appSecret = Config::get('constants.AppSecret'); $url = Config::get('constants.OAuth2AccessTokenUrl'); $url = $url . "?appid={$appId}&secret={$appSecret}&code={$code}&grant_type=authorization_code"; $res = HttpClientService::curlGet($url); return $res; }