作者 lyh

扩展模块不允许使用默认路由

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AuthorityScore.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/1 16:43
  8 + */
  9 +
  10 +namespace App\Console\Commands\WhiteHatProject;
  11 +
  12 +use App\Models\AuthorityScore\AuthorityScore;
  13 +use App\Models\Domain\DomainInfo;
  14 +use App\Models\Project\Project;
  15 +use Illuminate\Console\Command;
  16 +
  17 +class WhiteHatLinkData extends Command
  18 +{
  19 + /**
  20 + * The name and signature of the console command.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $signature = 'white_hat_link_data';
  25 +
  26 + /**
  27 + * The console command description.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $description = '白帽外链数据详情,每月统计一次';
  32 +
  33 + /**
  34 + * @remark :执行方法
  35 + * @name :handle
  36 + * @author :lyh
  37 + * @method :post
  38 + * @time :2025/7/1 16:46
  39 + */
  40 + public function handle(){
  41 + $projectModel = new Project();
  42 + $projectIdArr = $projectModel->selectField(['project_type'=>1,'delete_status' => 0,'extend_type'=>0,'type'=>2],'id');
  43 + $domainModel = new DomainInfo();
  44 + $url = 'https://www.cmer.site/api/domain/organic?domain=';
  45 + foreach ($projectIdArr as $item){
  46 + $domainInfo = $domainModel->read(['project_id'=>$item],['domain']);
  47 + if($domainInfo === false){
  48 + continue;
  49 + }
  50 + $url = $url.$domainInfo['domain'];
  51 + $data = http_get($url);
  52 + if(!empty($data) && !empty($data['data'])){
  53 + $data = $data['data'];
  54 + $this->saveHandleData($data,$item);
  55 + }
  56 + }
  57 + return true;
  58 + }
  59 +
  60 + /**
  61 + * @remark :保存数据
  62 + * @name :handleData
  63 + * @author :lyh
  64 + * @method :post
  65 + * @time :2025/7/1 17:23
  66 + */
  67 + public function saveHandleData($data,$project_id){
  68 + $authorityScoreModel = new AuthorityScore();
  69 + return $authorityScoreModel->addReturnId([
  70 + 'project_id'=>$project_id,
  71 + 'ascore'=>(int)$data['ascore'],
  72 + 'total'=>(int)$data['total'],
  73 + 'domains_num'=>(int)$data['domains_num'],
  74 + 'rank'=>(int)$data['rank'],
  75 + 'organic_keywords'=>(int)$data['organic_keywords'],
  76 + 'organic_traffic'=>(int)$data['organic_traffic'],
  77 + ]);
  78 + }
  79 +}
@@ -12,7 +12,7 @@ namespace App\Http\Logic\Bside\Com; @@ -12,7 +12,7 @@ namespace App\Http\Logic\Bside\Com;
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
13 use App\Models\Ai\AiBlog; 13 use App\Models\Ai\AiBlog;
14 use App\Models\Ai\AiVideo; 14 use App\Models\Ai\AiVideo;
15 -use App\Models\Project\ProjectKeyword; 15 +use App\Models\RankData\RankDataBmseo;
16 use App\Models\SeoSetting\LinkData; 16 use App\Models\SeoSetting\LinkData;
17 17
18 /** 18 /**
@@ -38,10 +38,13 @@ class WhiteHatReportLogic extends BaseLogic @@ -38,10 +38,13 @@ class WhiteHatReportLogic extends BaseLogic
38 * @time :2025/7/1 11:43 38 * @time :2025/7/1 11:43
39 */ 39 */
40 public function LogicWhiteHatReportInfo(){ 40 public function LogicWhiteHatReportInfo(){
  41 + $data = [];
  42 + $bSeoModel = new RankDataBmseo();
  43 + $bSeoInfo = $bSeoModel->read(['project_id'=>$this->user['project_id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']);
  44 + $data['rank'] = $bSeoInfo;
41 $parsedUrl = parse_url($this->user['domain']); 45 $parsedUrl = parse_url($this->user['domain']);
42 $domain = $parsedUrl['host']; 46 $domain = $parsedUrl['host'];
43 $url = 'https://www.cmer.site/api/domain/organic?domain='.$domain; 47 $url = 'https://www.cmer.site/api/domain/organic?domain='.$domain;
44 - $data = [];  
45 try { 48 try {
46 $data['sem'] = http_get($url)['data']; 49 $data['sem'] = http_get($url)['data'];
47 }catch (\Exception $e){ 50 }catch (\Exception $e){
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AuthorityScore.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/1 17:37
  8 + */
  9 +
  10 +namespace App\Models\AuthorityScore;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :白帽第三方拉取排名数据
  16 + * @name :AuthorityScore
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/7/1 17:38
  20 + */
  21 +class AuthorityScore extends Base
  22 +{
  23 + protected $table = 'gl_authority_score';
  24 +}