作者 赵彬吉
... ... @@ -339,7 +339,7 @@ class AiBlogTask extends Command
];
$res = http_post($c_url, json_encode($param,true));
if(empty($res)){
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$param]),date('Y-m-d H:i:s',time()+300));
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, ['c_url'=>$c_url,'c_params'=>$param],date('Y-m-d H:i:s',time()+300));
}
$this->output('notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
}
... ...
<?php
/**
* @remark :
* @name :AuthorityScore.php
* @author :lyh
* @method :post
* @time :2025/7/1 16:43
*/
namespace App\Console\Commands\AuthorityScore;
use App\Models\AuthorityScore\AuthorityScore as AuthorityScoreModel;
use App\Models\Domain\DomainInfo;
use App\Models\Project\Project;
use Illuminate\Console\Command;
class AuthorityScore extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'authority_score';
/**
* 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;
}
echo '执行的项目id'.$item.PHP_EOL;
$url = $url.$domainInfo['domain'];
$data = http_get($url);
if(!empty($data) && !empty($data['data'])){
echo json_encode($data).PHP_EOL;
$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 AuthorityScoreModel();
return $authorityScoreModel->addReturnId([
'project_id'=>$project_id,
'ascore'=>(int)($data['ascore'] ?? 0),
'total'=>(int)($data['total'] ?? 0),
'domains_num'=>(int)($data['domains_num'] ?? 0),
'rank'=>(int)($data['Rank'] ?? 0),
'organic_keywords'=>(int)($data['Organic_Keywords'] ?? 0),
'organic_traffic'=>(int)($data['Organic_Traffic'] ?? 0),
'date'=>date('Y-m-d')
]);
}
}
... ...
... ... @@ -162,68 +162,51 @@ class DownloadProject extends Command
return ['file_link'=>url('upload/excel/'.$filename)];
}
// public function exportData($data){
// // 创建一个新的 Excel 电子表格实例
// $spreadsheet = new Spreadsheet();
// $sheet = $spreadsheet->getActiveSheet();
// // 添加表头
// $sheet->setCellValue('A1', '产品名称');
//// $sheet->setCellValue('B1', '产品短描述');
//// $sheet->setCellValue('C1', '产品内容');
//// $sheet->setCellValue('D1', '产品路由');
//// $sheet->setCellValue('E1', '产品分类');
//// $sheet->setCellValue('F1', '产品状态');
//// $sheet->setCellValue('G1', '产品主图');
//// $sheet->setCellValue('H1', '产品seo_title');
//// $sheet->setCellValue('I1', '产品seo_keyword');
//// $sheet->setCellValue('J1', '产品seo_title');
// $rowCount = 2;
// foreach ($data as $v) {
// $sheet->setCellValue('A' . $rowCount, $v['title']);
//// $sheet->setCellValue('B' . $rowCount, $v['intro']);
//// $sheet->setCellValue('C' . $rowCount, $v['content']);
//// $sheet->setCellValue('D' . $rowCount, $v['url']);
//// $sheet->setCellValue('E' . $rowCount, $v['category_id_text']);
//// $sheet->setCellValue('F' . $rowCount, '发布中');
//// $sheet->setCellValue('G' . $rowCount, $v['images']);
//// $sheet->setCellValue('H' . $rowCount, $v['seo_mate']['title']);
//// $sheet->setCellValue('I' . $rowCount, $v['seo_mate']['keyword']);
//// $sheet->setCellValue('J' . $rowCount, $v['seo_mate']['description']);
// $rowCount++;
// }
// // 创建一个新的 Excel Writer 对象
// $writer = new Xlsx($spreadsheet);
// $filename = time().'.xlsx';
// // 设置导出文件的保存路径和文件名
// $filePath = public_path('upload/excel/'.$filename);
// // 导出 Excel 文件
// $writer->save($filePath);
// echo date('Y-m-d H:i:s') . 'file_link:'.url('upload/excel/'.$filename) . PHP_EOL;
// // 返回导出文件的响应
// return ['file_link'=>url('upload/excel/'.$filename)];
// }
//
// public function downloadItem($filed = ['id','depth','created_at','referrer_url','url','device_port','country','ip']){
// $visitModel = new Visit();
// $page = 1;
// $pageSize = 3000;
// $lists = $visitModel->lists(['updated_date'=>['between',['2025-02-01','2025-02-31']]],$page,$pageSize,'id',$filed);
// foreach ($lists as $v){
// $customer_visit_id[] = $v['id'];
// }
// $itemModel = new VisitItem();
// $itemList = $itemModel->list(['customer_visit_id'=>['in',$customer_visit_id]],['customer_visit_id','url']);
// foreach ($lists as $key => $value){
// $sub = [];
// foreach ($itemList as $sonValue){
// if($value['id'] == $sonValue['customer_visit_id']){
// $sub[] = $sonValue;
// }
// }
// $value['sub'] = $sub;
// $lists[$key] = $value;
// }
// return $lists;
// }
/**
* @remark :导入产品
* @name :exportProductData
* @author :lyh
* @method :post
* @time :2025/6/30 16:46
*/
public function exportProductData($data){
// 创建一个新的 Excel 电子表格实例
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// 添加表头
$sheet->setCellValue('A1', '产品名称');
$sheet->setCellValue('B1', '产品短描述');
$sheet->setCellValue('C1', '产品内容');
$sheet->setCellValue('D1', '产品路由');
$sheet->setCellValue('E1', '产品分类');
$sheet->setCellValue('F1', '产品状态');
$sheet->setCellValue('G1', '产品主图');
$sheet->setCellValue('H1', '产品seo_title');
$sheet->setCellValue('I1', '产品seo_keyword');
$sheet->setCellValue('J1', '产品seo_title');
$rowCount = 2;
foreach ($data as $v) {
$sheet->setCellValue('A' . $rowCount, $v['title']);
$sheet->setCellValue('B' . $rowCount, $v['intro']);
$sheet->setCellValue('C' . $rowCount, $v['content']);
$sheet->setCellValue('D' . $rowCount, $v['url']);
$sheet->setCellValue('E' . $rowCount, $v['category_id_text']);
$sheet->setCellValue('F' . $rowCount, '发布中');
$sheet->setCellValue('G' . $rowCount, $v['images']);
$sheet->setCellValue('H' . $rowCount, $v['seo_mate']['title']);
$sheet->setCellValue('I' . $rowCount, $v['seo_mate']['keyword']);
$sheet->setCellValue('J' . $rowCount, $v['seo_mate']['description']);
$rowCount++;
}
// 创建一个新的 Excel Writer 对象
$writer = new Xlsx($spreadsheet);
$filename = time().'.xlsx';
// 设置导出文件的保存路径和文件名
$filePath = public_path('upload/excel/'.$filename);
// 导出 Excel 文件
$writer->save($filePath);
echo date('Y-m-d H:i:s') . 'file_link:'.url('upload/excel/'.$filename) . PHP_EOL;
// 返回导出文件的响应
return ['file_link'=>url('upload/excel/'.$filename)];
}
}
... ...
... ... @@ -41,40 +41,10 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
return $this->aggregate_keyword_affix();
}
/**
* @remark :获取数据
* @name :aggregate_keyword_affix
* @author :lyh
* @method :post
* @time :2025/6/26 17:58
*/
public function aggregate_keyword_affix(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,4,6]]], 'id', ['id']);
$keywordAffixModel = new AggregateKeywordAffix();
foreach ($lists as $val){
$info = $keywordAffixModel->read(['project_id'=>$val['id']]);
$prefix = "How To find"."\n"."Why Choose"."\n"."China Top"."\n"."Best Way To Choose"."\n"."Methods To Choose";
$suffix = "Manufacturer"."\n"."Supplier"."\n"."Products"."\n"."Factory";
if($info === false){
echo '执行的项目id:'.$val['id'].PHP_EOL;
$data = [
'project_id'=>$val['id'],
'prefix'=>$prefix,
'suffix'=>$suffix,
];
$keywordAffixModel->addReturnId($data);
}
}
return true;
}
public function _actionTemplateMain(){
$data = [];
$projectModel = new Project();
... ...
... ... @@ -260,7 +260,7 @@ class KeywordPageAiContent extends Command
'url' => [],
'language' => [],
];
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url' => $url, 'c_params' => $param]), date('Y-m-d H:i:s', time() + 300));
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, ['c_url' => $url, 'c_params' => $param], date('Y-m-d H:i:s', time() + 300));
echo getmypid() . ' ' . '更新中请稍后, 更新完成将会发送站内信通知更新结果!' . PHP_EOL;
}
}
... ...
<?php
/**
* @remark :
* @name :UpdateProjectTdk.php
* @author :lyh
* @method :post
* @time :2025/7/2 11:11
*/
namespace App\Console\Commands\Tdk;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\Com\NoticeLog;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use PhpOffice\PhpSpreadsheet\IOFactory;
use function Aws\default_http_handler;
class UpdateProjectTdk extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update_project_tdk';
/**
* The console command description.
*
* @var string
*/
protected $description = '根据给定的文件更新项目的tdk';
public function handle(){
$noticeLogModel = new NoticeLog();
while (true){
$task_id = $this->getTaskId();
if(empty($task_id)){
sleep(30);
continue;
}
$info = $noticeLogModel->read(['id'=>$task_id]);
if($info !== false){
echo 'start--'.PHP_EOL;
$project_id = $info['data']['project_id'] ?? 0;
if(empty($project_id)){
echo date('Y-m-d H:i:s').'未获取到项目id.'.PHP_EOL;
$noticeLogModel->edit(['status'=>$noticeLogModel::STATUS_FAIL],['id'=>$task_id]);
continue;
}
ProjectServer::useProject($project_id);
$url = $info['data']['url'] ?? '';
if(empty($url)){
echo date('Y-m-d H:i:s').'未获取到项目更新文件.项目id为:'.$project_id.PHP_EOL;
//未获取到文件,跳过
$noticeLogModel->edit(['status'=>$noticeLogModel::STATUS_FAIL],['id'=>$task_id]);
DB::disconnect('custom_mysql');
continue;
}
// 下载到 Laravel storage 的临时路径
$tempPath = storage_path('app/temp_url.xlsx');
file_put_contents($tempPath, file_get_contents($url));
// 载入 Excel
try {
$spreadsheet = IOFactory::load($tempPath);
$sheet = $spreadsheet->getActiveSheet();
$rows = $sheet->toArray();
unlink($tempPath);
}catch (\Exception $e){
echo '文件打不开'.PHP_EOL;
$noticeLogModel->edit(['status'=>$noticeLogModel::STATUS_FAIL],['id'=>$task_id]);
DB::disconnect('custom_mysql');
continue;
}
$dataRows = array_slice($rows, 1);
foreach ($dataRows as $item){
//获取路由
$route = trim($item[0],'/');
$route = basename($route);
$this->updateTdk($route,$item);
}
echo date('Y-m-d H:i:s').',end'.PHP_EOL;
$noticeLogModel->edit(['status'=>$noticeLogModel::STATUS_SUCCESS],['id'=>$task_id]);
DB::disconnect('custom_mysql');
}
}
return true;
}
/**
* @remark :获取任务id
* @name :getTaskId
* @author :lyh
* @method :post
* @time :2025/7/2 11:19
*/
public function getTaskId()
{
$task_id = Redis::rpop('update_project_tdk_task');
if (empty($task_id)) {
$noticeLogModel = new NoticeLog();
$ids = $noticeLogModel->selectField(['status'=>$noticeLogModel::STATUS_PENDING,'type'=>$noticeLogModel::TYPE_UPDATE_PROJECT_TDK],'id');
if(!empty($ids)){
foreach ($ids as $id) {
Redis::lpush('update_project_tdk_task', $id);
}
}
$task_id = Redis::rpop('update_project_tdk_task');
}
return $task_id;
}
/**
* @remark :更新tdk
* @name :updateTdk
* @author :lyh
* @method :post
* @time :2025/7/2 14:59
*/
public function updateTdk($route,$item){
$routeMapModel = new RouteMap();
$routeInfo = $routeMapModel->read(['route'=>$route]);
if($routeInfo === false){
return false;
}
switch ($routeInfo['source']){
case $routeMapModel::SOURCE_PRODUCT:
$productModel = new Product();
$productModel->edit(['seo_mate'=>json_encode(['title'=>$item[1],'description'=>$item[2],'keyword'=>$item[3]])],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_PRODUCT_CATE:
$productCategoryModel = new Category();
$productCategoryModel->edit(['seo_title'=>$item[1],'seo_des'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_PRODUCT_KEYWORD:
$productKeywordModel = new Keyword();
$productKeywordModel->edit(['seo_title'=>$item[1],'seo_description'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_BLOG:
$blogModel = new Blog();
$blogModel->edit(['seo_title'=>$item[1],'seo_description'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_BLOG_CATE:
$blogCateModel = new BlogCategory();
$blogCateModel->edit(['seo_title'=>$item[1],'seo_des'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_NEWS:
$newsModel = new News();
$newsModel->edit(['seo_title'=>$item[1],'seo_description'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_NEWS_CATE:
$newsCateModel = new NewsCategory();
$newsCateModel->edit(['seo_title'=>$item[1],'seo_des'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_MODULE:
$contentModel = new CustomModuleContent();
$contentModel->edit(['seo_title'=>$item[1],'seo_description'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
case $routeMapModel::SOURCE_MODULE_CATE:
$categoryModel = new CustomModuleCategory();
$categoryModel->edit(['seo_title'=>$item[1],'seo_description'=>$item[2],'seo_keywords'=>$item[3]],['id'=>$routeInfo['source_id']]);
break;
default:
break;
}
return true;
}
}
... ...
... ... @@ -260,7 +260,7 @@ class UpdateSeoTdk extends Command
'url' => [],
'language'=> [],
];
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$url,'c_params'=>$param]),date('Y-m-d H:i:s',time()+300));
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, ['c_url'=>$url,'c_params'=>$param],date('Y-m-d H:i:s',time()+300));
// http_post($url, json_encode($param));
echo getmypid() . ' ' . '更新中请稍后, 更新完成将会发送站内信通知更新结果!'. PHP_EOL;
}
... ...
... ... @@ -35,7 +35,7 @@ class UpdateSeoTdkCrontab extends Command
*/
public function handle()
{
$project_ids = Project::where('type', Project::TYPE_TWO)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
$project_ids = Project::where('type', Project::TYPE_TWO)->where('site_status',0)->where('extend_type',0)->where('delete_status',0)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
foreach ($project_ids as $project_id){
try {
ProjectUpdateTdk::add_task($project_id);
... ... @@ -44,7 +44,7 @@ class UpdateSeoTdkCrontab extends Command
}
}
$project_ids = Project::where('type', Project::TYPE_TWO)->where('tag_page_version', '>' ,1)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
$project_ids = Project::where('type', Project::TYPE_TWO)->where('site_status',0)->where('extend_type',0)->where('delete_status',0)->where('tag_page_version', '>' ,1)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
foreach ($project_ids as $project_id){
try {
ProjectKeywordAiTask::add_task($project_id);
... ...
... ... @@ -606,8 +606,8 @@ class Temp extends Command
*/
public function change_cname_projects()
{
$origin_server_id = 20;//原服务器
$target_server_id = 27;//目标服务器
$origin_server_id = 2;//原服务器
$target_server_id = 12;//目标服务器
$server_ip_model = new ServersIp();
... ...
... ... @@ -82,6 +82,7 @@ class FetchTicketProjects extends Command
'website' => $item['main_url'] ?? '',
'test_website' => $item['test_url'] ?? '',
'is_del' => 0,
'plan' => $item['plan'] ?? '',
];
if (!$project) {
$new = new TicketProject();
... ... @@ -174,12 +175,13 @@ class FetchTicketProjects extends Command
'is_del' => $is_del,
'website' => !empty($item->domainInfo->domain) ? 'https://'.$item->domainInfo->domain : '',
'test_website' => $item->deploy_build->test_domain ?? '',
'version' => $item->version,
'plan' => $item->planMap()[$item->deploy_build->plan] ?? '',
];
if (!$project) {
$project = new TicketProject();
$project->uuid = $uuid;
$project->post_id = $item->post_id;
$project->version = 6;
$project->table_id = $item->id;
foreach ($fields as $k => $v) {
$project->$k = $v;
... ...
... ... @@ -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);
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api\WorkOrder;
use App\Http\Controllers\Api\BaseController;
use App\Http\Requests\Api\WorkOrder\TicketListRequest;
use App\Http\Requests\Api\WorkOrder\TicketStoreRequest;
use App\Models\WorkOrder\TicketLog;
use App\Models\WorkOrder\TicketProject;
... ... @@ -17,8 +18,9 @@ class TicketController extends BaseController
*
* @return \Illuminate\Http\Response
*/
public function index($project_id, Request $request)
public function index(TicketListRequest $request, $project_id)
{
$validated = $request->validated();
$project = TicketProject::where('uuid', $project_id)->first();
if (!$project) return $this->error('未找到项目', 404);
$page = (int)$request->input('page', 1);
... ... @@ -30,6 +32,22 @@ class TicketController extends BaseController
])
->where('project_id', $project->id)
// ->where('submit_side', 2)
->when($request->input('status') !== null, function ($query) use ($request) {
// status 查 gl_tickets.status
$status = $request->input('status');
return $query->where('status', $status);
})
->when($request->input('search'), function ($query) use ($request) {
// search 查 gl_tickets.title 或 gl_ticket_projects.title 或 gl_ticket_projects.company_name
$search = $request->input('search');
return $query->where(function ($q) use ($search) {
$q->where('title', 'like', '%' . $search . '%')
->orWhereHas('project', function ($q1) use ($search) {
$q1->where('title', 'like', '%' . $search . '%')
->orWhere('company_name', 'like', '%' . $search . '%');
});
});
})
->orderBy('id', 'desc')
->paginate($size, ['*'], 'page', $page);
return response()->json(['data' => $tickets]);
... ...
... ... @@ -1259,4 +1259,23 @@ class ProjectController extends BaseController
NoticeLog::createLog(NoticeLog::TYPE_GENERATE_COUNT_CHARTS, ['project_id' => $this->param['project_id']]);
$this->response('success');
}
/**
* @remark :更新项目tdk
* @name :updateTdk
* @author :lyh
* @method :post
* @time :2025/7/2 11:04
*/
public function updateTdk(){
$this->request->validate([
'project_id'=>'required',
'url'=>'required'
],[
'project_id.required' => '项目id不能为空',
'url.required' => '文件路径不为空',
]);
NoticeLog::createLog(NoticeLog::TYPE_UPDATE_PROJECT_TDK, ['project_id' => $this->param['project_id'],'url'=>$this->param['url']]);
$this->response('success',Code::SUCCESS,['url'=>$this->param['url']]);
}
}
... ...
... ... @@ -8,6 +8,8 @@ use App\Http\Requests\Aside\WorkOrder\AsideTicketStoreRequest;
use App\Http\Requests\Aside\WorkOrder\AsideTicketListRequest;
use App\Http\Requests\Aside\WorkOrder\AsideTicketUpdateRequest;
use App\Http\Requests\Aside\WorkOrder\TicketProjectListRequest;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Models\Workchat\MessagePush;
use App\Models\WorkOrder\TicketLog;
use App\Models\WorkOrder\TicketProject;
use App\Models\WorkOrder\Tickets;
... ... @@ -216,4 +218,40 @@ class AsideTicketController extends BaseController
{
//
}
/**
* 手动触发,推送工单到企微群
*/
public function pushNotify($id)
{
$ticket = Tickets::find($id);
if (!$ticket) {
$this->response('工单不存在', Code::USER_MODEL_NOTFOUND_ERROE);
}
$project = $ticket->project;
if (empty($project->association)) {
$this->response('该工单没有绑定的企微群', Code::USER_MODEL_NOTFOUND_ERROE);
}
$message_push = new MessagePush();
$message_push->project_id = $project->table_id;
$message_push->friend_id = $project->association->friend_id;
$message_push->content_type = 'Link';
$message_push->content = json_encode([
'title' => '工单查看 - ' . $project->company_name,
'desc' => $ticket->title,
'size' => 0,
'thumbSize' => 0,
'thumbUrl' => 'https://oa.quanqiusou.cn/logo.ico',
'url' => 'https://oa.quanqiusou.cn/tickets?project_id='.$project->uuid
], JSON_UNESCAPED_UNICODE);
$message_push->send_time = now();
$message_push->type = MessagePush::TYPE_TICKET;
$message_push->save();
$ticket->ding = 1; // 标记为已推送
$ticket->save();
$this->response('success', Code::SUCCESS);
}
}
... ...
<?php
/**
* @remark :
* @name :AuthorityScoreController.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\BCom\AuthorityScoreLogic;
use Illuminate\Http\Request;
/**
* @remark :白帽版本报表
* @name :AuthorityScoreController
* @author :lyh
* @method :post
* @time :2025/7/1 11:12
*/
class AuthorityScoreController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new AuthorityScoreLogic();
}
/**
* @remark :豹猫数据统计表详情
* @name :whiteHatReportInfo
* @author :lyh
* @method :post
* @time :2025/7/1 11:13
*/
public function authorityScoreInfo(){
$this->request->validate([
'date'=>'required',
], [
'date.required' => '请选择报表时间',
]);
$data = $this->logic->LogicAuthorityScoreInfo();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -304,7 +304,7 @@ class CNoticeController extends BaseController
try {
http_post($c_url, json_encode($c_param));
}catch (\Exception $e){
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$c_param]));
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, ['c_url'=>$c_url,'c_params'=>$c_param]);
}
}
$this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
... ...
... ... @@ -75,6 +75,9 @@ class CustomModuleLogic extends BaseLogic
if(!isset($param['id']) || empty($param['id'])){
$param['project_id'] = $this->param['project_id'];
}
if(in_array($param['route'],['blogs','news','top_blog','blog','product','products'])){
$this->fail('不允许使用项目默认模块路由');
}
return $this->success($param);
}
... ...
<?php
/**
* @remark :
* @name :AuthorityScoreLogic.php
* @author :lyh
* @method :post
* @time :2025/7/1 11:15
*/
namespace App\Http\Logic\Bside\BCom;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiVideo;
use App\Models\AuthorityScore\AuthorityScore;
use App\Models\RankData\RankDataBmseo;
use App\Models\SeoSetting\LinkData;
/**
* @remark :白帽seo报表详情数据(权威评分)
* @name :AuthorityScoreLogic
* @author :lyh
* @method :post
* @time :2025/7/1 11:15
*/
class AuthorityScoreLogic 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 LogicAuthorityScoreInfo(){
$data = [];
$bSeoModel = new RankDataBmseo();
$bSeoInfo = $bSeoModel->read(['project_id'=>$this->user['project_id']],['updated_date','first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num']);
$data['rank'] = $bSeoInfo;
$authorityScoreModel = new AuthorityScore();
$data['authority_score'] = $authorityScoreModel->list(['project_id'=>$this->user['project_id']],'id',['*'],'desc',10);
$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->counts(['da_values'=>['between',[10,30]]]);
$data['link_data']['thirty_count'] = $linkDataModel->counts(['da_values'=>['between',[30,50]]]);
$data['link_data']['fifty_count'] = $linkDataModel->counts(['da_values'=>['>=',50]]);
return $this->success($data);
}
}
... ...
<?php
namespace App\Http\Requests\Api\WorkOrder;
use Illuminate\Foundation\Http\FormRequest;
class TicketListRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'status' => 'nullable|in:0,1,2,3|integer',
'search' => 'nullable|string', // 搜索关键词
'page' => 'nullable|integer',
'size' => 'nullable|integer',
];
}
}
... ...
<?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';
}
... ...
... ... @@ -3,6 +3,8 @@
namespace App\Models\AutoPull;
use App\Models\Base;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\Servers;
class AutoPullNotify extends Base
{
... ... @@ -10,24 +12,7 @@ class AutoPullNotify extends Base
public static function serversMap()
{
return [
1 => '硅谷云服务器',
25 => '硅谷建站服务器02',
15 => '硅谷IDC服务器01(6.0美服1)',
14 => '硅谷IDC服务器02(6.0美服2)',
21 => '硅谷IDC服务器03(6.0美服3)',
2 => '俄罗斯服务器',
12 => '俄罗斯IDC服务器01',
4 => '阿里云深圳服务器',
5 => '日本服务器',
8 => '香港服务器',
17 => '解析IP专用服务器',
22 => '白帽专属服务器01',
24 => '白帽专属服务器02',
23 => '西班牙服务器',
6 => '自建站服务器群',
27 => '硅谷建站服务器01',
];
return Servers::where('status', 0)->where('id', '!=', ServerConfig::SELF_TEST_ID)->pluck('server_name', 'id')->toArray();
}
public static function processMap()
... ...
... ... @@ -15,6 +15,7 @@ class NoticeLog extends Base
const TYPE_INIT_PROJECT = 'init_project';
const TYPE_INIT_KEYWORD_COMMENT = 'init_keyword_comment';//聚合页关键词评论
const TYPE_GENERATE_COUNT_CHARTS = 'generate_count_charts';//聚合页关键字图表生成
const TYPE_UPDATE_PROJECT_TDK = 'updated_project_tdk';//根据路由更新tdk
const TYPE_COPY_PROJECT = 'copy_project';
const TYPE_INIT_KEYWORD = 'init_keyword';
const DELETE_PRODUCT_CATEGORY = 'delete_product_category';
... ...
... ... @@ -20,7 +20,7 @@ class TicketLog extends Base
public function engineer()
{
return $this->belongsTo(Manage::class, 'engineer_id', 'id')
->select(['id', 'name']);
->select(['id', 'name', 'mobile']);
}
public function ticket()
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Models\WorkOrder;
use App\Models\Base;
use App\Models\Manage\Manage;
use App\Models\Project\Project;
use App\Models\ProjectAssociation\ProjectAssociation;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class TicketProject extends Base
... ... @@ -41,4 +42,15 @@ class TicketProject extends Base
return $this->hasOne(Manage::class, 'id', 'engineer_id')
->select(['id', 'name']);
}
/**
* 绑定的企微群
*/
public function association()
{
return $this->hasOne(ProjectAssociation::class, 'project_id', 'table_id')
->where('status', 1)
->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
->select(['id', 'project_id', 'friend_id', 'binding_app']);
}
}
... ...
... ... @@ -204,6 +204,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置
Route::any('/setIsParticiple', [Aside\Project\ProjectController::class, 'setIsParticiple'])->name('admin.project_setIsParticiple');//开启/关闭分词
Route::any('/saveSiteStatus', [Aside\Project\ProjectController::class, 'saveSiteStatus'])->name('admin.project_saveSiteStatus');
Route::any('/updateTdk', [Aside\Project\ProjectController::class, 'updateTdk'])->name('admin.project_updateTdk');//更新项目tdk
//获取关键词前缀和后缀
Route::prefix('keyword')->group(function () {
Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
... ... @@ -254,6 +255,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::post('/', [Aside\WorkOrder\AsideTicketController::class, 'store'])->name('admin.tickets.store')->summary('A端创建工单');
Route::get('/{id}', [Aside\WorkOrder\AsideTicketController::class, 'show'])->name('admin.tickets.show')->summary('A端工单详情');
Route::post('/{id}', [Aside\WorkOrder\AsideTicketController::class, 'update'])->name('admin.tickets.update')->summary('A端更新工单,审核,邀请同事');
Route::get('/pushNotify/{ticket_id}', [Aside\WorkOrder\AsideTicketController::class, 'pushNotify'])->name('admin.tickets.pushNotify')->summary('A端工单推送企微群');
Route::get('/projects/{search}', [Aside\WorkOrder\AsideTicketController::class, 'getProjects'])->name('admin.tickets.projects')->summary('A端V5V6项目列表');
Route::get('/v56_projects/list', [Aside\WorkOrder\AsideTicketController::class, 'projectList'])->name('admin.tickets.projectList')->summary('A端V5V6项目列表');
Route::post('/log/{id}', [Aside\WorkOrder\AsideTicketLogController::class, 'update'])->name('admin.tickets.log.update')->summary('A端工单操作日志更新,完成工单');
... ...
... ... @@ -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');
});
//白帽版本统计(SEMRUSH得分)
Route::prefix('authority_score')->group(function () {
Route::any('/authorityScoreInfo', [\App\Http\Controllers\Bside\BCom\AuthorityScoreController::class,'AuthorityScoreInfo'])->name('authority_score_AuthorityScoreInfo');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...