软路由支付

This commit is contained in:
“wanyongkang”
2022-04-09 14:33:48 +08:00
parent 2bd84fb44f
commit d14337e3b3
2 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
namespace app\common;
use app\ros\model\Order as OrderModel;
class Wxpay {
/**
* @description: 获取支付宝是否支付成功
* @param {*}
* @return {*}
*/
public function wxpayVerify() {
//接收数据
$xmlData = file_get_contents('php://input');
libxml_disable_entity_loader(true);
$data = json_decode(json_encode(simplexml_load_string($xmlData, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
$order_model = new OrderModel();
$order_no = $data['out_trade_no'];
$wx_no = $data['transaction_id'];
//获取充值信息
$order_info = $order_model->getOne(['order_no'=>$order_no]);
if (!empty($order_info['ali_wx_no'])) {
die;
}
//判断算出的签名和通知信息的签名是否一致
if($data['result_code'] == 'SUCCESS' && $data['appid'] == 'wx18e5b4f42773c3ec' && $data['mch_id'] == '1571608411'){
$update_data = [];
//更新充值订单
$update_data['ali_wx_no'] = $wx_no;
$update_data['status'] = 1;
$order_model->updateOne(['order_no'=>$order_no],$update_data);
//处理完成之后,告诉微信成功结果
echo '<xml>
<return_code><![CDATA[SUCCESS]]></return_code>
<return_msg><![CDATA[OK]]></return_msg>
</xml>';
exit();
}
}
}