all(); //将所有接收到的参数记录下来 Log::logInfo(json_encode($params), [], 'callBack'); $authCode = $params['authorization_code'] ?? null; $group_id = $params['state'] ?? null; if (empty($authCode) || empty($group_id)) { return 'auth_code 和 用户组ID 不能为空'; } $wxadConfig = config('wxad'); $params['grant_type'] = 'authorization_code'; $params['client_id'] = $wxadConfig['client_id']; $params['client_secret'] = $wxadConfig['client_secret']; $params['redirect_uri'] = $wxadConfig['redirect_uri']; $routeUrl = 'https://api.e.qq.com/oauth/token?'.http_build_query($params); $result = HttpService::httpGet($routeUrl); $result = json_decode($result, true); if(0 == $result['code']) { Log::logInfo(json_encode($result), $params, 'token-success'); // header('Location:http://addata.kuxuan-inc.com/admin/index'); $res = TencentAdAuth::inserOrUpdate($result['data'], $group_id); if ($res) return '授权成功'; } Log::logError(json_encode($result), $params, 'token-error'); return '授权失败'; } }