作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -86,19 +86,16 @@ class QuanqiusouApi @@ -86,19 +86,16 @@ class QuanqiusouApi
86 $key = "quanqiusou_api_rank_{$api_no}_{$lang}_{$day}_" . date('Y-m-d'); 86 $key = "quanqiusou_api_rank_{$api_no}_{$lang}_{$day}_" . date('Y-m-d');
87 $res = Cache::get($key); 87 $res = Cache::get($key);
88 if (!$res || $force) { 88 if (!$res || $force) {
89 - $param = [  
90 - 'key' => '289c1fc81c89d79c04ed4fd72822948e',  
91 - 'w' => $api_no,  
92 - 'type' => $day  
93 - ];  
94 if ($lang) { 89 if ($lang) {
95 - $param['lang'] = $lang; 90 + $api_no = $api_no . '_' . $lang;
96 } 91 }
97 -  
98 - $api_url = $this->url . '/api';  
99 - 92 + $today = date('Y-m-d');
  93 + $startDay = date('Y-m-d', strtotime('-'.$day.' day'));
  94 + $endDay = date('Y-m-d', strtotime('-1 day'));
  95 + //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";
100 try { 97 try {
101 - $res = HttpUtils::get($api_url, $param); 98 + $res = HttpUtils::get($api_url, []);
102 if($res){ 99 if($res){
103 $res = Arr::s2a($res); 100 $res = Arr::s2a($res);
104 Cache::put($key, $res, 2 * 3600); 101 Cache::put($key, $res, 2 * 3600);
@@ -392,7 +392,7 @@ class RankDataLogic extends BaseLogic @@ -392,7 +392,7 @@ class RankDataLogic extends BaseLogic
392 if (!empty($lang_list[$api_no])) { 392 if (!empty($lang_list[$api_no])) {
393 $model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first(); 393 $model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();
394 if (!$model || $model->updated_date != date('Y-m-d') || $force) { 394 if (!$model || $model->updated_date != date('Y-m-d') || $force) {
395 - $res = $api->getGoogleRank($api_no, 1, 7, $force); 395 + $res = $api->getGoogleRank($api_no, $model->lang, 7, $force);
396 if (!$res) { 396 if (!$res) {
397 throw new \Exception("接口数据获取失败,api_no:{$api_no},lang"); 397 throw new \Exception("接口数据获取失败,api_no:{$api_no},lang");
398 } 398 }