作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

正在显示 38 个修改的文件 包含 437 行增加91 行删除
... ... @@ -4,6 +4,7 @@ namespace App\Console\Commands\Ai;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogKeyword;
use App\Models\Ai\AiBlogOpenLog;
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
use App\Models\Project\Project;
... ... @@ -77,17 +78,25 @@ class AiBlogAutoPublish extends Command
$this->output("项目{$project->id}未到执行时间" . $next_auto_date);
continue;
}
//核心关键词+网站关键词+白帽关键词
$main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword');
$main_keywords = explode("\r\n", $main_keywords);
$seo_keywords = ProjectKeyword::where('project_id', $project->id)->value('seo_keywords');
$seo_keywords = explode("\r\n", $seo_keywords);
ProjectServer::useProject($project->id);
$site_keywords = WebSetting::where('project_id', $project->id)->value('keyword');
DB::disconnect('custom_mysql');
$site_keywords = explode(",", $site_keywords);
$keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords));
$keywords = array_map('trim', $keywords);
$aiKeywordModel = new AiBlogKeyword();
$keywords = $aiKeywordModel->getValue(['project_id'=>$project->id],'keywords');
if(empty($keywords)){
//核心关键词+网站关键词+白帽关键词
$main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword');
$main_keywords = explode("\r\n", $main_keywords);
$seo_keywords = ProjectKeyword::where('project_id', $project->id)->value('seo_keywords');
$seo_keywords = explode("\r\n", $seo_keywords);
ProjectServer::useProject($project->id);
$site_keywords = WebSetting::where('project_id', $project->id)->value('keyword');
DB::disconnect('custom_mysql');
$site_keywords = explode(",", $site_keywords);
$keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords));
$keywords = array_map('trim', $keywords);
}else{
$keywords = explode("\r\n", $keywords);
$keywords = array_map('trim', $keywords); // 清理空格
$keywords = array_filter($keywords); // 移除空值
}
if (empty($keywords)) {
$this->output("项目{$project->id}未获取到关键词");
continue;
... ...
... ... @@ -82,9 +82,10 @@ class RemainDay extends Command
$list = $projectModel->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','version','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day','geo_qualify_num']);
foreach ($list as $item){
$deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
$this->output('start->项目id:' . $item['id'],$item['id']);
//todo::暂停的项目停止计时
if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目
$this->output('暂停的项目id:' . $item['id'],$item['id']);
if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
$pause_days = $item['pause_days'] + 1;
}
... ... @@ -96,6 +97,8 @@ class RemainDay extends Command
}
//todo::优化项目中途达标计时切换为按天计时
if(in_array($item['id'],$this->projectSwitchId)){
$this->output('中途切换计时的项目id:' . $item['id'].',旧达标天数:'.$item['finish_remain_day'].',新达标天数:'.($item['finish_remain_day'] + 1),$item['id']);
$this->output('中途切换计时的项目id:' . $item['id'].',当前剩余服务时常:'.$item['remain_day'].',剩余时常:'.($item['remain_day'] - 1),$item['id']);
$this->project->edit(['remain_day'=>($item['remain_day'] - 1),'finish_remain_day'=>($item['finish_remain_day'] + 1)],['id'=>$item['id']]);
continue;
}
... ... @@ -103,7 +106,7 @@ class RemainDay extends Command
$this->seoRemainDay($deploy_build,$item);
//默认版本统计
$this->remainDay($item,$deploy_build);
echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
$this->output('end->项目id:' . $item['id']);
}
return true;
}
... ... @@ -121,14 +124,17 @@ class RemainDay extends Command
//白帽版本的系统
if($deploy_build['seo_plan'] != 0){
if($deploy_build['seo_service_duration'] != 0){
$this->output('白帽计算剩余服务时常:'.$item['id'],$item['id']);
if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){
$compliance_day = (int)$item['bm_finish_remain_day'];
$seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day'];
$this->output('按白帽达标天数统计:'.$item['id'].',bm达标天数:'.$item['bm_finish_remain_day'].',bm剩余白帽天数:'.$seo_remain_day,$item['id']);
}else{
//按自然日统计
$diff = time() - strtotime($item['uptime']);
$compliance_day = floor($diff / (60 * 60 * 24));
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
$this->output('按白帽自然日天数统计:'.$item['id'].',bm达标天数:'.$compliance_day.',bm剩余白帽天数:'.$seo_remain_day,$item['id']);
}
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}
... ... @@ -144,8 +150,10 @@ class RemainDay extends Command
* @time :2025/4/25 14:31
*/
public function remainDay($item,$deploy_build){
$this->output('普通项目计算剩余服务时常:'.$item['id'],$item['id']);
//默认版本统计
if($deploy_build['service_duration'] == 0){
if($deploy_build['service_duration'] == 0 || $deploy_build['plan'] == 0){
$this->output('当前项目跳过:'.$item['id'],$item['id']);
return false;
}
//默认版本计算剩余服务时常
... ... @@ -159,17 +167,21 @@ class RemainDay extends Command
$diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']);
$compliance_day = floor($diff / (60 * 60 * 24));
$remain_day = $deploy_build['service_duration'] - $compliance_day;
$this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']);
}else{
$compliance_day = ($item['finish_remain_day'] ?? 0);
//todo::7.5版本单独计算
if($item['version'] == 7.5 && $deploy_build['seo_plan'] != 0 && $deploy_build['plan'] != 0){
$geoCountModel = new GeoCount();
$is_qualify = $geoCountModel->where('project_id', $item['id'])->orderBy('id', 'desc')->value('is_qualify');
if($compliance_day > 0 && $is_qualify > 0){
$compliance_day = 1;
if($item['is_remain_today'] > 0 && $is_qualify > 0){
$remain_day = $item['remain_day'] - 1;
}
$this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']);
}else{
$remain_day = $deploy_build['service_duration'] - $compliance_day;
$this->output('优化项目:'.$item['id'].',剩余服务时常:'.$remain_day.',已达标天数:'.$compliance_day,$item['id']);
}
$remain_day = $deploy_build['service_duration'] - $compliance_day;
}
}else{
//普通建站项目
... ... @@ -182,11 +194,20 @@ class RemainDay extends Command
}
}
$extend_type = 0;
// if($remain_day < 0 && $deploy_build['service_duration'] != 0){
// $remain_day = 0;
// $extend_type = Project::TYPE_FIVE;
// }
$this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
return true;
}
/**
* 输入日志
* @param $message
* @return bool
*/
public function output($message,$project_id = 1)
{
$message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL;
echo $message;
file_put_contents(storage_path('logs/remain_day/') . $project_id . '.log', $message, FILE_APPEND);
return true;
}
}
... ...
... ... @@ -35,6 +35,7 @@ use App\Services\CosService;
use App\Services\Geo\GeoService;
use App\Services\MidJourneyService;
use App\Services\ProjectServer;
use Hashids\Hashids;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
... ... @@ -56,7 +57,7 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
return $this->translate_action();
return $this->_actionRoute();
}
public function _actionDa()
... ... @@ -113,21 +114,16 @@ class lyhDemo extends Command
*/
public function _actionRoute(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'is_ai_blog'=>1,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
$lists = $projectModel->list([], 'id', ['id']);
$data = [];
foreach ($lists as $item){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
ProjectServer::useProject($item['id']);
$aiBlogModel = new AiBlog();
$info = $aiBlogModel->read(['text'=>['like','%href="blog/%']],['id']);
if($info !== false){
echo '需要处理->项目id:'.$item['id'].PHP_EOL;
$data[] = $item['id'];
}
echo 'end';
DB::disconnect('custom_mysql');
$letters = range('A', 'X'); // 只取前 24 个字母(A ~ X)
$randomLetter = $letters[array_rand($letters)];
$data['post_id'] = $randomLetter.mt_rand(100000, 999999).$item['id'];
$projectModel->edit(['post_id'=>$data['post_id']],['id'=>$item['id']]);
}
dd($data);
return true;
}
public function _actionTemplateMain(){
... ...
... ... @@ -94,7 +94,6 @@ class CopyOldProject extends Command
if (in_array($table, [
'gl_customer_visit', 'gl_customer_visit_item',
'gl_inquiry_other', 'gl_inquiry_form_data', 'gl_inquiry_form',
'gl_ai_blog', 'gl_ai_blog_author', 'gl_ai_blog_list', 'gl_ai_blog_log'
])) {
continue;
}
... ...
... ... @@ -98,8 +98,9 @@ class CopyProject extends Command
$data['old_project_id'] = $old_project_id;
unset($data['id'],$data['exclusive_aicc_day'],$data['aicc'],$data['robots'],$data['is_translate_tag'],$data['is_translate'],$data['is_minor_languages'],$data['uptime']);
$project_id = $projectModel->insertGetId($data);
$data['post_id'] = mt_rand(100000, 999999).$project_id;
$hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890');
$projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]);
$projectModel->edit(['from_order_id'=>$hashids->encode($project_id),'post_id'=>$data['post_id']],['id'=>$project_id]);
//复制设置的模版
$settingTemplateModel = new Setting();
$settingData = $settingTemplateModel::where('project_id', $old_project_id)->first();
... ... @@ -217,6 +218,7 @@ class CopyProject extends Command
//创建数据库
ProjectServer::createDatabase($project);
//创建表
// ProjectServer::initTable();
$this->initTable($project_id,$new_project_id);
}
... ... @@ -244,38 +246,34 @@ class CopyProject extends Command
if (!$exists) {
@file_put_contents(
storage_path('logs/copy_mysql_error.log'),
"源库中不存在表:{$table}" . PHP_EOL,
date('Y-m-d H:i:s')."源库中不存在表:{$table}" . PHP_EOL,
FILE_APPEND
);
continue;
}
// 2. 删除目标数据库中的表
$result = DB::connection('custom_mysql')->statement("DROP TABLE IF EXISTS `{$table}`");
@file_put_contents(storage_path('logs/copy_mysql_error.log'), "删除旧表:{$table} => {$result}" . PHP_EOL, FILE_APPEND);
// 3. 复制建表 SQL
$sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE `{$table}`");
$createSql = get_object_vars($sql[0])['Create Table'];
$result1 = DB::connection('custom_mysql')->statement($createSql);
@file_put_contents(storage_path('logs/copy_mysql_error.log'), "创建表:{$table} => {$result1}" . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/copy_mysql_error.log'), date('Y-m-d H:i:s')."创建表:{$table} => {$result1}" . PHP_EOL, FILE_APPEND);
// 4. 跳过指定表
if (in_array($table, [
'gl_customer_visit', 'gl_customer_visit_item',
'gl_inquiry_other', 'gl_inquiry_form_data', 'gl_inquiry_form',
'gl_ai_blog', 'gl_ai_blog_author', 'gl_ai_blog_list', 'gl_ai_blog_log'
])) {
continue;
}
// 5. 插入数据前,再次确认源表存在(双保险)
if (!Schema::connection('custom_tmp_mysql_copy')->hasTable($table)) {
@file_put_contents(storage_path('logs/copy_mysql_error.log'), "插入数据前发现表不存在:{$table}" . PHP_EOL, FILE_APPEND);
continue;
}
// 6. 原生 SQL 插入数据(完全复制)
$insert_sql = "INSERT INTO `{$table}` SELECT * FROM `gl_data_{$project_id}`.`{$table}`";
try {
$result2 = DB::connection('custom_mysql')->statement($insert_sql);
@file_put_contents(storage_path('logs/copy_mysql_error.log'), "插入数据成功:{$table} => {$result2}" . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/copy_mysql_error.log'), date('Y-m-d H:i:s')."插入数据成功:{$table} => {$result2}" . PHP_EOL, FILE_APPEND);
} catch (\Exception $e) {
@file_put_contents(storage_path('logs/copy_mysql_error.log'),
"插入数据失败:{$table} => " . $e->getMessage() . PHP_EOL,
... ...
... ... @@ -264,7 +264,7 @@ class SyncProject extends Command
$data['project']['project_type'] = 1;//白帽版本
}
$id = $this->saveProject($data['project']);
$this->setPostId($data['deploy_build']['plan'] ?? 1,$id);
$this->setPostId($id);
$this->savePayment($data['payment'],$id);
$this->saveDeployBuild($data['deploy_build'],$id);
$this->saveDeployOptimize($data['deploy_optimize'],$id);
... ... @@ -320,13 +320,12 @@ class SyncProject extends Command
* @method :post
* @time :2023/8/9 14:47
*/
public function setPostId($plan,$id){
$length = strlen((string)$id); // 获取变量的位数
$paddingLength = Project::TYPE_FIVE - $length; // 计算填充前面的 0 的位数
$zeros = str_repeat("0", $paddingLength);
$number = Project::TYPE_SIX.$plan.$zeros.$id;
public function setPostId($id){
$letters = range('A', 'X'); // 只取前 24 个字母(A ~ X)
$randomLetter = $letters[array_rand($letters)];
$post_id = $randomLetter.mt_rand(100000, 999999).$id;
$projectModel = new Project();
$projectModel->edit(['post_id'=>$number],['id'=>$id]);
$projectModel->edit(['post_id'=>$post_id],['id'=>$id]);
return true;
}
... ...
... ... @@ -73,13 +73,24 @@ class SyncMobile extends Command
'type'=>$userModel::TYPE_ONE
]);
}
$info = $userModel->read(['mobile'=>$mobile,'project_id'=>5172],['id']);
if($info === false){
$userModel->add([
'mobile'=>$mobile,
'password'=>base64_encode(md5('123456')),
'project_id'=>5172,
'name'=>$mobile,
'type'=>$userModel::TYPE_ONE
]);
}
}
$saveData[] = '13083988828';
$managerModel = new Manage();
$mobileArr = $managerModel->selectField(['status'=>1],'mobile');
$saveData = array_values(array_unique(array_merge($saveData,$mobileArr)));
$userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$saveData]]);
$userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$saveData]]);
$userModel->edit(['status'=>1],['project_id'=>[1,5172],'mobile'=>['not in',$saveData]]);
$userModel->edit(['status'=>0],['project_id'=>[1,5172],'mobile'=>['in',$saveData]]);
//跟对应的5172项目写一份
}
echo 'end.'.PHP_EOL;
return true;
... ...
... ... @@ -33,9 +33,10 @@ class SyncTimeFiles extends Command
{
// $fileModel = new File();
$imagesModel = new Image();
$start = '2025-10-13 17:20:00';
// $start = '2025-10-14 00:00:00';
$start = '2025-10-25 00:00:00';
$end = '2025-10-31 23:59:59';
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'asc');
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'desc');
foreach ($lists as $v){
$path = $v['path'];
echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL;
... ...
... ... @@ -151,7 +151,7 @@ class InquiryController extends BaseController
}
$result = ReInquiryCount::where('domain', 'like', '%'.$domain.'%')->first();
if($result){
$result->tasks = $result->tasks; //调用访问器
$return = 0; //所有都关闭或删除就不返回
foreach ($result->tasks as $task){
$return += (!$task['is_del'] && $task['status']);
... ...
... ... @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
use App\Enums\Common\Common;
use App\Exceptions\AsideGlobalException;
use App\Http\Controllers\Controller;
use App\Models\Project\Project;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Exceptions\HttpResponseException;
... ... @@ -32,6 +33,7 @@ class BaseController extends Controller
{
$this->request = $request;
$this->param = $this->request->all();
$this->handleIdAndProjectId();
$this->token = $this->request->header('token');
$this->getParam();
$info = Cache::get(Common::MANAGE_TOKEN . $this->token);
... ... @@ -42,6 +44,42 @@ class BaseController extends Controller
}
}
/**
* @remark :project_id+id处理
* @name :handleIdAndProjectId
* @author :lyh
* @method :post
* @time :2025/11/6 09:16
*/
public function handleIdAndProjectId()
{
if(isset($this->param['id']) && !empty($this->param['id']) && !is_array($this->param['id'])){
if (preg_match('/^[A-Za-z]/', $this->param['id'])) {
$id = Cache::get('project_'.$this->param['id']);
if(empty($id)){
$projectModel = new Project();
$id = $projectModel->getValue(['post_id' => $this->param['id']],'id');
if(!empty($id)){
Cache::add('project_'.$this->param['id'], $id, 3600 * 12);
}
}
$this->param['id'] = $id;
}
}
if(isset($this->param['project_id']) && !empty($this->param['project_id']) && !is_array($this->param['project_id'])){
if (preg_match('/^[A-Za-z]/', $this->param['project_id'])) {
$id = Cache::get('project_'.$this->param['project_id']);
if(empty($id)){
$projectModel = new Project();
$id = $projectModel->getValue(['post_id' => $this->param['project_id']],'id');
if(!empty($id)){
Cache::add('project_'.$this->param['project_id'], $id, 3600 * 12);
}
}
$this->param['project_id'] = $id;
}
}
}
/**
* @remark :请求参数处理
... ...
... ... @@ -82,13 +82,15 @@ class GeoConfirmController extends BaseController
public function saveInfo()
{
$this->request->validate([
'id' => 'required',
'project_id'=>'required',
'confirm' => 'required',
'confirm_num' => 'required',
'type' => 'required',
], [
'id.required' => '主键id不能为空',
'project_id.required' => '主键id不能为空',
'confirm.required' => '客户确认内容不能为空',
'confirm_num.max' => '客户确认数量不能为空',
'type.max' => '类型不能为空',
]);
$data = $this->logic->saveConfirmInfo();
$this->response('success', Code::SUCCESS, $data);
... ...
... ... @@ -41,7 +41,7 @@ class ManageEntryPositionController extends BaseController
*/
public function lists()
{
$data = $this->logic->listEntryPosition();
$data = $this->logic->listEntryPosition($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -63,6 +63,7 @@ class OnlineController extends BaseController
'gl_project.title AS title',
'gl_project.channel AS channel',
'gl_project.type AS type',
'gl_project.post_id AS post_id',
'gl_project.created_at AS created_at',
'gl_project.is_upgrade AS is_upgrade',
'gl_project_online_check.id AS online_check_id',
... ...
... ... @@ -197,6 +197,7 @@ class OptimizeController extends BaseController
'gl_project.level AS level',
'gl_project.channel AS channel',
'gl_project.company AS company',
'gl_project.post_id AS post_id',
'gl_project.type AS type',
'gl_project.created_at AS created_at',
'gl_project.is_language AS is_language',
... ... @@ -267,8 +268,10 @@ class OptimizeController extends BaseController
$query = $query->where('gl_project.site_status',$this->map['site_status']);
}
if(isset($this->map['seo_plan'])){
if(is_array($this->map['seo_plan'])){
$query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan']);
if($this->map['seo_plan'] == 0){
$query = $query->where('gl_project_deploy_build.plan','!=',0);
}elseif(is_array($this->map['seo_plan'])){
$query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan'])->where('gl_project_deploy_build.plan',0);
}else{
$query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']);
}
... ... @@ -289,7 +292,7 @@ class OptimizeController extends BaseController
$query = $query->whereRaw("FIND_IN_SET(?, gl_project.level) > 0", [$this->map['level']]);
}
if(isset($this->map['online_updated_at']) && !empty($this->map['online_updated_at']) && is_array($this->map['online_updated_at'])){
$query = $query->where('gl_project_deploy_optimize.start_date','>=' ,$this->map['online_updated_at'][0])->where('gl_project_deploy_optimize.start_date','<' ,$this->map['online_updated_at'][1]);
$query = $query->where('gl_project_deploy_optimize.start_date','>=' ,$this->map['online_updated_at'][0])->where('gl_project_deploy_optimize.start_date','<=' ,$this->map['online_updated_at'][1]);
}
if(isset($this->map['special'])){
$query = $query->whereRaw("FIND_IN_SET(?, gl_project_deploy_optimize.special) > 0", [$this->map['special']]);
... ...
... ... @@ -96,6 +96,7 @@ class ProjectController extends BaseController
'gl_project.title AS title',
'gl_project.channel AS channel',
'gl_project.company AS company',
'gl_project.post_id AS post_id',
'gl_project.type AS type',
'gl_project.project_type AS project_type',
'gl_project.extend_type AS extend_type',
... ... @@ -512,12 +513,7 @@ class ProjectController extends BaseController
*/
public function info(ProjectLogic $logic)
{
$this->request->validate([
'id' => 'required'
], [
'id.required' => 'ID不能为空'
]);
$data = $logic->getProjectInfo($this->param['id']);
$data = $logic->getProjectInfo();
$this->response('success', Code::SUCCESS, $data);
}
... ...
... ... @@ -32,7 +32,7 @@ class RenewProjectController extends BaseController
*/
public function lists(Project $project){
$map = $this->searchParam($this->map);
$filed = ['id', 'title', 'type' ,'mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at','delete_status'];
$filed = ['id', 'title', 'type' , 'post_id','mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at','delete_status'];
$lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build')
->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
if(!empty($lists)){
... ...
<?php
/**
* @remark :
* @name :AiBlogKeywordController.php
* @author :lyh
* @method :post
* @time :2025/11/4 14:35
*/
namespace App\Http\Controllers\Bside\Ai;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Ai\AiBlogKeywordLogic;
use Illuminate\Http\Request;
class AiBlogKeywordController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new AiBlogKeywordLogic();
}
/**
* @remark :获取关键词详情
* @name :getKeywordInfo
* @author :lyh
* @method :post
* @time :2025/11/4 14:35
*/
public function getKeywordInfo()
{
$data = $this->logic->getKeywordInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存对应关键词
* @name :saveKeyword
* @author :lyh
* @method :post
* @time :2025/11/4 14:35
*/
public function saveKeyword()
{
$this->request->validate([
'keywords'=>['required'],
],[
'keywords.required' => 'keywords不能为空',
]);
$data = $this->logic->saveKeyword();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -5,6 +5,8 @@ namespace App\Http\Controllers\Bside\HomeCount;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\HomeCount\CountLogic;
use App\Models\Project\Project;
class CountController extends BaseController
{
const STATUS_ERROR = 400;
... ... @@ -38,4 +40,16 @@ class CountController extends BaseController
$data['enterprise_service'] = $countLogic->enterprise_service();
return $this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :
* @name :info5172count
* @author :lyh
* @method :post
* @time :2025/11/6 15:10
*/
public function info5172count()
{
}
}
... ...
... ... @@ -227,7 +227,8 @@ class RankDataController extends BaseController
$rand = array_rand($ips, 3);
foreach ($rand as $val) {
$rand_key = array_rand($ips[$val], 1);
$urls[] = 'http://' . $ips[$val][$rand_key] . '/search/?q=' . $param['keyword'];
// https://www.quanqiusou.cn/search/?ip=64.34.204.224&q=China%20Bollard
$urls[] = 'https://www.quanqiusou.cn/search/?ip=' . $ips[$val][$rand_key] . '&q=' . $param['keyword'];
}
$data['urls'] = $urls;
$this->response('success',Code::SUCCESS,$data);
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\SeoSetting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\SeoSetting\LinkDataLogic;
use App\Models\Geo\GeoLink;
use App\Models\SeoSetting\LinkData;
class LinkDataController extends BaseController
... ... @@ -23,7 +24,11 @@ class LinkDataController extends BaseController
* @method :post
* @time :2025/3/14 16:33
*/
public function lists(LinkData $linkData){
public function lists(GeoLink $linkData){
if(!isset($this->map['type']) || empty($this->map['type'])){
$this->map['type'] = $linkData::TYPE_LINK;
}
$this->map['project_id'] = $this->user['project_id'];
$lists = $linkData->lists($this->map,$this->page,$this->row);
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -35,7 +40,7 @@ class LinkDataController extends BaseController
* @method :post
* @time :2025/3/14 17:41
*/
public function info(LinkData $linkData){
public function info(GeoLink $linkData){
$this->request->validate([
'id'=>['required'],
],[
... ... @@ -69,7 +74,7 @@ class LinkDataController extends BaseController
* @method :post
* @time :2025/3/14 16:45
*/
public function del(LinkData $linkData){
public function del(GeoLink $linkData){
$this->request->validate([
'id'=>'required|array',
],[
... ...
... ... @@ -12,6 +12,7 @@ use App\Services\CosService;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Cache;
use function RingCentral\Psr7\str;
class FileController
{
... ... @@ -365,7 +366,10 @@ class FileController
public function setUrl(){
//A端上传
if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
$this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
$this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
$this->path = $this->path.'/'.$this->cache['project_id'];
}
}else{
//B端上传,upload_method 为 1时 强制上传到本地
if(!isset($this->param['upload_method'])) {
... ...
... ... @@ -286,6 +286,9 @@ class ImageController extends Controller
* @time :2023/7/19 16:38
*/
public function saveMysql(&$imageModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = '', $name=''){
if(strpos($mime, 'image') !== false){
}
$data = [
'path' => $this->path.'/'.$fileName,
'created_at' => date('Y-m-d H:i:s',time()),
... ... @@ -510,6 +513,9 @@ class ImageController extends Controller
//A端上传
if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
$this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
$this->path = $this->path.'/'.$this->cache['project_id'];
}
}else{
//TODO::设置上传文件大小(B端上传)
$max = config('upload.default_b_image')['size']['max'];
... ... @@ -778,7 +784,6 @@ class ImageController extends Controller
}
$info['domain'] = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';
}
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Logic\Aside;
use App\Enums\Common\Common;
use App\Http\Logic\Logic;
use App\Models\Project\Project;
use Illuminate\Support\Facades\Cache;
/**
... ... @@ -37,6 +38,45 @@ class BaseLogic extends Logic
*/
public function getParam(){
$requestAll = $this->request->all();
$requestAll = $this->handleIdAndProjectId($requestAll);
return $this->success($requestAll);
}
/**
* @remark :处理project参数
* @name :handleIdAndProjectId
* @author :lyh
* @method :post
* @time :2025/11/6 10:41
*/
public function handleIdAndProjectId($param)
{
if(isset($param['id']) && !empty($param['id']) && !is_array($param['id'])){
if (preg_match('/^[A-Za-z]/', $param['id'])) {
$id = Cache::get('project_'.$param['id']);
if(empty($id)){
$projectModel = new Project();
$id = $projectModel->getValue(['post_id' => $param['id']],'id');
if(!empty($id)){
Cache::add('project_'.$param['id'], $id, 3600 * 12);
}
}
$param['id'] = $id;
}
}
if(isset($param['project_id']) && !empty($param['project_id']) && !is_array($param['project_id'])){
if (preg_match('/^[A-Za-z]/', $param['project_id'])) {
$id = Cache::get('project_'.$param['project_id']);
if(empty($id)){
$projectModel = new Project();
$id = $projectModel->getValue(['post_id' => $param['project_id']],'id');
if(!empty($id)){
Cache::add('project_'.$param['project_id'], $id, 3600 * 12);
}
}
$param['project_id'] = $id;
}
}
return $param;
}
}
... ...
... ... @@ -84,7 +84,13 @@ class GeoConfirmLogic extends BaseLogic
public function saveConfirmInfo()
{
$this->param['status'] = GeoConfirm::STATUS_FINISH;
$this->model->edit($this->param,['id'=>$this->param['id']]);
return $this->success(['id'=>$this->param['id']]);
$info = $this->model->read(['project_id' => $this->param['project_id'],'type'=>$this->param['type']]);
if($info === false){
$id = $this->model->addReturnId($this->param);
}else{
$id = $info['id'];
$this->model->edit($this->param,['id'=>$info['id']]);
}
return $this->success(['id'=>$id]);
}
}
... ...
... ... @@ -39,11 +39,13 @@ class GeoLinkLogic extends BaseLogic
* @time :2025/7/14 16:47
*/
public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){
$filed = ['*'];
if(isset($map['url']) && !empty($map['url'])){
$map['url'] = ['like','%'.$map['url'].'%'];
}
$lists = $this->model->lists($map,$page,$row,$order,$filed);
if(!isset($map['type']) || empty($map['type'])){
$map['type'] = GeoLink::TYPE_NEWS;
}
$lists = $this->model->lists($map,$page,$row,$order,['*']);
return $this->success($lists);
}
... ...
... ... @@ -11,6 +11,7 @@ namespace App\Http\Logic\Aside\Geo;
use App\Console\Commands\Geo\GeoQuestionRes;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoArticle;
use App\Models\Geo\GeoConf;
use App\Models\Geo\GeoLink;
use App\Models\Geo\GeoQuestion;
... ... @@ -120,9 +121,11 @@ class GeoLogic extends BaseLogic
if(empty($geo_question_count)){
$geo_question_count = 0;
}
$geo_pr_count = GeoLink::where('project_id',$this->param['project_id'])->count();
$geo_pr_count = GeoLink::where('project_id',$this->param['project_id'])->where('type',GeoLink::TYPE_NEWS)->count();
$geo_link_count = GeoLink::where('project_id',$this->param['project_id'])->where('type',GeoLink::TYPE_LINK)->count();
$geo_writings_count = GeoWritings::where('project_id',$this->param['project_id'])->count();
return $this->success(['geo_writings_count'=>$geo_writings_count,'geo_pr_count'=>$geo_pr_count,'geo_question_count'=>$geo_question_count]);
$geo_writings_count += GeoArticle::where('project_id',$this->param['project_id'])->count();
return $this->success(['geo_writings_count'=>$geo_writings_count,'geo_pr_count'=>$geo_pr_count,'geo_question_count'=>$geo_question_count,'geo_link_count'=>$geo_link_count]);
}
}
... ...
... ... @@ -10,6 +10,7 @@
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoLink;
use App\Models\Project\EnterpriseProduct;
use App\Models\SeoSetting\LinkData;
use App\Services\ProjectServer;
... ... @@ -56,8 +57,7 @@ class EnterpriseProductLogic extends BaseLogic
* @time :2025/4/2 9:08
*/
public function saveLinkData(){
ProjectServer::useProject($this->param['project_id']);
$linkModel = new LinkData();
$linkModel = new GeoLink();
$data = [];
$count = count($this->param['data']);
$error_num = 0;
... ... @@ -68,14 +68,15 @@ class EnterpriseProductLogic extends BaseLogic
}
$data[] = [
'url'=>$v['url'],
'type'=>$linkModel::TYPE_LINK,
'da_values'=>$v['da_values'],
'project_id'=>$this->param['project_id'],
'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s')
];
}
if(!empty($data)){
$linkModel->insertAll($data);
}
DB::disconnect('custom_mysql');
return $this->success(['success'=>$count,'error'=>$error_num]);
}
}
... ...
... ... @@ -86,9 +86,14 @@ class ProjectLogic extends BaseLogic
* @method :post
* @time :2023/7/28 17:11
*/
public function getProjectInfo($id){
$info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check',
'project_after','inquiry_filter_config','web_traffic_config','project_keyword'])->where(['id'=>$id])->first()->toArray();
public function getProjectInfo($id = ''){
if(!empty($id)){
$query = $this->model->formatQuery(['id'=>$id]);
}else{
$query = $this->model->formatQuery($this->param);
}
$info = $query->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check',
'project_after','inquiry_filter_config','web_traffic_config','project_keyword'])->first()->toArray();
$info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0);
$info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain'];
if($info['extend_type'] != 0){
... ... @@ -116,13 +121,13 @@ class ProjectLogic extends BaseLogic
}
//is_product:"0",is_news:"0",is_blogs:"0",is_module:"0"
//获取小语种
$info['minor_languages'] = $this->getProjectMinorLanguages($id);
$info['minor_languages'] = $this->getProjectMinorLanguages($info['id']);
//升级项目采集完成时间
$info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
$info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($info['id']) : '';
//升级项目采集的测试站域名
$info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($id) : '';
$info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($info['id']) : '';
//获取项目所属行业
$info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
$info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $info['id'])->pluck('industry_id')->toArray();
return $this->success($info);
}
... ...
<?php
/**
* @remark :
* @name :AiBlogKeywordLogic.php
* @author :lyh
* @method :post
* @time :2025/11/4 14:37
*/
namespace App\Http\Logic\Bside\Ai;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlogKeyword;
use App\Models\Project\ProjectKeyword;
use App\Models\WebSetting\WebSetting;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class AiBlogKeywordLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new AiBlogKeyword();
}
/**
* @remark :获取当前详情
* @name :getKeywordInfo
* @author :lyh
* @method :post
* @time :2025/11/4 14:39
*/
public function getKeywordInfo()
{
$data = $this->model->read(['project_id'=>$this->user['project_id']]);
if($data === false){
//核心关键词+网站关键词+白帽关键词
$main_keywords = ProjectKeyword::where('project_id', $this->user['project_id'])->value('main_keyword');
$main_keywords = explode("\r\n", $main_keywords);
$seo_keywords = ProjectKeyword::where('project_id', $this->user['project_id'])->value('seo_keywords');
$seo_keywords = explode("\r\n", $seo_keywords);
$site_keywords = WebSetting::where('project_id', $this->user['project_id'])->value('keyword');
$site_keywords = explode(",", $site_keywords);
$keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords));
$keywords = array_map('trim', $keywords);
$keywords_string = implode("\n", $keywords);
$data = [
'project_id'=>$this->user['project_id'],
'keywords'=>$keywords_string
];
}
return $this->success($data);
}
/**
* @remark :
* @name :saveKeyword
* @author :lyh
* @method :post
* @time :2025/11/4 14:52
*/
public function saveKeyword()
{
$data = $this->model->read(['project_id'=>$this->user['project_id']]);
if($data !== false){
$id = $data['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
}
... ...
... ... @@ -24,6 +24,9 @@ class GeoQuestionResLogic extends BaseLogic
parent::__construct();
$this->model = new GeoQuestionResult();
$this->param = $this->requestAll;
if($this->user['project_id'] == 5172){
$this->user['project_id'] = 3298;
}
}
/**
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RankData\RankData as RankDataModel;
use App\Models\Service\Service;
use App\Services\ProjectServer;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
... ... @@ -26,16 +27,20 @@ class CountLogic extends BaseLogic
{
parent::__construct();
$this->model = new Count();
if($this->user['project_id'] == 5172){
$this->user['project_id'] = 3298;
}
}
/**
* @name :(昨日统计数据)yesterday_count
* @name :昨日统计数据 yesterday_count
* @author :lyh
* @method :post
* @time :2023/5/23 17:30
*/
public function yesterday_count(){
$yesterday = Carbon::yesterday()->toDateString();
$param = [
'date' => $yesterday,
'project_id' => $this->user['project_id']
... ... @@ -86,6 +91,7 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 13:33
*/
public function total_count($inquiry_num = ''){
ProjectServer::useProject($this->user['project_id']);
$pv = (new VisitItem())->count();
$ip = (new Visit())->count();
$data = [
... ... @@ -199,6 +205,7 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 15:56
*/
public function access_country_count(){
$customerVisitModel = new Visit();
$data = $customerVisitModel->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
->groupBy('country')
... ...
... ... @@ -40,6 +40,15 @@ use Illuminate\Support\Str;
class RankDataLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
if($this->user['project_id'] == 5172){
$this->user['project_id'] = 3298;
}
}
/**
* 统计数据
* @author zbj
... ...
... ... @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Geo\DomainDa;
use App\Models\Geo\GeoLink;
use App\Models\SeoSetting\LinkData;
use App\Services\Geo\GeoService;
use Illuminate\Support\Carbon;
... ... @@ -29,7 +30,7 @@ class LinkDataLogic extends BaseLogic
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new LinkData();
$this->model = new GeoLink();
}
/**
... ... @@ -46,6 +47,8 @@ class LinkDataLogic extends BaseLogic
$data[] = [
'url'=>$v['url'],
'da_values'=>$v['da_values'],
'type'=>GeoLink::TYPE_LINK,
'project_id'=>$this->user['project_id'],
'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s')
];
}
... ...
<?php
/**
* @remark :
* @name :AiBlogKeyword.php
* @author :lyh
* @method :post
* @time :2025/11/4 14:26
*/
namespace App\Models\Ai;
use App\Models\Base;
class AiBlogKeyword extends Base
{
protected $table = 'gl_ai_blog_keyword';
}
... ...
... ... @@ -36,7 +36,9 @@ class GeoConf extends Base
if (empty($optimize)) {
$optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray();
$optimize[11] = '陶婵';
$optimize[207] = '吴雨静';
$optimize[875] = '艾媛媛';
$optimize[893] = '杨汀';
ksort($optimize);
Cache::put($key, $optimize, 3600);
}
... ...
... ... @@ -20,5 +20,8 @@ use App\Models\Base;
*/
class GeoLink extends Base
{
const TYPE_NEWS = 1;//权威新闻
const TYPE_LINK = 2;//外链数据
protected $table = 'gl_geo_link';
}
... ...
... ... @@ -541,6 +541,11 @@ class SyncSubmitTaskService
{
throw new InquiryFilterException( '被刷数据');
}
//3006 温州耐保锁 荷兰的定制表单蔽掉 --徐莹
if($project_id == 3006 && in_array($data['country']??'', ['荷兰']))
{
throw new InquiryFilterException( '被刷数据');
}
//数据都是空的
$is_all_empty = true;
... ...
... ... @@ -777,6 +777,11 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/deleteFaq', [\App\Http\Controllers\Bside\Setting\SettingFaqController::class,'deleteFaq'])->name('faq_deleteFaq');
Route::any('/getInfo', [\App\Http\Controllers\Bside\Setting\SettingFaqController::class,'getInfo'])->name('faq_getInfo');
});
//ai_blog随机关键词
Route::prefix('ai_blog_keyword')->group(function () {
Route::any('/getKeywordInfo', [\App\Http\Controllers\Bside\Ai\AiBlogKeywordController::class,'getKeywordInfo'])->name('ai_blog_keyword_getKeywordInfo');
Route::any('/saveKeyword', [\App\Http\Controllers\Bside\Ai\AiBlogKeywordController::class,'saveKeyword'])->name('ai_blog_keyword_saveKeyword');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...