作者 刘锟

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

正在显示 45 个修改的文件 包含 345 行增加198 行删除
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Domain;
use App\Models\Devops\DevopsTask as DevopsTaskModel;
use App\Models\Devops\DevopsTaskLog;
use App\Models\Project\Project;
use App\Utils\EncryptUtils;
use Illuminate\Console\Command;
use App\Models\Devops\DevopsTask as DevopsTaskModel;
/**
* Class DevopsTask
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Domain;
use App\Helper\Arr;
use App\Models\Product\Category;
use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\RankData\RankData as GoogleRankModel;
use App\Models\RouteMap\RouteMap;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Utils;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
/**
* 剩余服务时长
... ...
... ... @@ -7,7 +7,7 @@
* @time :2024/1/29 15:29
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Domain;
use App\Models\Devops\ServerConfig;
use App\Models\Project\Project;
... ...
... ... @@ -7,11 +7,12 @@
* @time :2023/9/25 15:31
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Import;
use App\Helper\OaGlobalsoApi;
use App\Models\Channel\Channel;
use App\Models\Project\Project;
use Illuminate\Console\Command;
class ImportChannel extends Command
{
/**
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/8/7 17:47
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Import;
use App\Models\Manage\EntryPosition;
use App\Models\Manage\JobLevel;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Inquiry;
use App\Helper\FormGlobalsoApi;
use App\Models\Inquiry\InquiryFormData;
... ...
... ... @@ -129,7 +129,7 @@ class VideoTask extends Command
*/
public function sendSubTask()
{
$subTask = KeywordVideoTaskLog::where(['status' => KeywordVideoTaskLog::STATUS_INIT])->orderBy('id', 'asc')->limit($this->max_sub_task)->get();
$subTask = KeywordVideoTaskLog::where(['status' => KeywordVideoTaskLog::STATUS_INIT])->orderBy('id', 'asc')->get();
if ($subTask->isEmpty()){
return true;
}
... ... @@ -148,11 +148,12 @@ class VideoTask extends Command
],
'task_id' => $task_id,
'callback_url' => env('APP_URL') . '/api/video_task_callback',
'is_ytb'=>true
'is_ytb'=>false
];
$result = Http::post('http://216.250.255.116:7866/create_task', $data);
$res_json = json_decode($result,true);
$val->task_id = $task_id;
$val->status = KeywordVideoTaskLog::STATUS_ERROR;
if(isset($res_json['code']) && ($res_json['code'] == 200)){
$val->status = KeywordVideoTaskLog::STATUS_RUNNING;
}
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Project;
use App\Models\Com\NoticeLog;
use App\Models\Product\Keyword;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Project;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Com\NoticeLog;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
/**
* 初始化项目
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Project;
use App\Helper\Arr;
use App\Helper\Common;
... ... @@ -21,7 +21,6 @@ use App\Services\ProjectServer;
use App\Utils\LogUtils;
use Hashids\Hashids;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Sync;
use App\Helper\OaGlobalsoApi;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2024/4/17 10:05
*/
namespace App\Console\Commands\SyncFile;
namespace App\Console\Commands\Sync;
use App\Models\File\ErrorFile;
use Illuminate\Console\Command;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/12/25 15:00
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Sync;
use App\Models\User\User;
use Illuminate\Console\Command;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Sync;
use App\Exceptions\InquiryFilterException;
use App\Models\Project\Project;
use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
use App\Services\SyncSubmitTaskService;
use Illuminate\Console\Command;
use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Schema;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Tdk;
use App\Services\ProjectServer;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Tdk;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Helper\Translate;
use App\Models\Ai\AiCommand;
use App\Models\Domain\DomainInfo;
use App\Models\Mail\Mail;
... ... @@ -16,7 +15,6 @@ use App\Models\User\User;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Tdk;
use App\Models\Project\Project;
use App\Models\Project\ProjectUpdateTdk;
... ...
... ... @@ -12,7 +12,9 @@ use App\Models\Blog\Blog;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\File\File;
use App\Models\File\File as FileModel;
use App\Models\File\Image;
use App\Models\File\Image as ImageModel;
use App\Models\Manage\BelongingGroup;
use App\Models\Manage\Dept;
use App\Models\Manage\EntryPosition;
... ... @@ -24,7 +26,10 @@ use App\Models\Product\Product;
use App\Models\Project\DeployOptimize;
use App\Models\Project\MinorLanguages;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BCustomTemplate;
use App\Models\WebSetting\WebSettingService;
use App\Services\AmazonS3Service;
use App\Services\ProjectServer;
use App\Services\SyncService;
use GuzzleHttp\Client;
... ... @@ -48,7 +53,83 @@ class Demo extends Command
*/
protected $description = 'demo';
public function handle(){
public function s(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>181]);
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->initSearch($v['id']);
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :创建search页面
* @name :initSearch
* @author :lyh
* @method :post
* @time :2024/4/25 11:35
*/
public function initSearch($project_id){
$bCustomTemplateModel = new BCustomTemplate();
$info = $bCustomTemplateModel->read(['url'=>'search']);
if($info === false){
$time = date('Y-m-d H:i:s');
$info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
if(empty($info)) {
$data = [
'project_id' => $project_id,
'name' => 'search',
'status' => 1,
'url' => 'search',
'html' => '',
'html_style' =>'search',
'title' => 'search',
'description' => 'Sorry. The page has either moved or cannot be found.',
'created_at' => $time, 'updated_at' => $time];
$id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);
//路由
$info = DB::connection('custom_mysql')->table('gl_route_map')->first();
if(empty($info)) {
$data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => 'search', 'created_at' => $time, 'updated_at' => $time];
DB::connection('custom_mysql')->table('gl_route_map')->insert($data);
}
}
}
return true;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->param['project_id'] = 181;
$imageModel = new ImageModel();
//获取当前项目的所有图片
$imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);
if(!empty($imageList)){
$amazonS3Service = new AmazonS3Service();
foreach ($imageList as $k => $v){
$amazonS3Service->syncImageFiles(getImageUrl($v['path']));
$imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);
}
}
$fileModel = new FileModel();
$fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);
if(!empty($fileList)){
$amazonS3Service = new AmazonS3Service();
foreach ($fileList as $k => $v){
echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
$amazonS3Service->syncImageFiles(getFileUrl($v['path']));
$fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);
}
}
return true;
}
}
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/11/13 10:06
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/11/30 10:29
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Models\WebSetting\WebLanguage;
use Illuminate\Console\Command;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Models\Project\Project;
use App\Services\ProjectServer;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
... ... @@ -15,9 +15,6 @@ use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
use App\Models\WebSetting\Translate as TranslateModel;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;
/**
* Class Test
... ...
... ... @@ -7,22 +7,15 @@
* @time :2023/11/20 15:07
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\CustomModule\CustomModule;
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\Models\Template\BTemplate;
use App\Models\Template\BTemplateMain;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/12/6 16:07
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/11/1 9:22
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Models\Mail\Mail;
use App\Models\Project\Project;
... ... @@ -15,8 +15,6 @@ use App\Models\User\User;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use App\Models\Com\UpdateProgress as UpdateProgressModel;
class UpdateProgress extends Command
{
... ...
... ... @@ -7,18 +7,16 @@
* @time :2023/11/20 15:07
*/
namespace App\Console\Commands;
namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Helper\Translate;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ...
<?php
/**
* @remark :
* @name :TranslateRead.php
* @author :lyh
* @method :post
* @time :2024/1/17 16:47
*/
namespace App\Console\Commands;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class TranslateRead extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'translate_read';
/**
* The console command description.
*
* @var string
*/
protected $description = '生成视频模块';
/**
* @remark :统一更新路由
* @name :handle
* @author :lyh
* @method :post
* @time :2023/11/20 15:13
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['type'=>['!=',0]]);
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
public function read(){
}
}
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\WebTraffic;
use App\Helper\Arr;
use App\Models\Product\Category;
... ... @@ -8,7 +8,6 @@ use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\Project\WebTrafficConfig;
use App\Models\Template\BCustomTemplate;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use Carbon\Carbon;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\WebTraffic;
use App\Helper\Arr;
use App\Models\Product\Category;
... ... @@ -8,7 +8,6 @@ use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\Project\WebTrafficConfig;
use App\Models\Template\BCustomTemplate;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use Carbon\Carbon;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\WebTraffic;
use App\Helper\Arr;
use App\Models\Product\Category;
... ... @@ -8,10 +8,8 @@ use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\Project\WebTrafficConfig;
use App\Models\Template\BCustomTemplate;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use Carbon\Carbon;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Utils;
use Illuminate\Console\Command;
... ...
<?php
namespace App\Console\Commands;
namespace App\Console\Commands\WebTraffic;
use App\Helper\Arr;
use App\Models\Product\Category;
... ... @@ -8,10 +8,8 @@ use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\Project\WebTrafficConfig;
use App\Models\Template\BCustomTemplate;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use Carbon\Carbon;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Utils;
use Illuminate\Console\Command;
... ...
... ... @@ -46,7 +46,7 @@ class Kernel extends ConsoleKernel
$schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字
$schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
// 每日推送视频任务
$schedule->command('video_task')->dailyAt('02:30')->withoutOverlapping(1);
$schedule->command('video_task')->hourly()->withoutOverlapping(1);
// 每日推送已完成视频任务项目生成对应界面
$schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
}
... ...
... ... @@ -4,7 +4,9 @@ namespace App\Http\Controllers\Bside\FileManage;
use App\Enums\Common\Code;
use App\Helper\Translate;
use App\Http\Controllers\Bside\BaseController;
use App\Models\File\File;
use App\Models\FileManage\FileManage;
use App\Models\Project\Project;
use App\Services\CosService;
... ... @@ -79,18 +81,14 @@ class FileManageController extends BaseController
'file.required'=>'请上传文件',
]);
$file = $request->file('file');
$data = $this->checkFile($file);
$path = '/file_manage/' . $this->user['project_id'] . '/' . date('Ymd');
$fileName = uniqid().rand(10000,99999).'.'.$file->getClientOriginalExtension();
$name = $file->getClientOriginalName();
$fileName = $this->getOnlyFilename($name,$this->user['project_id']);
$cosService = new CosService();
$cosService->uploadFile($file,$path,$fileName);
$data['project_id'] = $this->user['project_id'];
$data['path'] = $path.'/'.$fileName;
$rs = $fileManage->add($data);
if ($rs === false) {
$this->fail('上传失败');
... ... @@ -98,6 +96,41 @@ class FileManageController extends BaseController
$this->response('success');
}
/**
* @remark :获取唯一名称
* @name :getOnlyFilename
* @author :lyh
* @method :post
* @time :2024/4/26 16:10
*/
public function getOnlyFilename($name,$project_id = 0){
$nameArr = explode('.',$name);
$enName = generateRoute(Translate::tran($nameArr[0], 'en'));
$i=1;
while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){
$enName = $enName .'-'.$i;
$i++;
}
return $enName.'.'.$nameArr[1];
}
/**
* @remark :唯一名称
* @name :onlyName
* @author :lyh
* @method :post
* @time :2024/4/26 16:21
*/
public function onlyName($enName,$project_id){
$fileModel = new FileManage();
$info = $fileModel->read(['project_id' => $project_id, 'en_name' => $enName]);
if($info !== false){
return true;
}
return false;
}
protected function checkFile($file){
$count = FileManage::where('project_id', $this->user['project_id'])->count();
if($count >= $this->upload_config['upload_max_num']){
... ...
... ... @@ -27,6 +27,7 @@ use App\Models\User\User;
use App\Utils\EncryptUtils;
use http\Client\Response;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Mrgoon\AliSms\AliSms;
class LoginController extends BaseController
... ...
... ... @@ -34,6 +34,7 @@ class CategoryController extends BaseController
{
$this->map = $this->searchParam();
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'route','keywords', 'describe', 'status','created_at','sort'];
$this->map['deleted_at'] = null;
$list = $category->list($this->map,['sort','id'],$filed);
$data = [];
if(!empty($list)){
... ...
... ... @@ -35,6 +35,7 @@ class BTemplateLogController extends BaseController
public function lists(BTemplateLog $bTemplateLog){
// unset($this->map['template_id']);
$this->map['project_id'] = $this->user['project_id'];
$this->map['source'] = 1;
$this->map['is_custom'] = 0;
$lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']);
if(!empty($lists['list'])){
... ...
... ... @@ -8,6 +8,8 @@ use App\Http\Logic\Bside\BTemplate\CustomTemplateLogic;
use App\Http\Requests\Bside\Template\CustomTemplateRequest;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateLog;
use App\Models\Template\Template;
use App\Models\User\User;
/**
* @remark :自定义模块
... ... @@ -123,9 +125,18 @@ class CustomTemplateController extends BaseController
],[
'source_id.required' => 'ID不能为空',
]);
$this->map['source'] = 9;
$this->map['is_custom'] = 0;
$lists = $bTemplateLog->lists($this->map,$this->page,$this->row);
$lists = $bTemplateLog->list(['source'=>9,'is_custom'=>0,'source_id'=>$this->param['source_id']],'id',['id','template_id','operator_id','source','created_at','updated_at'],'desc',10);
if(!empty($lists)){
$templateModel = new Template();
$userModel = new User();
foreach ($lists as $k => $v){
if(!empty($v['template_id'])){
$v['template_name'] = $templateModel->read(['id'=>$v['template_id']],['name'])['name'];
}
$v['operator_name'] = $userModel->getName($v['operator_id']);
$lists[$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -140,7 +151,7 @@ class CustomTemplateController extends BaseController
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '模版ID不能为空',
'id.required' => 'ID不能为空',
]);
$logic->saveRollbackVersion();
$this->response('success');
... ...
... ... @@ -3,8 +3,10 @@
namespace App\Http\Controllers\File;
use App\Enums\Common\Code;
use App\Helper\Translate;
use App\Models\File\ErrorFile;
use App\Models\File\File;
use App\Models\File\Image as ImageModel;
use App\Models\Project\Project;
use App\Services\AmazonS3Service;
use App\Services\CosService;
... ... @@ -120,7 +122,7 @@ class FileController
if($file_hash !== false){
return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name));
}
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
$fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
//同步数据到cos
if($this->upload_location == 0){
$cosService = new CosService();
... ... @@ -155,6 +157,40 @@ class FileController
}
/**
* @remark :获取唯一名称
* @name :getOnlyFilename
* @author :lyh
* @method :post
* @time :2024/4/26 16:10
*/
public function getOnlyFilename($name,$project_id = 0){
$nameArr = explode('.',$name);
$enName = generateRoute(Translate::tran($nameArr[0], 'en'));
$i=1;
while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){
$enName = $enName .'-'.$i;
$i++;
}
return $enName.'.'.$nameArr[1];
}
/**
* @remark :唯一名称
* @name :onlyName
* @author :lyh
* @method :post
* @time :2024/4/26 16:21
*/
public function onlyName($enName,$project_id){
$fileModel = new File();
$info = $fileModel->read(['project_id' => $project_id, 'en_name' => $enName]);
if($info !== false){
return true;
}
return false;
}
/**
* 接口上传单文件
* @param $files
* @return array
... ... @@ -222,6 +258,7 @@ class FileController
'mime'=>$mime,
'project_id'=>$this->cache['project_id'] ?? 0,
'name'=>$name,
'en_name'=>$fileName
];
$rs = $fileModel->add($data);
if ($rs === false) {
... ... @@ -254,7 +291,7 @@ class FileController
}
$url = $this->config['root'].'/'.$this->path;
$file_type = $file->getClientOriginalExtension();
$fileName = uniqid().rand(10000,99999).'.'.$file_type;
$fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
//同步数据到cos
if($this->upload_location == 0){
$cosService = new CosService();
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Controllers\File;
use App\Enums\Common\Code;
use App\Helper\Translate;
use App\Http\Controllers\Controller;
use App\Http\Controllers\type;
use App\Models\File\ErrorFile;
... ... @@ -200,7 +201,7 @@ class ImageController extends Controller
if(strlen($image_type) > 7){
$this->response('不支持当前格式',Code::SYSTEM_ERROR);
}
$fileName = uniqid().rand(10000,99999).'.'.$image_type;
$fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
//上传到cos
if($this->upload_location == 0){
$cosService = new CosService();
... ... @@ -216,6 +217,41 @@ class ImageController extends Controller
}
/**
* @remark :获取唯一名称
* @name :getOnlyFilename
* @author :lyh
* @method :post
* @time :2024/4/26 16:10
*/
public function getOnlyFilename($name,$project_id = 0){
$nameArr = explode('.',$name);
$enName = generateRoute(Translate::tran($nameArr[0], 'en'));
$i=1;
while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){
$enName = $enName .'-'.$i;
$i++;
}
return $enName.'.'.$nameArr[1];
}
/**
* @remark :唯一名称
* @name :onlyName
* @author :lyh
* @method :post
* @time :2024/4/26 16:21
*/
public function onlyName($enName,$project_id){
$imageModel = new ImageModel();
$info = $imageModel->read(['project_id' => $project_id, 'en_name' => $enName]);
if($info !== false){
return true;
}
return false;
}
/**
* @remark :指定同步文件到獨立177服務器
* @name :synchronizationFile
* @author :lyh
... ... @@ -253,6 +289,7 @@ class ImageController extends Controller
'mime'=>$mime,
'project_id'=>$this->cache['project_id'] ?? 0,
'name'=>$name,
'en_name'=>$fileName
];
$rs = $imageModel->add($data);
if ($rs === false) {
... ... @@ -299,7 +336,7 @@ class ImageController extends Controller
continue;
}
$image_type = $file->getClientOriginalExtension();
$fileName = uniqid().rand(10000,99999).'.'.$image_type;
$fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
//同步数据到cos
if($this->upload_location == 0){
$cosService = new CosService();
... ...
... ... @@ -2,19 +2,34 @@
namespace App\Http\Logic\Aside\Project;
use App\Console\Commands\Languages;
use App\Enums\Common\Code;
use App\Events\CopyImageFile;
use App\Events\CopyProject;
use App\Exceptions\AsideGlobalException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\FormGlobalsoApi;
use App\Http\Logic\Aside\BaseLogic;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Jobs\CopyImageFileJob;
use App\Jobs\CopyProjectJob;
use App\Models\Channel\Channel;
use App\Models\Channel\User;
use App\Models\Channel\Zone;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateLog;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryIP;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\Manage;
use App\Models\Project\After;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\InquiryFilterConfig;
use App\Models\Project\MinorLanguages;
use App\Models\Project\Payment;
use App\Models\Project\Project;
use App\Models\Project\ProjectRenew;
use App\Models\Project\WebTrafficConfig;
use App\Models\RankData\ExternalLinks;
... ... @@ -23,38 +38,18 @@ use App\Models\RankData\RankData;
use App\Models\RankData\RankWeek;
use App\Models\RankData\RecommDomain;
use App\Models\RankData\Speed;
use App\Models\Template\Setting;
use App\Models\User\ProjectMenu;
use App\Models\User\ProjectRole;
use App\Models\User\User as UserModel;
use App\Models\WebSetting\WebLanguage;
use App\Services\ProjectServer;
use App\Services\SyncService;
use App\Utils\HttpUtils;
use App\Utils\LogUtils;
use GuzzleHttp\Exception\GuzzleException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\FormGlobalsoApi;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Channel\Channel;
use App\Models\Channel\User;
use App\Models\Channel\Zone;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\Manage;
use App\Models\Project\After;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Payment;
use App\Models\Project\Project;
use App\Models\Task\Task;
use App\Services\ProjectServer;
use Hashids\Hashids;
use App\Models\User\User as UserModel;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Schema;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
/**
* Class ProjectLogic
... ...
... ... @@ -111,12 +111,12 @@ class CustomTemplateLogic extends BaseLogic
$this->saveCommonTemplate($html,$bSettingInfo['template_id']);
$this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
$this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']);
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id'],'project_id'=>$this->user['project_id']]);
if($rs === false){
$this->fail('系统错误,请联系管理');
}
$this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']);
//通知
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
$this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]);
... ... @@ -386,15 +386,16 @@ class CustomTemplateLogic extends BaseLogic
$type = $this->getType();
//还原头部+底部
$commonData = [
'head_html'=>$logInfo['head_html'],
'head_css'=>$logInfo['head_css'],
'footer_html'=>$logInfo['footer_html'],
'footer_css'=>$logInfo['footer_css']
'head_html'=>$logInfo['head_html'], 'head_css'=>$logInfo['head_css'],
'footer_html'=>$logInfo['footer_html'], 'footer_css'=>$logInfo['footer_css']
];
$commonTemplateModel = new BTemplateCommon();
$commonTemplateModel->edit($commonData,['template_id'=>$logInfo['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]);
$this->model->edit(['html'=>$logInfo['main_html'],'html_style'=>$logInfo['main_css']],['id'=>$logInfo['source_id']]);
}else{
$this->model->edit(['html'=>$logInfo['text']],['id'=>$logInfo['source_id']]);
}
$this->model->edit(['html'=>$logInfo['main_html'],'html_style'=>$logInfo['main_css']],['id'=>$logInfo['source_id']]);
return $this->success();
}
}
... ...
... ... @@ -174,7 +174,7 @@ class BaseLogic extends Logic
$data['project_id'] = $this->user['project_id'];
$str = http_build_query($data);
$url = $this->user['domain'].'api/delHtml/?'.$str;
if(isset($this->project['serve_id']) && ($this->project['serve_id'] == 3)){//TODO::当前项目通知不过 ,跳过自动更新
if(isset($this->project['serve_id']) && ($this->project['serve_id'] != 1)){//TODO::当前项目通知不过 ,跳过自动更新
exec('curl -k "'.$url.'" > /dev/null 2>&1 &');
}else{
shell_exec('curl -k "'.$url.'"');
... ...
... ... @@ -39,21 +39,23 @@ class CopyImageFileJob implements ShouldQueue
{
$imageModel = new ImageModel();
//获取当前项目的所有图片
$imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);
$imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size','name']);
if(!empty($imageList)){
$amazonS3Service = new AmazonS3Service();
foreach ($imageList as $k => $v){
echo date('Y-m-d H:i:s') . '执行图片的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
$amazonS3Service->syncImageFiles(getImageUrl($v['path']));
$imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);
}
}
$fileModel = new FileModel();
$fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos']);
$fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);
if(!empty($fileList)){
$amazonS3Service = new AmazonS3Service();
foreach ($fileList as $k => $v){
$amazonS3Service->syncImageFiles(getImageUrl($v['path']));
echo date('Y-m-d H:i:s') . '执行文件的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
$amazonS3Service->syncImageFiles(getFileUrl($v['path']));
$fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);
}
}
... ...
... ... @@ -16,6 +16,7 @@ class KeywordVideoTaskLog extends Base
const STATUS_INIT = 0;
const STATUS_RUNNING = 1;
const STATUS_FINISH = 2;
const STATUS_ERROR = 3;
protected $table = 'gl_keyword_video_task_log';
}
... ...
... ... @@ -21,6 +21,33 @@ use Illuminate\Support\Facades\Schema;
*/
class ProjectServer
{
public static $main404Html = '<main>
<section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
id="sectionIdyxqu938">
<div class="layout" data-unable="demo01-error404">
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
</div>
<p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
<style>
.section-block-error404 .layout {
height: 700px;
display: flex;
align-items: center;
justify-content: center;
}
.section-block-error404 img {
width: 400px;
}
@media only screen and (max-width:500) {
.section-block-error404 img {
max-width: 100%;
}
}
</style>
<script>
</script>
</section>
</main>';
/**
* @param $project_id
* @return Project|false
... ... @@ -105,6 +132,8 @@ class ProjectServer
self::init404Page($project_id);
//初始化模块数据
self::initModule($project_id);
//初始化search页面
self::initSearchPage($project_id);
DB::disconnect('custom_mysql');
return true;
}
... ... @@ -174,39 +203,12 @@ class ProjectServer
$time = date('Y-m-d H:i:s');
$info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
if(empty($info)) {
$main_404_html = '<main>
<section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
id="sectionIdyxqu938">
<div class="layout" data-unable="demo01-error404">
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
</div>
<p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
<style>
.section-block-error404 .layout {
height: 700px;
display: flex;
align-items: center;
justify-content: center;
}
.section-block-error404 img {
width: 400px;
}
@media only screen and (max-width:500) {
.section-block-error404 img {
max-width: 100%;
}
}
</style>
<script>
</script>
</section>
</main>';
$data = [
'project_id' => $project_id,
'name' => BCustomTemplate::NOT_FOUND_PAGE_URL,
'status' => 1,
'url' => BCustomTemplate::NOT_FOUND_PAGE_URL,
'html' => $main_404_html,
'html' => self::$main404Html,
'html_style' => '<style id="globalsojs-styles"></style>',
'title' => '404-Page not found',
'description' => 'Sorry. The page has either moved or cannot be found.',
... ... @@ -220,4 +222,35 @@ class ProjectServer
}
}
}
/**
* @remark :初始化search页面
* @name :init404Page
* @author :lyh
* @method :post
* @time :2023/12/29 9:32
*/
public static function initSearchPage($project_id){
$time = date('Y-m-d H:i:s');
$info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
if(empty($info)) {
$data = [
'project_id' => $project_id,
'name' => 'search',
'status' => 1,
'url' => 'search',
'html' => '',
'html_style' =>'search',
'title' => 'search',
'description' => 'Sorry. The page has either moved or cannot be found.',
'created_at' => $time, 'updated_at' => $time];
$id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);
//路由
$info = DB::connection('custom_mysql')->table('gl_route_map')->first();
if(empty($info)) {
$data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => 'search', 'created_at' => $time, 'updated_at' => $time];
DB::connection('custom_mysql')->table('gl_route_map')->insert($data);
}
}
}
}
... ...