示例#1
0
                        $strUP = "update o_close_bank set stat='已關帳' where stat='關帳中' and sr='{$sr}' and bank='26' limit 1 ";
                        mysql_query($strUP, $plink);
                    }
                    //更新已關金額
                    if ($Oa['stat'] == '關帳中' && !$Oa['nort']) {
                        $str = "update o_auth set close=1,clsamt=clsamt+{$BTamount} where remsg='已授權' and sr='{$authsr}' and bank='26' limit 1 ";
                        $res = mysql_query($str, $plink);
                    }
                }
                $ok++;
            }
        }
        $work_file .= "<br>AE_in/{$entditd}";
        exec("cp /manage/cronjob/AE/AE_in/{$entditd} /manage/cronjob/AE/AE_in/back/{$entditd}");
        //copy到back
        //備份檔加密
        FileEncrypt("/manage/cronjob/AE/AE_in/back/" . $entditd, 'encrypt');
        exec("rm /manage/cronjob/AE/AE_in/{$entditd}");
        //刪除
    }
}
$dd->close();
echo $OUT_mail = "資料筆數合計: {$ok} 筆" . $work_file;
//寄信通知 sftp關帳主機用
$roomtime = date("Y" . "/" . "m" . "/" . "d" . " " . "H" . ":" . "i" . ":" . "s");
//時間
$go_mail = $OVERsendMail;
$go_Subject = mb_convert_encoding("allPay關帳取回-美國運通-資料筆數" . $ok, "Big5", "UTF-8");
$go_mailBody = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=BIG5\"></head><body>{$OUT_mail} <br>";
$go_mailBody .= "<hr>{$roomtime} </body></html>";
require_once "/home/taishinbank/php_mailer/send_over.php";
//先連線FTP
$connection = ssh2_connect($SFTP_host, 22) or die("No Link");
$login = ssh2_auth_password($connection, $SFTP_id, $SFTP_ps);
if ($login) {
    echo 'FTP連線OK';
    $sftp = ssh2_sftp($connection);
    $data = file_get_contents($OUTfile, true);
    $sFTPok = file_put_contents("ssh2.sftp://{$sftp}/{$OUTfileNmae}", $data);
    if ($sFTPok) {
        //echo '送檔完成';
        $log_date = date('Ymd H:i:s') . '送檔完成' . "{$OUTfile}\n";
    } else {
        //echo '送檔失敗';
        $log_date = date('Ymd H:i:s') . '送檔失敗' . "{$OUTfile}\n";
    }
} else {
    //echo 'FTP連線失敗';
    $log_date = date('Ymd H:i:s') . 'FTP連線失敗' . "{$OUTfile}\n";
}
sleep(10);
//檔案加密
FileEncrypt($FileName_Out, 'encrypt');
//寄信通知
$roomtime = date("Y" . "/" . "m" . "/" . "d" . " " . "H" . ":" . "i" . ":" . "s");
//時間
$go_mail = $OVERsendMail;
$go_Subject = mb_convert_encoding("allPay台新產生國旅的檔案-筆數" . $app, "Big5", "UTF-8");
$go_mailBody = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=BIG5\"></head><body>allPay台新產生國旅的檔案 每日早上 01:00: {$OUTfileNmae} <hr>{$log_date}<br><br>{$roomtime}</body></html>";
require_once "/home/taishinbank/php_mailer/send_over.php";
echo 'OK';
exit;
示例#3
0
                         $ListAuthALL .= '** 失敗 ' . $aco[0] . ' ' . $amount . "<br>";
                     }
                 }
             }
         }
     }
 }
 //寫出給台鐵的檔案
 $Train_File = "Train_In_" . date("Ymd") . ".txt";
 $Train_File_Path = $DirUrlTxt . "/" . $Train_File;
 $Train_File_Path_BK = $DirUrlTxtBK . "/" . $Train_File;
 $fp = fopen("{$Train_File_Path}", "w");
 fputs($fp, $Train_File_Data);
 fclose($fp);
 //檔案加密
 FileEncrypt($Train_File_Path, 'encrypt');
 //備份
 exec("cp {$Train_File_Path} {$Train_File_Path_BK} ");
 //丟檔給 10.10.1.102
 $SFtp_host = '10.10.1.102';
 $SFtp_user = "******";
 $SFtp_pass = "******";
 $connection = ssh2_connect($SFtp_host, 22);
 $login = ssh2_auth_password($connection, $SFtp_user, $SFtp_pass);
 if ($login) {
     $sftp = ssh2_sftp($connection);
     $data = file_get_contents($Train_File_Path, true);
     $sFTPok = file_put_contents("ssh2.sftp://" . $sftp . "/Train_In_" . date("Ymd") . ".txt", $data);
     if ($sFTPok) {
         $result = 1;
         $FTPechoTO = "送台鐵平帳檔案到SFTP完成";
                $res = mysql_query($str, $plink);
            }
        } else {
            $fail_num++;
            $Error_Adata .= "單號: " . $Oa['authsr'] . " (o_close.sr: {$sr} ) 金額: {$amount} (被拒絕) <br>";
            $strUP = "update o_close set stat='被拒絕' where sr='{$sr}' and stat='關帳中' and amount='{$amount}' and bank in (18,19) limit 1 ";
            mysql_query($strUP, $plink);
            $strUP = "update o_close set bank_stat='被拒絕' where sr='{$sr}' and bank_stat='關帳中' and amount='{$amount}' and bank in (18,19) limit 1 ";
            mysql_query($strUP, $plink);
            $strUP = "update o_close_bank set stat='被拒絕' where sr='{$sr}' and stat='關帳中' and amount='{$amount}' and bank in (18,19) limit 1 ";
            mysql_query($strUP, $plink);
        }
    }
}
//備份檔加密
FileEncrypt($OUTfile, 'encrypt');
echo $ClsStat;
$all_amt = $succ_num + $fail_num;
//寄信通知
$roomtime = date("Y" . "/" . "m" . "/" . "d" . " " . "H" . ":" . "i" . ":" . "s");
//時間
$go_mail = $OVERsendMail;
if ($fail_num > 0) {
    $go_Subject = mb_convert_encoding("allPay台新取回關帳的檔案-異常-筆數" . $all_amt . "失敗筆數." . $fail_num, "Big5", "UTF-8");
} else {
    $go_Subject = mb_convert_encoding("allPay台新取回關帳的檔案-筆數" . $all_amt, "Big5", "UTF-8");
}
$go_mailBody = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=BIG5\"></head><body>allPay台新取回關帳的檔案 每日早上 11:00: {$OUTfileNmae} <hr> {$roomtime} ";
$go_mailBody .= $Error_Adata . '<hr>' . $ClsStat;
$go_mailBody .= '<hr>成功筆數: ' . $succ_num . '<br>失敗筆數: ' . $fail_num;
$go_mailBody .= "</body></html>";
示例#5
0
     $OUTfile = $DirUrlTxt . "/ALLPAY.txt";
     $fp = fopen("{$OUTfile}", "w");
     fputs($fp, $ListAuthALL);
     fclose($fp);
     $result = 1;
     $result_note = "寫檔完成";
 } else {
     $OUTfile = $DirUrlTxt . "/ALLPAY.txt";
     $fp = fopen("{$OUTfile}", "w");
     fputs($fp, $ListAuthALL);
     fclose($fp);
     $bak_FileName = $DirUrlTxtBK . '/ALLPAY_out_' . $hohsnYMD . '.txt';
     exec("cp {$OUTfile} {$bak_FileName}");
     //備份
     //備份檔加密
     FileEncrypt($bak_FileName, 'encrypt');
     $FTP_fileName = 'ALLPAY.zip';
     $OUTfileZIP = $DirUrlTxt . '/' . $FTP_fileName;
     exec("zip -P ctcbgw88 -j {$OUTfileZIP} {$OUTfile}");
     exec("rm -rf " . $DirUrlTxt . "/*.txt");
     //清掉TXT
     //先連線FTP
     $Ftp_host = '203.66.193.20';
     $Ftp_user = "******";
     $Ftp_pass = "******";
     $ftp_link = ftp_connect($Ftp_host, $Ftp_port);
     $login = ftp_login($ftp_link, $Ftp_user, $Ftp_pass);
     ftp_pasv($ftp_link, true);
     if ($login) {
         //ftp_put($ftp_link, "上傳的檔案名稱", "本地的檔案路徑", FTP_BINARY);
         ftp_put($ftp_link, $FTP_fileName, $OUTfileZIP, FTP_BINARY);
                        $strUP = "update o_close set bank_stat='已關帳' where authsr='{$authsr}' and amount='{$BTamount}' and bank_stat='關帳中' and (bank='27' or bank='28') limit 1 ";
                        mysql_query($strUP, $plink);
                        $strUP = "update o_close_bank set stat='已關帳' where authsr='{$authsr}' and amount='{$BTamount}' and stat='關帳中' and (bank='27' or bank='28') limit 1 ";
                        mysql_query($strUP, $plink);
                        if ($Oa['stat'] == '關帳中') {
                            //更新已關金額
                            $str = "update o_auth set close=1,clsamt=clsamt+{$BTamount} where remsg='已授權' and sr='{$authsr}' and (bank='27' or bank='28') limit 1 ";
                            mysql_query($str, $plink);
                        }
                    }
                } else {
                    //失敗維持關帳中, 才能發現
                }
                $ok++;
                $mall_it++;
            }
        }
        $work_file .= "<br>{$File_home_dir}/{$entditd} : {$mall_it} 筆";
        FileEncrypt($File_home_dir . "/" . $entditd, 'encrypt');
    }
}
$dd->close();
echo $OUT_mail = "資料筆數合計: {$ok} 筆" . $work_file;
//寄信通知
$roomtime = date("Y" . "/" . "m" . "/" . "d" . " " . "H" . ":" . "i" . ":" . "s");
//時間
$go_mail = $OVERsendMail;
$go_Subject = mb_convert_encoding("allPay玉山平帳取回通知-資料筆數" . $ok, "Big5", "UTF-8");
$go_mailBody = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=BIG5\"></head><body>{$OUT_mail} <br>";
$go_mailBody .= "<hr>{$roomtime} </body></html>";
require_once "/home/taishinbank/php_mailer/send_over.php";