作者 刘锟

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

... ... @@ -2,6 +2,7 @@
namespace App\Console\Commands\Domain;
use App\Models\Geo\GeoCount;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
... ... @@ -58,41 +59,31 @@ class RemainDay extends Command
*/
protected $description = '网站服务剩余时长';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
$this->project = new Project();
$this->deployBuild = new DeployBuild();
parent::__construct();
}
/**
* @return bool
*/
public function handle()
{
$this->saveRemainDay();
$this->_action();
return true;
}
/**
* @remark :普通项目剩余服务时常
* @name :saveRemainDay
* @remark :计算剩余服务时常
* @name :_action
* @author :lyh
* @method :post
* @time :2025/4/2 10:48
* @time :2025/11/4 10:59
*/
public function saveRemainDay(){
$list = $this->project->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','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day']);
public function _action(){
$projectModel = new Project();
$deployBuildModel = new DeployBuild();
$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;
$deploy_build = $this->deployBuild->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
//todo::暂停的项目停止计时
if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目
if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
$pause_days = $item['pause_days'] + 1;
... ... @@ -111,15 +102,14 @@ class RemainDay extends Command
//白帽版本单独计算
$this->seoRemainDay($deploy_build,$item);
//默认版本统计
if($deploy_build['service_duration'] == 0){
continue;
}
$this->remainDay($item,$deploy_build);
echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
}
return true;
}
/**
* @remark :白帽版本单独计算
* @name :seoRemainDay
... ... @@ -140,13 +130,7 @@ class RemainDay extends Command
$compliance_day = floor($diff / (60 * 60 * 24));
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
}
if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}else{
//同时包括白帽版本+默认版本的项目
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}
}
}
return true;
... ... @@ -160,6 +144,10 @@ class RemainDay extends Command
* @time :2025/4/25 14:31
*/
public function remainDay($item,$deploy_build){
//默认版本统计
if($deploy_build['service_duration'] == 0){
return false;
}
//默认版本计算剩余服务时常
if($item['type'] == Project::TYPE_TWO || $item['type'] == Project::TYPE_FOUR){
if(in_array($item['id'],$this->projectId)){//已开始优化的时间结算
... ... @@ -173,6 +161,14 @@ class RemainDay extends Command
$remain_day = $deploy_build['service_duration'] - $compliance_day;
}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;
}
}
$remain_day = $deploy_build['service_duration'] - $compliance_day;
}
}else{
... ...
... ... @@ -38,12 +38,11 @@ class SyncFile extends Command
}else{
$code = $this->synchronizationFile($v['path']);
}
echo date('Y-m-d H:i:s') . 'code:'. $code . PHP_EOL;
if((int)$code == 200){
echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
$errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
}
// echo date('Y-m-d H:i:s') . 'code:'. $code . PHP_EOL;
// if((int)$code == 200){
// echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
// $errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
// }
}
echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
return true;
... ... @@ -60,7 +59,7 @@ class SyncFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ... @@ -69,7 +68,7 @@ class SyncFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.s3')['cdn'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
}
... ...
... ... @@ -40,9 +40,9 @@ class SyncProjectFile extends Command
}else{
$code = $this->synchronizationFile($v['path']);
}
if((int)$code == 200){
// if((int)$code == 200){
echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
}
// }
}
echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
return true;
... ... @@ -59,7 +59,7 @@ class SyncProjectFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ... @@ -68,7 +68,7 @@ class SyncProjectFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.s3')['cdn'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
}
... ...
... ... @@ -33,18 +33,13 @@ class SyncTimeFiles extends Command
{
// $fileModel = new File();
$imagesModel = new Image();
$start = '2025-08-28 00:00:00';
$end = '2025-08-29 23:59:59';
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]]);
$start = '2025-10-13 17:20:00';
$end = '2025-10-31 23:59:59';
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'asc');
foreach ($lists as $v){
$path = $v['path'];
echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL;
$code = $this->synchronizationFile($path);
if(200 != (int)$code){
echo date('Y-m-d H:i:s') . ' | 错误状态:' . $code . PHP_EOL;
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
echo date('Y-m-d H:i:s') . ' | ok:' . $code . PHP_EOL;
}
return true;
... ... @@ -52,9 +47,7 @@ class SyncTimeFiles extends Command
public function synchronizationFile($path_name){
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...
... ... @@ -52,11 +52,6 @@ class SyncTimeMinuteFile extends Command
// continue;
// }
$code = $this->synchronizationFile($path);
if(200 != (int)$code){
echo date('Y-m-d H:i:s') . ' | 错误状态:' . $code . PHP_EOL;
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
echo date('Y-m-d H:i:s') . ' | ok:' . $code . PHP_EOL;
}
return true;
... ... @@ -66,7 +61,7 @@ class SyncTimeMinuteFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...
... ... @@ -32,11 +32,6 @@ class SyncVideo extends Command
$path = $this->argument('path');
$code = $this->synchronizationFile($path);
echo date('Y-m-d H:i:s') . ' | ' . $code . PHP_EOL;
if(200 != (int)$code){
echo date('Y-m-d H:i:s') . ' | ' . $code . PHP_EOL;
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
return true;
}
... ... @@ -44,7 +39,7 @@ class SyncVideo extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...
<?php
/**
* @remark :
* @name :ManageEntryPositionController.php
* @author :lyh
* @method :post
* @time :2025/11/3 17:13
*/
namespace App\Http\Controllers\Aside\Manage;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Manage\ManageEntryPositionLogic;
use Illuminate\Http\Request;
/**
* @remark :岗位管理
* @name :ManageEntryPositionController
* @author :lyh
* @method :post
* @time :2025/11/3 17:13
*/
class ManageEntryPositionController extends BaseController
{
/**
* @param Request $request
*/
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new ManageEntryPositionLogic();
}
/**
* @remark :列表数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/11/3 17:20
*/
public function lists()
{
$data = $this->logic->listEntryPosition();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/11/3 17:20
*/
public function save()
{
$this->request->validate([
'name'=>'required'
],[
'name.required' => 'name不能为空'
]);
$data = $this->logic->saveEntryPosition();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2025/11/3 17:20
*/
public function del()
{
$this->request->validate([
'id'=>'required|array'
],[
'id.required' => 'ID不能为空'
]);
$data = $this->logic->delEntryPosition();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\Geo\GeoLink;
use App\Models\Geo\GeoQuestion;
use App\Models\Geo\GeoWritings;
use App\Models\Manage\ManageHr;
use App\Models\Project\DeployBuild;
use App\Models\Project\KeywordPrefix;
use App\Models\Project\Project;
... ... @@ -48,15 +49,19 @@ class GeoLogic extends BaseLogic
$project_geo_conf = $projectModel->read(['id' => $project_id],['title', 'version', 'geo_status', 'geo_qualify_num']);
$geoConfModel = new GeoConf();
$geo_conf = $geoConfModel->read(['project_id' => $project_id]);
$deployModel = new DeployBuild();
$seo_plan = $deployModel->getValue(['project_id'=>$project_id],'seo_plan');
$seo_plan_name = ($projectModel::seoMap()[$seo_plan]) ?? '无选择';
$geo_conf['seo_plan_name'] = $seo_plan_name;
if($geo_conf === false){//数据未初始化
$geo_conf = [
'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>''
'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>'','seo_plan_name'=>$seo_plan_name
];
}
//负责人集合
$geo_manage_list = $geoConfModel->geoManage();
// geo配置管理员,已经移除管理员列表,补充管理员信息
if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
if ($geo_conf && isset($geo_conf['manager_id']) && empty($geo_manage_list[$geo_conf['manager_id']])) {
$manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
$geo_manage_list = array_merge($geo_manage_list, $manage);
}
... ...
<?php
/**
* @remark :
* @name :ManageEntryPositionLogic.php
* @author :lyh
* @method :post
* @time :2025/11/3 17:14
*/
namespace App\Http\Logic\Aside\Manage;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Manage\EntryPosition;
class ManageEntryPositionLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new EntryPosition();
}
/**
* @remark :列表数据
* @name :listEntryPosition
* @author :lyh
* @method :post
* @time :2025/11/3 17:27
*/
public function listEntryPosition($map = [],$page = 1, $row = 10,$order = 'id')
{
$data = $this->model->lists($map,$page,$row,$order);
return $this->success($data);
}
/**
* @remark :保存数据
* @name :saveEntryPosition
* @author :lyh
* @method :post
* @time :2025/11/3 17:28
*/
public function saveEntryPosition()
{
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$id = $this->model->addReturnId($this->param);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员'.$e->getMessage());
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除数据
* @name :delEntryPosition
* @author :lyh
* @method :post
* @time :2025/11/3 17:28
*/
public function delEntryPosition()
{
$this->model->del(['id'=>['in',$this->param['id']]]);
return $this->success();
}
}
... ...
... ... @@ -170,6 +170,15 @@ class TicketUploadDataLogic extends BaseLogic
return $this->success($data);
}
public function setProductSort($mdoel){
$info = $mdoel->orderBy('sort','desc')->first();
if(empty($info)){
return 1;
}
$sort = $info['sort']+1;
return $sort;
}
/**
* @remark :保存数据详情
* @name :saveData
... ... @@ -196,6 +205,7 @@ class TicketUploadDataLogic extends BaseLogic
}
try {
$productModel = new Product();
$sort = $this->setProductSort($productModel);
$data = [
'project_id' => $info['project_id'],
'title' => $info['text']['title'],
... ... @@ -205,6 +215,7 @@ class TicketUploadDataLogic extends BaseLogic
'category_id'=>$category_id ?? '',
'keyword_id'=>$keyword_id ?? '',
'status'=>1,
'sort'=>$sort,
];
$id = $productModel->addReturnId($data);
CategoryRelated::saveRelated($id, $info['text']['category_id'] ?? []);//分类关联
... ... @@ -237,6 +248,8 @@ class TicketUploadDataLogic extends BaseLogic
if(isset($info['text']['image'])){
$info['text']['image'] = str_replace_url($info['text']['image'] ?? '');
}
$blogModel = new Blog();
$sort = $this->setProductSort($blogModel);
$data = [
'project_id' => $info['project_id'],
'name' => $info['text']['title'],
... ... @@ -245,9 +258,10 @@ class TicketUploadDataLogic extends BaseLogic
'remark'=>$info['text']['intro'] ?? '',
'category_id'=>$category_id ?? '',
'status'=>1,
'sort'=>$sort,
];
try {
$blogModel = new Blog();
$id = $blogModel->addReturnId($data);
$route = RouteMap::setRoute($data['name'],RouteMap::SOURCE_BLOG,$id,$info['project_id']);
$blogModel->edit(['url'=>$route],['id'=>$id]);
... ... @@ -272,6 +286,8 @@ class TicketUploadDataLogic extends BaseLogic
if(isset($info['text']['image'])){
$info['text']['image'] = str_replace_url($info['text']['image'] ?? '');
}
$newsModel = new News();
$sort = $this->setProductSort($newsModel);
$data = [
'project_id' => $info['project_id'],
'name' => $info['text']['title'],
... ... @@ -280,9 +296,10 @@ class TicketUploadDataLogic extends BaseLogic
'remark'=>$info['text']['intro'] ?? '',
'category_id'=>$category_id ?? '',
'status'=>1,
'sort'=>$sort,
];
try {
$newsModel = new News();
$id = $newsModel->addReturnId($data);
$route = RouteMap::setRoute($data['name'],RouteMap::SOURCE_NEWS,$id,$info['project_id']);
$newsModel->edit(['url'=>$route],['id'=>$id]);
... ...
... ... @@ -554,7 +554,7 @@ class RankDataLogic extends BaseLogic
$without_project_ids = []; //不用处理排名的项目
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$compliance_project_ids = [2163,257,823,1750,497,1006]; //直接达标处理的
$compliance_project_ids = [2163,257,823,1750,497,1006,2663]; //直接达标处理的
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193,2399,1685, 3931,2273,3647,1934];//暂停的项目
$uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
//一个项目多个api_no
... ...
... ... @@ -32,6 +32,9 @@ class SettingFaqLogic extends BaseLogic
public function getRouteList($map = [])
{
$routeModel = new RouteMap();
if(!empty($map['route'])){
$map['route'] = ['like','%'.$map['route'].'%'];
}
$list = $routeModel->list($map,'id',['*'],'desc',20);
return $this->success($list);
}
... ...
... ... @@ -5,7 +5,7 @@ namespace App\Models\Manage;
use App\Models\Base;
/**
* @remark :
* @remark :岗位管理
* @class :EntryPosition.php
* @author :lyh
* @time :2023/7/22 18:08
... ...
... ... @@ -679,7 +679,12 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save');
Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail');
});
//岗位管理
Route::prefix('entry_position')->group(function () {
Route::any('/', [Aside\Manage\ManageEntryPositionController::class,'lists'])->name('entry_position_lists');
Route::any('/save', [Aside\Manage\ManageEntryPositionController::class,'save'])->name('entry_position_save');
Route::any('/del', [Aside\Manage\ManageEntryPositionController::class,'del'])->name('entry_position_del');
});
});
... ...