no message
This commit is contained in:
parent
ac2bbe27bf
commit
7451614994
@ -71,7 +71,7 @@ class TestsController
|
|||||||
|
|
||||||
$s = "/dog#list";
|
$s = "/dog#list";
|
||||||
|
|
||||||
$s = "/dog#github 1";
|
$s = "/dog#github 1002";
|
||||||
|
|
||||||
$oHttp = new Http();
|
$oHttp = new Http();
|
||||||
$oHttp->sMethod = "post";
|
$oHttp->sMethod = "post";
|
||||||
|
|||||||
20
app/Services/Github/Mod/Test/A.php
Executable file
20
app/Services/Github/Mod/Test/A.php
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Services\Github\Mod\FreeNode;
|
||||||
|
|
||||||
|
use App\Services\Github\Mod\Base;
|
||||||
|
use App\Services\TomTool\Http;
|
||||||
|
|
||||||
|
class A extends Base {
|
||||||
|
|
||||||
|
public $aShip; // 必须,注入
|
||||||
|
|
||||||
|
public function Get($aArticle)
|
||||||
|
{
|
||||||
|
|
||||||
|
$sContent "test";
|
||||||
|
|
||||||
|
return $sContent;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -18,11 +18,16 @@ class Dog extends Base {
|
|||||||
// https://api.github.com/repos/v2rayclashfree-com/v2rayclashfree
|
// https://api.github.com/repos/v2rayclashfree-com/v2rayclashfree
|
||||||
$this->oHttp->sToUrl = "https://api.github.com/repos/".$oArticle->user_name."/".$oArticle->project_name;
|
$this->oHttp->sToUrl = "https://api.github.com/repos/".$oArticle->user_name."/".$oArticle->project_name;
|
||||||
$this->oHttp->sMetHod = "get";
|
$this->oHttp->sMetHod = "get";
|
||||||
$this->oHttp->bIsJson = true;
|
// $this->oHttp->bIsJson = true;
|
||||||
$r = $this->oHttp->send();
|
$r = $this->oHttp->send();
|
||||||
|
|
||||||
|
$aGitHub = json_decode($r, true);
|
||||||
|
|
||||||
tomd($r);
|
return $this->toJson($aGitHub);
|
||||||
|
|
||||||
|
// tomd($aGitHub, 1);
|
||||||
|
// tomd($this->oHttp->sToUrl);
|
||||||
|
// tomd($r, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function List($aParam)
|
public function List($aParam)
|
||||||
|
|||||||
@ -57,15 +57,20 @@ class Http
|
|||||||
// 默认使用 GET 请求
|
// 默认使用 GET 请求
|
||||||
curl_setopt($ch, CURLOPT_HTTPGET, true); // 设置为 GET 请求
|
curl_setopt($ch, CURLOPT_HTTPGET, true); // 设置为 GET 请求
|
||||||
curl_setopt($ch, CURLOPT_URL, $this->sToUrl . '?' . http_build_query($this->aData)); // 设置请求 URL
|
curl_setopt($ch, CURLOPT_URL, $this->sToUrl . '?' . http_build_query($this->aData)); // 设置请求 URL
|
||||||
|
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
'User-Agent: JohnDoeDev' // 替换为你的应用名称
|
'User-Agent: MyCoolApp', // 替换为你的应用名称
|
||||||
|
// 'Accept: application/vnd.github.v3+json', // 指定接受的内容类型
|
||||||
|
'Content-Type: application/json', // 请求内容类型
|
||||||
|
// 'Authorization: token YOUR_ACCESS_TOKEN' // 如果需要身份验证,替换为你的访问令牌
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($this->bIsJson) {
|
// if ($this->bIsJson) {
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
// curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
'Accept: application/json' // 设置接受的内容类型为 JSON
|
// 'Accept: application/json' // 设置接受的内容类型为 JSON
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user