|
|
|
@ -7,10 +7,23 @@ $sftp = new Net_SFTP('106.14.1.181');
|
|
|
|
|
if (!$sftp->login('10000004000', 'YRATF0OtDaYa2Uhv6cWO8BV9FPBup5')) {
|
|
|
|
|
exit('Login Failed');
|
|
|
|
|
}
|
|
|
|
|
// 获取前一天的对账单
|
|
|
|
|
// target remote
|
|
|
|
|
$target_folder = str_replace("-", "/", date("Y-m", strtotime("-1 day")) );
|
|
|
|
|
$target_folder = null;
|
|
|
|
|
$targer_day = null;
|
|
|
|
|
// 获取前一天的对账单
|
|
|
|
|
$target_folder = str_replace("-", "/", date("Y-m", strtotime("-1 day")) ); // 2018/07
|
|
|
|
|
if (isset($_GET['f'])) {
|
|
|
|
|
$target_folder = $_GET['f']; // f=2018/06 f=2018/07/23
|
|
|
|
|
$target_set = explode('/', $target_folder);
|
|
|
|
|
if (isset($target_set[2])) {
|
|
|
|
|
$target_folder = $target_set[0] . "/" . $target_set[1];
|
|
|
|
|
$targer_day = $target_set[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$file_list = array_values(array_diff($sftp->nlist($target_folder), array(".","..")));
|
|
|
|
|
if ($targer_day !== null) {
|
|
|
|
|
$file_list = array($target_set[0] . $target_set[1] . $target_set[2] . ".xlsx");
|
|
|
|
|
}
|
|
|
|
|
// target local
|
|
|
|
|
$target_local = "statement_files/" . $target_folder;
|
|
|
|
|
if ( ! is_dir($target_local)) {
|
|
|
|
@ -24,11 +37,15 @@ $new_files = array_values(array_diff($file_list, $local_files));
|
|
|
|
|
$new_cnt = 0;
|
|
|
|
|
foreach ($new_files as $key => $new) {
|
|
|
|
|
$file_path = $target_folder . "/" . $new;
|
|
|
|
|
echo $file_path, " ", $target_local . "/" . $new;
|
|
|
|
|
echo "<br>";
|
|
|
|
|
$sftp->get($file_path, $target_local . "/" . $new);
|
|
|
|
|
$new_cnt++;
|
|
|
|
|
}
|
|
|
|
|
echo "Copied new statements count: " . $new_cnt;
|
|
|
|
|
echo "<br> new_files ", json_encode($new_files);
|
|
|
|
|
echo "<br> file_list ", json_encode($file_list);
|
|
|
|
|
|
|
|
|
|
// header("Location: http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/auto_update_statement?f=$target_folder&fjson=" . json_encode($new_files));
|
|
|
|
|
// header("Location: http://www.mycht.cn/webht.php/apps/pay/report/ipaylinks_excel?f=$target_folder&fjson=" . json_encode($new_files));
|
|
|
|
|
header("Location: http://www.mycht.cn/webht.php/apps/pay/report/ipaylinks_excel?f=$target_folder&fjson=" . json_encode($new_files));
|
|
|
|
|
// header("Location: http://202.103.68.79:8083/webht.php/apps/pay/report/ipaylinks_excel?f=$target_folder&fjson=" . json_encode($new_files));
|
|
|
|
|