CronAction.class.php 938 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. class CronAction extends Action {
  3. public function searchFile2Ftp( ){
  4. $dir = C('FTP_LOCAL_DIR');
  5. $targetDir = C('FTP_SERVER_DIR');
  6. $config = C('FTP_CONFIG');
  7. $res = scanTargetFile($dir, 'md5');
  8. $files = explode(';', $res);
  9. array_pop($files);
  10. foreach($files as $v){
  11. $path_parts = pathinfo($v);
  12. $locDat = $path_parts['dirname']. '/' . $path_parts['filename'].'.dat';
  13. $tagetDat = $targetDir.'/'. $path_parts['filename'].'.dat';
  14. $datRes = Zmcoding\FtpFile::getInstance($config)->up_file($locDat, $tagetDat);
  15. if($datRes){
  16. debug_log('upload_info',json_encode($tagetDat,JSON_UNESCAPED_UNICODE));
  17. }
  18. $md5Res = Zmcoding\FtpFile::getInstance($config)->up_file($v, $targetDir.'/'. $path_parts['basename']);//md5文件
  19. if($md5Res){
  20. debug_log('upload_info',json_encode($targetDir.'/'. $path_parts['basename'],JSON_UNESCAPED_UNICODE));
  21. }
  22. }
  23. }
  24. }