123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php
- namespace App\Http\Controllers\Wap;
- use App\Http\Controllers\FrontController;
- use App\Models\Comment;
- use App\Models\GoodsCollect;
- use App\Models\Member;
- use App\Models\MemberAddress;
- use App\Models\MemberClan;
- use App\Models\MemberOpenId;
- use App\Models\Members;
- use App\Models\Order;
- use App\Models\Shop;
- use App\Models\ShopCollect;
- use App\Servers\AddressServer;
- use App\Servers\AlbumServer;
- use App\Servers\CommonServer;
- use App\Servers\MemberLogsServer;
- use App\Servers\MemberServer;
- use App\Servers\PassServer;
- use App\Servers\PayServer;
- use App\Servers\RedisDataServer;
- use App\Servers\ShopFileServer;
- use App\Servers\ShopOrderServer;
- use App\Servers\SmsServer;
- use App\Servers\WeixinServer;
- use App\Servers\ZfbServer;
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
- class NotifyController extends FrontController
- {
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * 线下支付微信支付回调
- * @throws \Exception
- */
- function shopOrderPayWx()
- {
- //回调类型
- $xml = file_get_contents('php://input');
- $data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
- // file_put_contents('wx_pay.txt', json_encode($data));
- // file_put_contents('asdas.txt', json_encode($data));
- // $data=file_get_contents('wx_pay.txt');
- // $data=json_decode($data,true);
- $type = 1;
- if (isset($data['type'])) {
- $type = $data['type'];
- unset($data['type']);
- }
- $sign = WeixinServer::creatServer()->verifyCer($data);
- if ($sign != $data['sign']) {
- $xml = '<xml>
- <return_code><![CDATA[SUCCESS]]></return_code>
- <return_msg><![CDATA[OK]]></return_msg>
- </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 = '<xml>
- <return_code><![CDATA[SUCCESS]]></return_code>
- <return_msg><![CDATA[OK]]></return_msg>
- </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 = '<xml>
- <return_code><![CDATA[SUCCESS]]></return_code>
- <return_msg><![CDATA[OK]]></return_msg>
- </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 = '<xml>
- <return_code><![CDATA[SUCCESS]]></return_code>
- <return_msg><![CDATA[OK]]></return_msg>
- </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;
- }
- }
|