verifyCer($data); if ($sign != $data['sign']) { $xml = ' '; exit($xml); } if ($data['result_code'] == 'SUCCESS' && $data['return_code'] == 'SUCCESS') { if ($type == 2) { ShopOrderServer::creatServer()->OrderNotify($data['out_trade_no'], $data['transaction_id'], $data['total_fee'] / 100, 1, $data, $data['openid']); } elseif ($type == 1 || $type == 3) { PayServer::creatServer()->NotifyPay($data['out_trade_no'], $data['transaction_id'], $data['total_fee'] / 100, $data); } else { } } $xml = ' '; exit($xml); } /** * buyer_id 对应会员唯一ID * 支付宝支付回调 */ function shopOrderPayZfb() { $data = request()->input(); file_put_contents('al_pay.txt', json_encode($data)); // file_put_contents('al_pay2.txt', serialize($data)); // $data=file_get_contents('al_pay.txt'); // $data=json_decode($data,true); $is_verify = ZfbServer::creatServer()->verifyData($data); if ($is_verify) { if ((!empty($data['trade_status']) && $data['trade_status'] == 'TRADE_SUCCESS') || (!empty($data['trade_status']) && $data['trade_status'] == 'TRADE_FINISHED')) { ShopOrderServer::creatServer()->OrderNotify($data['out_trade_no'], $data['notify_id'], $data['total_amount'], 2, $data, $data['buyer_id']); } } echo 'success'; exit; } /** * 线上订单支付回调 * @throws \Exception */ function orderPayWx() { $xml = file_get_contents('php://input'); $data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); // file_put_contents('o_wx_pay.txt', json_encode($data)); // $data=file_get_contents('wx_pay.txt'); // $data=json_decode($data,true); $sign = WeixinServer::creatServer()->verifyCer($data); if ($sign != $data['sign']) { $xml = ' '; exit($xml); } if ($data['result_code'] == 'SUCCESS' && $data['return_code'] == 'SUCCESS') { // ShopOrderServer::creatServer()->OrderNotify($data['out_trade_no'], $data['transaction_id'],$data['total_fee']/100,1, $data,$data['openid']); PayServer::creatServer()->NotifyPay($data['out_trade_no'], $data['transaction_id'], $data['total_fee'] / 100, $data); } $xml = ' '; exit($xml); } /** * 线上订单支付宝支付 * @throws \Exception */ function orderPayZfb() { $data = request()->input(); // file_put_contents('o_al_pay.txt', json_encode($data)); // file_put_contents('al_pay2.txt', serialize($data)); // $data=file_get_contents('al_pay.txt'); // $data=json_decode($data,true); $is_verify = ZfbServer::creatServer()->verifyData($data); if ($is_verify) { if ((!empty($data['trade_status']) && $data['trade_status'] == 'TRADE_SUCCESS') || (!empty($data['trade_status']) && $data['trade_status'] == 'TRADE_FINISHED')) { // ShopOrderServer::creatServer()->OrderNotify($data['out_trade_no'], $data['notify_id'],$data['total_amount'],2, $data,$data['buyer_id']); PayServer::creatServer()->NotifyPay($data['out_trade_no'], $data['notify_id'], $data['total_amount'], $data); } } echo 'success'; exit; } }