作者 赵彬吉

updtae

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