|
@@ -0,0 +1,42 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+class CronAction extends Action {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public function searchFile2Ftp( ){
|
|
|
+
|
|
|
+ $dir = C('FTP_LOCAL_DIR');
|
|
|
+ $targetDir = C('FTP_SERVER_DIR');
|
|
|
+ $config = C('FTP_CONFIG');
|
|
|
+ $res = scanTargetFile($dir, 'md5');
|
|
|
+ $files = explode(';', $res);
|
|
|
+ array_pop($files);
|
|
|
+ foreach($files as $v){
|
|
|
+ $path_parts = pathinfo($v);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $locDat = $path_parts['dirname']. '/' . $path_parts['filename'].'.dat';
|
|
|
+ $tagetDat = $targetDir.'/'. $path_parts['filename'].'.dat';
|
|
|
+ $datRes = Zmcoding\FtpFile::getInstance($config)->up_file($locDat, $tagetDat);
|
|
|
+
|
|
|
+ if($datRes){
|
|
|
+ debug_log('upload_info',json_encode($tagetDat,JSON_UNESCAPED_UNICODE));
|
|
|
+ }
|
|
|
+
|
|
|
+ $md5Res = Zmcoding\FtpFile::getInstance($config)->up_file($v, $targetDir.'/'. $path_parts['basename']);//md5文件
|
|
|
+
|
|
|
+ if($md5Res){
|
|
|
+ debug_log('upload_info',json_encode($targetDir.'/'. $path_parts['basename'],JSON_UNESCAPED_UNICODE));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|