作者 lyh

gx

@@ -42,27 +42,27 @@ class Demo extends Command @@ -42,27 +42,27 @@ class Demo extends Command
42 { 42 {
43 $this->param['project_id'] = 181; 43 $this->param['project_id'] = 181;
44 $imageModel = new ImageModel(); 44 $imageModel = new ImageModel();
45 -// //获取当前项目的所有图片  
46 -// $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);  
47 -// if(!empty($imageList)){  
48 -// $amazonS3Service = new AmazonS3Service();  
49 -// foreach ($imageList as $k => $v){  
50 -// $amazonS3Service->syncImageFiles(getImageUrl($v['path']));  
51 -// $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);  
52 -// }  
53 -// }  
54 -  
55 - $fileModel = new FileModel();  
56 - $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);  
57 - if(!empty($fileList)){ 45 + //获取当前项目的所有图片
  46 + $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);
  47 + if(!empty($imageList)){
58 $amazonS3Service = new AmazonS3Service(); 48 $amazonS3Service = new AmazonS3Service();
59 - foreach ($fileList as $k => $v){  
60 - echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;  
61 - $amazonS3Service->syncImageFiles(getFileUrl($v['path']));  
62 - $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);  
63 - gc_collect_cycles(); 49 + foreach ($imageList as $k => $v){
  50 + $amazonS3Service->syncImageFiles(getImageUrl($v['path']));
  51 + $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);
64 } 52 }
65 } 53 }
  54 +
  55 +// $fileModel = new FileModel();
  56 +// $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);
  57 +// if(!empty($fileList)){
  58 +// $amazonS3Service = new AmazonS3Service();
  59 +// foreach ($fileList as $k => $v){
  60 +// echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
  61 +// $amazonS3Service->syncImageFiles(getFileUrl($v['path']));
  62 +// $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);
  63 +// gc_collect_cycles();
  64 +// }
  65 +// }
66 return true; 66 return true;
67 } 67 }
68 68