作者 赵彬吉
@@ -11,6 +11,7 @@ use App\Helper\Common; @@ -11,6 +11,7 @@ use App\Helper\Common;
11 use App\Models\Blog\Blog; 11 use App\Models\Blog\Blog;
12 use App\Models\Devops\ServerConfig; 12 use App\Models\Devops\ServerConfig;
13 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
  14 +use App\Models\File\File;
14 use App\Models\File\Image; 15 use App\Models\File\Image;
15 use App\Models\Manage\BelongingGroup; 16 use App\Models\Manage\BelongingGroup;
16 use App\Models\Manage\Dept; 17 use App\Models\Manage\Dept;
@@ -265,56 +266,12 @@ class Demo extends Command @@ -265,56 +266,12 @@ class Demo extends Command
265 // print_r($include); 266 // print_r($include);
266 // } 267 // }
267 public function handle(){ 268 public function handle(){
268 - $domainModel = new DomainInfo();  
269 - $domainInfo = $domainModel->read(['project_id'=>45]);  
270 - if($domainInfo === false){  
271 - dd('11111');  
272 - }  
273 - $bg = '';  
274 - $logo = '';  
275 - $dom = file_get_html('https://'.$domainInfo['domain'].'/');  
276 - $logoDom = $dom->find('.logo', 0)->find("img",0);  
277 - if($logoDom != null){  
278 - $logo = $logoDom->src;  
279 - }  
280 - $elements = $dom->find('.section-banner-wrap-block');  
281 - if (count($elements) >= 2) {  
282 - foreach ($elements as $v){  
283 - $image = $v->find('img', 0);  
284 - if($image != null){  
285 - break;  
286 - }  
287 - }  
288 - } else {  
289 - $image = $elements->find('img', 0);  
290 - }  
291 - if($image != null){  
292 - $bg = $image->src; 269 + $fileModel = new File();
  270 + $lists = $fileModel->list(['created_at'=>['>=','2024-04-12 00:00:00']]);
  271 + foreach ($lists as $k=> $v){
  272 + $str = './coscli cp cos://globalso-v6-1309677403'.$v['path'].' /home/cos/'.$v['path'];
  273 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($str, true) . PHP_EOL, FILE_APPEND);
293 } 274 }
294 - if($image != null){  
295 - $bg = $image->src;  
296 - }  
297 -// return $logo;  
298 - dd(['logo'=>$logo ?? '','bg'=>$bg ?? '']);  
299 -// $projectModel = new Project();  
300 -// $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);  
301 -// foreach ($list as $v1){  
302 -// ProjectServer::useProject($v1['id']);  
303 -// echo date('Y-m-d H:i:s') . '项目id:'.$v1['id'] . PHP_EOL;  
304 -// $navGroupModel = new BNavGroup();  
305 -// $groupList = $navGroupModel->list(['sort_list'=>['!=','']]);  
306 -// if(empty($groupList)){  
307 -// continue;  
308 -// }  
309 -// foreach ($groupList as $k=>$v){  
310 -// if(!empty($v['sort_list'])){  
311 -// $sort_list = json_decode($v['sort_list']);  
312 -// $sort = 0;  
313 -// $this->subSort($sort_list,$sort);  
314 -// }  
315 -// }  
316 -// DB::disconnect('custom_mysql');  
317 -// }  
318 return true; 275 return true;
319 } 276 }
320 277
@@ -594,12 +594,12 @@ if (!function_exists('getFileUrl')) { @@ -594,12 +594,12 @@ if (!function_exists('getFileUrl')) {
594 if(substr($path,0,2) == '//'){ 594 if(substr($path,0,2) == '//'){
595 return 'https:'.$path; 595 return 'https:'.$path;
596 } 596 }
597 -// $file_type = pathinfo($path, PATHINFO_EXTENSION);  
598 -// $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];  
599 -// if(in_array(strtolower($file_type),$fileTypeArr)){  
600 -// $cdn2 = config('filesystems.disks.cos')['cdn2'];  
601 -// return $cdn2.$path;  
602 -// } 597 + $file_type = pathinfo($path, PATHINFO_EXTENSION);
  598 + $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
  599 + if(in_array(strtolower($file_type),$fileTypeArr)){
  600 + $cdn2 = config('filesystems.disks.cos')['cdn2'];
  601 + return $cdn2.$path;
  602 + }
603 if($location == 0){ 603 if($location == 0){
604 //v6-file.globalso.com 604 //v6-file.globalso.com
605 $cos = config('filesystems.disks.cos'); 605 $cos = config('filesystems.disks.cos');
@@ -54,15 +54,22 @@ class DescribeController extends BaseController @@ -54,15 +54,22 @@ class DescribeController extends BaseController
54 $this->response('success'); 54 $this->response('success');
55 } 55 }
56 56
57 - public function delete(Request $request, DescribeLogic $logic) 57 + /**
  58 + * @remark :删除数据
  59 + * @name :delete
  60 + * @author :lyh
  61 + * @method :post
  62 + * @time :2024/4/12 16:59
  63 + */
  64 + public function delete(DescribeLogic $logic)
58 { 65 {
59 - $request->validate([  
60 - 'ids'=>['required', new Ids()] 66 + $this->request->validate([
  67 + 'ids'=>'required'
61 ],[ 68 ],[
62 'ids.required' => 'ID不能为空' 69 'ids.required' => 'ID不能为空'
63 ]); 70 ]);
64 - $data = $logic->delete($this->param['ids']);  
65 - $this->response('success',Code::SUCCESS,$data); 71 + $logic->describeDel();
  72 + $this->response('success');
66 } 73 }
67 74
68 } 75 }
@@ -130,7 +130,7 @@ class FileController @@ -130,7 +130,7 @@ class FileController
130 $amazonS3Service->uploadFiles($files,$this->path,$fileName); 130 $amazonS3Service->uploadFiles($files,$this->path,$fileName);
131 } 131 }
132 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); 132 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
133 - $this->synchronizationFile($files->getClientOriginalExtension(),$fileName); 133 + $this->synchronizationFile($fileName);
134 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 134 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
135 } 135 }
136 136
@@ -141,9 +141,9 @@ class FileController @@ -141,9 +141,9 @@ class FileController
141 * @method :post 141 * @method :post
142 * @time :2024/4/8 11:10 142 * @time :2024/4/8 11:10
143 */ 143 */
144 - public function synchronizationFile($file_type,$fileName){ 144 + public function synchronizationFile($fileName){
145 //同步到大文件 145 //同步到大文件
146 - $file_path = getFileUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); 146 + $file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName;
147 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; 147 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
148 shell_exec($cmd); 148 shell_exec($cmd);
149 } 149 }
@@ -262,7 +262,7 @@ class FileController @@ -262,7 +262,7 @@ class FileController
262 $mime = $file->getMimeType(); 262 $mime = $file->getMimeType();
263 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); 263 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name);
264 $data[] = $this->responseData($this->path.'/'.$fileName, $name); 264 $data[] = $this->responseData($this->path.'/'.$fileName, $name);
265 - $this->synchronizationFile($file_type,$fileName); 265 + $this->synchronizationFile($fileName);
266 } 266 }
267 $this->response('资源',Code::SUCCESS,$data); 267 $this->response('资源',Code::SUCCESS,$data);
268 } 268 }
@@ -39,4 +39,23 @@ class DescribeLogic extends BaseLogic @@ -39,4 +39,23 @@ class DescribeLogic extends BaseLogic
39 } 39 }
40 return $this->success(); 40 return $this->success();
41 } 41 }
  42 +
  43 + /**
  44 + * @remark :删除数据
  45 + * @name :del
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/4/12 16:57
  49 + */
  50 + public function describeDel(){
  51 + if(is_array($this->param['ids'])){
  52 + $rs = $this->model->del(['id'=>['in',$this->param['ids']]]);
  53 + }else{
  54 + $rs = $this->model->del(['id'=>$this->param['ids']]);
  55 + }
  56 + if($rs === false){
  57 + $this->fail('系统错误,请联系管理员');
  58 + }
  59 + return $this->success();
  60 + }
42 } 61 }
@@ -54,13 +54,12 @@ class TranslateLogic extends BaseLogic @@ -54,13 +54,12 @@ class TranslateLogic extends BaseLogic
54 $text_array = $this->getUrlRead($url); 54 $text_array = $this->getUrlRead($url);
55 // 原始校对程序 55 // 原始校对程序
56 $old_key = [];//key值组成数据 56 $old_key = [];//key值组成数据
57 - if($info !== false){  
58 - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 57 + $data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
59 foreach ($data_read as $k => $v){ 58 foreach ($data_read as $k => $v){
  59 + $k = urldecode($k);
60 $old_key[] = $k; 60 $old_key[] = $k;
61 $data[] = [$k => $v]; 61 $data[] = [$k => $v];
62 } 62 }
63 - }  
64 $arr2 = []; 63 $arr2 = [];
65 foreach ($text_array as $val) { 64 foreach ($text_array as $val) {
66 if (FALSE == in_array($val, $old_key)){ 65 if (FALSE == in_array($val, $old_key)){