作者 lyh

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

... ... @@ -112,7 +112,7 @@ if (!function_exists('http_get')) {
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_ENCODING, '');
curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch1, CURLOPT_TIMEOUT, 120);
curl_setopt($ch1, CURLOPT_TIMEOUT, 60);
curl_setopt($ch1, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
... ...
<?php
/**
* @remark :
* @name :WhiteHatReportController.php
* @author :lyh
* @method :post
* @time :2025/7/1 11:11
*/
namespace App\Http\Controllers\Bside\BCom;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Com\WhiteHatReportLogic;
use Illuminate\Http\Request;
/**
* @remark :白帽版本报表
* @name :WhiteHatReportController
* @author :lyh
* @method :post
* @time :2025/7/1 11:12
*/
class WhiteHatReportController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new WhiteHatReportLogic();
}
/**
* @remark :豹猫数据统计表详情
* @name :whiteHatReportInfo
* @author :lyh
* @method :post
* @time :2025/7/1 11:13
*/
public function whiteHatReportInfo(){
$this->request->validate([
'date'=>'required',
], [
'date.required' => '请选择报表时间',
]);
$data = $this->logic->LogicWhiteHatReportInfo();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :WhiteHatReportLogic.php
* @author :lyh
* @method :post
* @time :2025/7/1 11:15
*/
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\SeoSetting\LinkData;
/**
* @remark :报表详情数据
* @name :WhiteHatReportLogic
* @author :lyh
* @method :post
* @time :2025/7/1 11:15
*/
class WhiteHatReportLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
}
/**
* @remark :获取当前项目日期的报表
* @name :LogicWhiteHatReportInfo
* @author :lyh
* @method :post
* @time :2025/7/1 11:43
*/
public function LogicWhiteHatReportInfo(){
$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){
$data['sem'] = [];
}
$startTime = date('Y-m-01 00:00:00', strtotime($this->param['date']));
// 结束时间(当月最后一天)
$endTime = date('Y-m-t 23:59:59', strtotime($this->param['date']));
//当月ai_blog发布数量及链接
$aiBlogModel = new AiBlog();
$data['ai_blog']['count'] = $aiBlogModel->counts(['created_at'=>['between'=>[$startTime,$endTime]]]);
$aiRouteArr = $aiBlogModel->selectField(['created_at'=>['between'=>[$startTime,$endTime]]],'route');
if(!empty($aiRouteArr)){
foreach ($aiRouteArr as $k => $item){
$aiRouteArr[$k] = $this->user['domain'] . 'blog/' . $item;
}
}
$data['ai_blog']['link'] = $aiRouteArr;
//当月ai_video发布数量及链接
$aiVideoModel = new AiVideo();
$data['ai_video']['count'] =$aiVideoModel->counts(['created_at'=>['between'=>[$startTime,$endTime]]]);
$aiVideoRouteArr = $aiVideoModel->selectField(['created_at'=>['between'=>[$startTime,$endTime]]],'route');
if(!empty($aiVideoRouteArr)){
foreach ($aiVideoRouteArr as $kVideo => $itemVideo){
$aiVideoRouteArr[$kVideo] = $this->user['domain'] . 'video/' . $itemVideo;
}
}
$data['ai_video']['link'] = $aiVideoRouteArr;
//白帽关键字
$data['keyword']['count'] = 0;
$data['keyword']['link'] = [];
//外链发布条数
$linkDataModel = new LinkData();
$data['link_data']['count'] = $linkDataModel->counts(['send_time'=>['between'=>[$startTime,$endTime]]]);
$data['link_data']['total_count'] = $linkDataModel->count();
$data['link_data']['ten_count'] = $linkDataModel->count(['da'=>['between'=>[10,30]]]);
$data['link_data']['thirty_count'] = $linkDataModel->count(['da'=>['between'=>[30,50]]]);
$data['link_data']['fifty_count'] = $linkDataModel->count(['da'=>['>=',50]]);
return $this->success($data);
}
}
... ...
... ... @@ -744,6 +744,10 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('google_link')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\GoogleKeyword\GoogleLinkController::class,'getLink'])->name('google_link_getLink');
});
//白帽版本
Route::prefix('white_hat_report')->group(function () {
Route::any('/whiteHatReportInfo', [\App\Http\Controllers\Bside\BCom\WhiteHatReportController::class,'whiteHatReportInfo'])->name('white_hat_report_whiteHatReportInfo');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...