mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
pt gen support rabbitwit/PT-Gen-Refactor
This commit is contained in:
@@ -84,14 +84,15 @@ class PTGen
|
|||||||
|
|
||||||
public function generate(string $url, bool $withoutCache = false): array
|
public function generate(string $url, bool $withoutCache = false): array
|
||||||
{
|
{
|
||||||
$parsed = $this->parse($url);
|
// $parsed = $this->parse($url);
|
||||||
$targetUrl = trim($this->apiPoint, '/');
|
$targetUrl = trim($this->apiPoint, '/');
|
||||||
if (Str::contains($targetUrl, '?')) {
|
if (Str::contains($targetUrl, '?')) {
|
||||||
$targetUrl .= "&";
|
$targetUrl .= "&";
|
||||||
} else {
|
} else {
|
||||||
$targetUrl .= "?";
|
$targetUrl .= "?";
|
||||||
}
|
}
|
||||||
$targetUrl .= sprintf('site=%s&sid=%s&url=%s', $parsed['site'] , $parsed['id'], urlencode($parsed['url']));
|
// $targetUrl .= sprintf('site=%s&sid=%s&url=%s', $parsed['site'] , $parsed['id'], urlencode($parsed['url']));
|
||||||
|
$targetUrl .= "url=" . urlencode($url);
|
||||||
return $this->request($targetUrl, $withoutCache);
|
return $this->request($targetUrl, $withoutCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +178,7 @@ HTML;
|
|||||||
}
|
}
|
||||||
do_log("$logPrefix, going to send request...");
|
do_log("$logPrefix, going to send request...");
|
||||||
$http = new Client();
|
$http = new Client();
|
||||||
$response = $http->get($url, ['timeout' => 10]);
|
$response = $http->post($url, ['timeout' => 10]);
|
||||||
$statusCode = $response->getStatusCode();
|
$statusCode = $response->getStatusCode();
|
||||||
if ($statusCode != 200) {
|
if ($statusCode != 200) {
|
||||||
$msg = "api point response http status code: $statusCode";
|
$msg = "api point response http status code: $statusCode";
|
||||||
|
|||||||
Reference in New Issue
Block a user