Merge remote-tracking branch 'origin/master' into akun
正在显示
5 个修改的文件
包含
46 行增加
和
15 行删除
| @@ -57,7 +57,7 @@ class AiBlogTask extends Command | @@ -57,7 +57,7 @@ class AiBlogTask extends Command | ||
| 57 | $aiBlogService->key = $aiSettingInfo['key']; | 57 | $aiBlogService->key = $aiSettingInfo['key']; |
| 58 | $aiBlogService->task_id = $item['task_id']; | 58 | $aiBlogService->task_id = $item['task_id']; |
| 59 | $result = $aiBlogService->getDetail(); | 59 | $result = $aiBlogService->getDetail(); |
| 60 | - if($result['status'] != 200){ | 60 | + if(!isset($result['status']) || $result['status'] != 200){ |
| 61 | sleep(5); | 61 | sleep(5); |
| 62 | continue; | 62 | continue; |
| 63 | } | 63 | } |
| @@ -54,13 +54,16 @@ class QuanqiusouApi | @@ -54,13 +54,16 @@ class QuanqiusouApi | ||
| 54 | * @author zbj | 54 | * @author zbj |
| 55 | * @date 2023/5/11 | 55 | * @date 2023/5/11 |
| 56 | */ | 56 | */ |
| 57 | - public function getSiteResPer($api_no){ | 57 | + public function getSiteResPer($api_no, $is_ext = 0, $copy_domain = ''){ |
| 58 | // $key = 'quanqiusou_api_site_res_per_' . $api_no . '_' . date('Y-m-d'); | 58 | // $key = 'quanqiusou_api_site_res_per_' . $api_no . '_' . date('Y-m-d'); |
| 59 | // $res = Cache::get($key); | 59 | // $res = Cache::get($key); |
| 60 | // if (!$res) { | 60 | // if (!$res) { |
| 61 | $api_url = $this->url . '/google-rank/echo_site_res_per.php'; | 61 | $api_url = $this->url . '/google-rank/echo_site_res_per.php'; |
| 62 | try { | 62 | try { |
| 63 | - $res = HttpUtils::get($api_url, ['apino' => $api_no]); | 63 | + $param = ['apino' => $api_no]; |
| 64 | + $is_ext && $param['is_ext'] = $is_ext; | ||
| 65 | + $copy_domain && $param['domain'] = $copy_domain; | ||
| 66 | + $res = HttpUtils::get($api_url, $param); | ||
| 64 | if($res){ | 67 | if($res){ |
| 65 | $res = Arr::s2a($res); | 68 | $res = Arr::s2a($res); |
| 66 | // Cache::put($key, $res, 2 * 3600); | 69 | // Cache::put($key, $res, 2 * 3600); |
| @@ -73,6 +76,26 @@ class QuanqiusouApi | @@ -73,6 +76,26 @@ class QuanqiusouApi | ||
| 73 | return $res; | 76 | return $res; |
| 74 | } | 77 | } |
| 75 | 78 | ||
| 79 | + /** | ||
| 80 | + * 复制站点 | ||
| 81 | + * @return array|false|mixed | ||
| 82 | + * @author zbj | ||
| 83 | + * @date 2023/5/11 | ||
| 84 | + */ | ||
| 85 | + public function getSiteNumList(){ | ||
| 86 | + $api_url = $this->url . '/google-rank/ext_sitenum_list.php'; | ||
| 87 | + try { | ||
| 88 | + $res = HttpUtils::get($api_url, []); | ||
| 89 | + if($res){ | ||
| 90 | + $res = Arr::s2a($res); | ||
| 91 | + } | ||
| 92 | + } catch (\Exception | GuzzleException $e) { | ||
| 93 | + errorLog('获取复制站点收录页面数', [], $e); | ||
| 94 | + return []; | ||
| 95 | + } | ||
| 96 | + return array_column($res, 'url'); | ||
| 97 | + } | ||
| 98 | + | ||
| 76 | 99 | ||
| 77 | /** | 100 | /** |
| 78 | * 获取谷歌排名数据 | 101 | * 获取谷歌排名数据 |
| @@ -54,6 +54,7 @@ class KeywordLogic extends BaseLogic | @@ -54,6 +54,7 @@ class KeywordLogic extends BaseLogic | ||
| 54 | * @author :lyh | 54 | * @author :lyh |
| 55 | * @method :post | 55 | * @method :post |
| 56 | * @time :2023/8/23 16:50 | 56 | * @time :2023/8/23 16:50 |
| 57 | + * @param :is_video_keyword:1->生成视频的关键字 | ||
| 57 | */ | 58 | */ |
| 58 | public function keywordSave(){ | 59 | public function keywordSave(){ |
| 59 | $this->param = $this->handleSaveParam($this->param); | 60 | $this->param = $this->handleSaveParam($this->param); |
| @@ -146,16 +147,12 @@ class KeywordLogic extends BaseLogic | @@ -146,16 +147,12 @@ class KeywordLogic extends BaseLogic | ||
| 146 | * @time :2024/10/28 10:47 | 147 | * @time :2024/10/28 10:47 |
| 147 | */ | 148 | */ |
| 148 | public function first_word($title){ | 149 | public function first_word($title){ |
| 149 | - $first_title = mb_substr($title, 0, 1); | ||
| 150 | - //返回对应的键 | ||
| 151 | - $keywordModel = new Keyword(); | ||
| 152 | - $firstNumWord = $keywordModel->firstNumWord; | ||
| 153 | - foreach($firstNumWord as $k => $v){ | ||
| 154 | - if(strtolower($v) == strtolower($first_title)){ | ||
| 155 | - return $k; | ||
| 156 | - } | 150 | + $first_title = mb_substr(strtolower($title), 0, 1); |
| 151 | + if (is_numeric($first_title)){ | ||
| 152 | + return 0; | ||
| 157 | } | 153 | } |
| 158 | - return 27; | 154 | + $string_key = array_search($first_title, $this->model->firstNumWord); |
| 155 | + return $string_key ?: 27; | ||
| 159 | } | 156 | } |
| 160 | 157 | ||
| 161 | /** | 158 | /** |
| @@ -171,7 +168,6 @@ class KeywordLogic extends BaseLogic | @@ -171,7 +168,6 @@ class KeywordLogic extends BaseLogic | ||
| 171 | if(empty($v)){ | 168 | if(empty($v)){ |
| 172 | continue; | 169 | continue; |
| 173 | } | 170 | } |
| 174 | - $this->model = new Keyword(); | ||
| 175 | $info = $this->model->read(['title'=>$v],['id']); | 171 | $info = $this->model->read(['title'=>$v],['id']); |
| 176 | if($info === false){ | 172 | if($info === false){ |
| 177 | $param['project_id'] = $this->user['project_id']; | 173 | $param['project_id'] = $this->user['project_id']; |
| @@ -28,6 +28,7 @@ use App\Models\RankData\Speed; | @@ -28,6 +28,7 @@ use App\Models\RankData\Speed; | ||
| 28 | use App\Models\RankData\Speed as GoogleSpeedModel; | 28 | use App\Models\RankData\Speed as GoogleSpeedModel; |
| 29 | use App\Utils\HttpUtils; | 29 | use App\Utils\HttpUtils; |
| 30 | use GuzzleHttp\Exception\GuzzleException; | 30 | use GuzzleHttp\Exception\GuzzleException; |
| 31 | +use Illuminate\Database\Eloquent\Model; | ||
| 31 | use Illuminate\Support\Collection; | 32 | use Illuminate\Support\Collection; |
| 32 | use Illuminate\Support\Facades\Cache; | 33 | use Illuminate\Support\Facades\Cache; |
| 33 | use Illuminate\Support\Facades\Log; | 34 | use Illuminate\Support\Facades\Log; |
| @@ -819,8 +820,19 @@ class RankDataLogic extends BaseLogic | @@ -819,8 +820,19 @@ class RankDataLogic extends BaseLogic | ||
| 819 | if(!$model){ | 820 | if(!$model){ |
| 820 | $model = new IndexedPagesModel(); | 821 | $model = new IndexedPagesModel(); |
| 821 | } | 822 | } |
| 823 | + $is_ext = 0; | ||
| 824 | + $copy_domain = ''; | ||
| 822 | $api = new QuanqiusouApi(); | 825 | $api = new QuanqiusouApi(); |
| 823 | - $res = $api->getSiteResPer($api_no); | 826 | + //复制站 域名在这个http://api.quanqiusou.cn/google-rank/ext_sitenum_list.php里面 就用这个接口的数据 |
| 827 | + $domain = (new DomainInfo())->getDomain($domain); | ||
| 828 | + $host = parse_url($domain, PHP_URL_HOST); | ||
| 829 | + $host=str_replace('www.', '', $host); | ||
| 830 | + $copy_site_list = $api->getSiteNumList(); | ||
| 831 | + if(in_array($host, $copy_site_list)){ | ||
| 832 | + $copy_domain = $host; | ||
| 833 | + $is_ext = 1; | ||
| 834 | + } | ||
| 835 | + $res = $api->getSiteResPer($api_no, $is_ext, $copy_domain); | ||
| 824 | if(!$res){ | 836 | if(!$res){ |
| 825 | Log::channel('rank_data')->error('syncIndexedPages:收录数数据为空', ['project_id' => $project_id, 'api_no' => $api_no]); | 837 | Log::channel('rank_data')->error('syncIndexedPages:收录数数据为空', ['project_id' => $project_id, 'api_no' => $api_no]); |
| 826 | continue; | 838 | continue; |
| @@ -77,7 +77,7 @@ class AiBlogService | @@ -77,7 +77,7 @@ class AiBlogService | ||
| 77 | 'type'=>$type, | 77 | 'type'=>$type, |
| 78 | 'subtype'=>$subtype, | 78 | 'subtype'=>$subtype, |
| 79 | ]; | 79 | ]; |
| 80 | - $param['anchor'] = json_encode($anchor,true); | 80 | + $param['anchor'] = $anchor; |
| 81 | $param['url'] = $this->route; | 81 | $param['url'] = $this->route; |
| 82 | $param['mch_id'] = $this->mch_id; | 82 | $param['mch_id'] = $this->mch_id; |
| 83 | $param['template_id'] = 1; | 83 | $param['template_id'] = 1; |
-
请 注册 或 登录 后发表评论