作者 赵彬吉

updtae

... ... @@ -4,6 +4,7 @@
namespace App\Helper;
use App\Utils\HttpUtils;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
... ... @@ -95,7 +96,13 @@ class QuanqiusouApi
//8918_kr_2024-02-19_2024-02-25.json 8918_2024-02-19_2024-02-25.json
$api_url = "https://quanqiusou.cn/google-rank/data_json/{$today}/{$api_no}_{$startDay}_{$endDay}.json";
try {
$res = HttpUtils::get($api_url, []);
//$res = HttpUtils::get($api_url, []);
$client = new Client();
$response = $client->request('GET', $api_url, [
'proxy' => '64.34.204.224:51395', // 代理服务器地址和端口号
// 其他请求选项
]);
$res = $response->getBody()->getContents();
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 2 * 3600);
... ...
... ... @@ -390,7 +390,7 @@ class RankDataLogic extends BaseLogic
$api = new QuanqiusouApi();
$model = RankData::where('project_id', $project_id)->where('lang', '')->first();
if (!$model || $model->updated_date != date('Y-m-d') || $force) {
$res = $api->getGoogleRank($api_no, '', 7, true);
$res = $api->getGoogleRank($api_no, '', 7, $force);
if (!$res) {
throw new \Exception("接口数据获取失败,api_no:{$api_no}");
}
... ...