no message

This commit is contained in:
hellcat 2025-07-07 13:54:31 +08:00
parent ac2bbe27bf
commit 7451614994
4 changed files with 39 additions and 9 deletions

View File

@ -71,7 +71,7 @@ class TestsController
$s = "/dog#list";
$s = "/dog#github 1";
$s = "/dog#github 1002";
$oHttp = new Http();
$oHttp->sMethod = "post";

View 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;
}
}

View File

@ -18,11 +18,16 @@ class Dog extends Base {
// https://api.github.com/repos/v2rayclashfree-com/v2rayclashfree
$this->oHttp->sToUrl = "https://api.github.com/repos/".$oArticle->user_name."/".$oArticle->project_name;
$this->oHttp->sMetHod = "get";
$this->oHttp->bIsJson = true;
// $this->oHttp->bIsJson = true;
$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)

View File

@ -57,15 +57,20 @@ class Http
// 默认使用 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_RETURNTRANSFER, true);
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) {
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json' // 设置接受的内容类型为 JSON
]);
}
// if ($this->bIsJson) {
// curl_setopt($ch, CURLOPT_HTTPHEADER, [
// 'Accept: application/json' // 设置接受的内容类型为 JSON
// ]);
// }
break;
}