作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -11,6 +11,7 @@ use App\Helper\Common;
use App\Models\Blog\Blog;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\File\File;
use App\Models\File\Image;
use App\Models\Manage\BelongingGroup;
use App\Models\Manage\Dept;
... ... @@ -265,56 +266,12 @@ class Demo extends Command
// print_r($include);
// }
public function handle(){
$domainModel = new DomainInfo();
$domainInfo = $domainModel->read(['project_id'=>45]);
if($domainInfo === false){
dd('11111');
}
$bg = '';
$logo = '';
$dom = file_get_html('https://'.$domainInfo['domain'].'/');
$logoDom = $dom->find('.logo', 0)->find("img",0);
if($logoDom != null){
$logo = $logoDom->src;
}
$elements = $dom->find('.section-banner-wrap-block');
if (count($elements) >= 2) {
foreach ($elements as $v){
$image = $v->find('img', 0);
if($image != null){
break;
}
}
} else {
$image = $elements->find('img', 0);
}
if($image != null){
$bg = $image->src;
}
if($image != null){
$bg = $image->src;
$fileModel = new File();
$lists = $fileModel->list(['created_at'=>['>=','2024-04-12 00:00:00']]);
foreach ($lists as $k=> $v){
$str = './coscli cp cos://globalso-v6-1309677403'.$v['path'].' /home/cos/'.$v['path'];
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($str, true) . PHP_EOL, FILE_APPEND);
}
// return $logo;
dd(['logo'=>$logo ?? '','bg'=>$bg ?? '']);
// $projectModel = new Project();
// $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
// foreach ($list as $v1){
// ProjectServer::useProject($v1['id']);
// echo date('Y-m-d H:i:s') . '项目id:'.$v1['id'] . PHP_EOL;
// $navGroupModel = new BNavGroup();
// $groupList = $navGroupModel->list(['sort_list'=>['!=','']]);
// if(empty($groupList)){
// continue;
// }
// foreach ($groupList as $k=>$v){
// if(!empty($v['sort_list'])){
// $sort_list = json_decode($v['sort_list']);
// $sort = 0;
// $this->subSort($sort_list,$sort);
// }
// }
// DB::disconnect('custom_mysql');
// }
return true;
}
... ...
... ... @@ -130,7 +130,7 @@ class FileController
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
}
$this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
$this->synchronizationFile($files->getClientOriginalExtension(),$fileName);
$this->synchronizationFile($fileName);
$this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
}
... ... @@ -141,9 +141,9 @@ class FileController
* @method :post
* @time :2024/4/8 11:10
*/
public function synchronizationFile($file_type,$fileName){
public function synchronizationFile($fileName){
//同步到大文件
$file_path = getFileUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
$file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName;
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
shell_exec($cmd);
}
... ... @@ -262,7 +262,7 @@ class FileController
$mime = $file->getMimeType();
$this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name);
$data[] = $this->responseData($this->path.'/'.$fileName, $name);
$this->synchronizationFile($file_type,$fileName);
$this->synchronizationFile($fileName);
}
$this->response('资源',Code::SUCCESS,$data);
}
... ...