|
- <?php
- /*
- Author:XM
- Compeny:Spiders Travel
- */
- require_once './Config2.php';
- require_once './class.db.inc';
- require_once './disney.inc';
- require_once './Function.php';
- require_once './zizai_api.inc';
-
- $postStr = file_get_contents("php://input");
- $filename='pay_callback.log';
- success_notify(json_encode($postStr),$filename);
- if (!empty($postStr)){
- libxml_disable_entity_loader(true);
- $dataArray= (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
- foreach ($dataArray as $key=>$v){
- success_notify($key."--".$v,$filename);
- }
- $ordernoArr=$dataArray['out_trade_no'];
- $ordernoArray=explode('-', $ordernoArr);
- $orderno=$ordernoArray[0];
- $transaction_id=$dataArray['transaction_id'];
- //DB
- $objDbh = new Db;
- $objDbh->setAccount(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
- $objDisney = new DbDisney($objDbh);
- $sendArray=$objDisney->getUnpaidOrder($orderno);
- //need add code here(use zizai api)
- $update_array=array("status" => 1,"is_payed"=>1,"pay_type"=>1,"pay_no"=>$transaction_id);
- if( $sendArray["good_type"] == 2 || $sendArray["good_type"] == 3 ) {
- $trade_no = $sendArray["outside_order_no"];
- if( $trade_no != "" && mb_strlen($trade_no) > 0 ) {
- $result_info = eticket( API_USER, API_PASSWORD, $trade_no);
- if( $result_info["code"] == 0 ) {
- $update_array["comment"] = "已在自在自动下单,订单号:".$trade_no;
- } else {
- $update_array["comment"] = "自在自动下单失败,失败原因:".$result_info["info"];
- }
- }
- }
-
- $result=$objDisney->updateOrderCommonInfo($orderno, $update_array);
- success_notify('$reslut::'.$result);
- if($result !==false){
- success_notify("orderno".$orderno);
- /*
- $org_address = "";
- if( $sendArray['good_type'] == 1 && $sendArray['org_id'] > 0 ) {
- $org_info = $objDisney->getBaseOrgInfoFromId($sendArray['org_id']);
- $org_address = false != $org_info ? $org_info["org_address"] : "";
- }
- $send_message = getSendMessage( $sendArray['good_type'], $sendArray['cus_name'], $sendArray['start_date'], $sendArray['prod_name'], $org_address );
- success_notify("sendTelMessage".json_encode($sendArray));
- sendTelMessage($sendArray['cus_mobile'],$sendArray['cus_name'],$send_message,$sendArray['order_serial_no']);
- */
- $xml="<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
- echo $xml;
- }
- }
- function success_notify($result){
- file_put_contents('./disney_pay_callback.txt', date("Y-m-d H:i:s")." ".$result.PHP_EOL,FILE_APPEND);//订单成功后通知后台日志
- }
|