作者 lyh

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

<?php
/**
* @remark :
* @name :AuthorityScore.php
* @author :lyh
* @method :post
* @time :2025/7/1 16:43
*/
namespace App\Console\Commands\WhiteHatProject;
use App\Models\AuthorityScore\AuthorityScore;
use App\Models\Domain\DomainInfo;
use App\Models\Project\Project;
use Illuminate\Console\Command;
class WhiteHatLinkData extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'white_hat_link_data';
/**
* The console command description.
*
* @var string
*/
protected $description = '白帽外链数据详情,每月统计一次';
/**
* @remark :执行方法
* @name :handle
* @author :lyh
* @method :post
* @time :2025/7/1 16:46
*/
public function handle(){
$projectModel = new Project();
$projectIdArr = $projectModel->selectField(['project_type'=>1,'delete_status' => 0,'extend_type'=>0,'type'=>2],'id');
$domainModel = new DomainInfo();
$url = 'https://www.cmer.site/api/domain/organic?domain=';
foreach ($projectIdArr as $item){
$domainInfo = $domainModel->read(['project_id'=>$item],['domain']);
if($domainInfo === false){
continue;
}
$url = $url.$domainInfo['domain'];
$data = http_get($url);
if(!empty($data) && !empty($data['data'])){
$data = $data['data'];
$this->saveHandleData($data,$item);
}
}
return true;
}
/**
* @remark :保存数据
* @name :handleData
* @author :lyh
* @method :post
* @time :2025/7/1 17:23
*/
public function saveHandleData($data,$project_id){
$authorityScoreModel = new AuthorityScore();
return $authorityScoreModel->addReturnId([
'project_id'=>$project_id,
'ascore'=>(int)$data['ascore'],
'total'=>(int)$data['total'],
'domains_num'=>(int)$data['domains_num'],
'rank'=>(int)$data['rank'],
'organic_keywords'=>(int)$data['organic_keywords'],
'organic_traffic'=>(int)$data['organic_traffic'],
]);
}
}
... ...
... ... @@ -12,7 +12,7 @@ namespace App\Http\Logic\Bside\Com;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiVideo;
use App\Models\Project\ProjectKeyword;
use App\Models\RankData\RankDataBmseo;
use App\Models\SeoSetting\LinkData;
/**
... ... @@ -38,10 +38,13 @@ class WhiteHatReportLogic extends BaseLogic
* @time :2025/7/1 11:43
*/
public function LogicWhiteHatReportInfo(){
$data = [];
$bSeoModel = new RankDataBmseo();
$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']);
$data['rank'] = $bSeoInfo;
$parsedUrl = parse_url($this->user['domain']);
$domain = $parsedUrl['host'];
$url = 'https://www.cmer.site/api/domain/organic?domain='.$domain;
$data = [];
try {
$data['sem'] = http_get($url)['data'];
}catch (\Exception $e){
... ...
<?php
/**
* @remark :
* @name :AuthorityScore.php
* @author :lyh
* @method :post
* @time :2025/7/1 17:37
*/
namespace App\Models\AuthorityScore;
use App\Models\Base;
/**
* @remark :白帽第三方拉取排名数据
* @name :AuthorityScore
* @author :lyh
* @method :post
* @time :2025/7/1 17:38
*/
class AuthorityScore extends Base
{
protected $table = 'gl_authority_score';
}
... ...