作者 赵彬吉
... ... @@ -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;
}
... ...
... ... @@ -594,12 +594,12 @@ if (!function_exists('getFileUrl')) {
if(substr($path,0,2) == '//'){
return 'https:'.$path;
}
// $file_type = pathinfo($path, PATHINFO_EXTENSION);
// $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
// if(in_array(strtolower($file_type),$fileTypeArr)){
// $cdn2 = config('filesystems.disks.cos')['cdn2'];
// return $cdn2.$path;
// }
$file_type = pathinfo($path, PATHINFO_EXTENSION);
$fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
if(in_array(strtolower($file_type),$fileTypeArr)){
$cdn2 = config('filesystems.disks.cos')['cdn2'];
return $cdn2.$path;
}
if($location == 0){
//v6-file.globalso.com
$cos = config('filesystems.disks.cos');
... ...
... ... @@ -54,15 +54,22 @@ class DescribeController extends BaseController
$this->response('success');
}
public function delete(Request $request, DescribeLogic $logic)
/**
* @remark :删除数据
* @name :delete
* @author :lyh
* @method :post
* @time :2024/4/12 16:59
*/
public function delete(DescribeLogic $logic)
{
$request->validate([
'ids'=>['required', new Ids()]
$this->request->validate([
'ids'=>'required'
],[
'ids.required' => 'ID不能为空'
]);
$data = $logic->delete($this->param['ids']);
$this->response('success',Code::SUCCESS,$data);
$logic->describeDel();
$this->response('success');
}
}
... ...
... ... @@ -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);
}
... ...
... ... @@ -39,4 +39,23 @@ class DescribeLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2024/4/12 16:57
*/
public function describeDel(){
if(is_array($this->param['ids'])){
$rs = $this->model->del(['id'=>['in',$this->param['ids']]]);
}else{
$rs = $this->model->del(['id'=>$this->param['ids']]);
}
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -54,12 +54,11 @@ class TranslateLogic extends BaseLogic
$text_array = $this->getUrlRead($url);
// 原始校对程序
$old_key = [];//key值组成数据
if($info !== false){
$data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
foreach ($data_read as $k => $v){
$old_key[] = $k;
$data[] = [$k => $v];
}
$data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
foreach ($data_read as $k => $v){
$k = urldecode($k);
$old_key[] = $k;
$data[] = [$k => $v];
}
$arr2 = [];
foreach ($text_array as $val) {
... ...