From d0ae80aeff25e0e5428c435fc4d294382a60266a Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Fri, 9 Oct 2020 09:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/unionpay.php | 1 + packages/unionpay/src/UnionPay.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/unionpay.php b/config/unionpay.php index b1983ca..ef62bf6 100644 --- a/config/unionpay.php +++ b/config/unionpay.php @@ -26,6 +26,7 @@ return [ 'public' => storage_path('cert/unionpay/public_rsa.pem'), ], ], + //基础数据 'regular' => [ '002025' => [ "msg_type", diff --git a/packages/unionpay/src/UnionPay.php b/packages/unionpay/src/UnionPay.php index 19eef25..2cb33f4 100644 --- a/packages/unionpay/src/UnionPay.php +++ b/packages/unionpay/src/UnionPay.php @@ -13,6 +13,11 @@ use XuanChen\Coupon\Coupon; class UnionPay extends Init { + /** + * UnionPay constructor. + * @param $params + * @param string $sign + */ public function __construct($params, $sign = '') { $this->params = $params; @@ -22,6 +27,11 @@ class UnionPay extends Init $this->outlet_id = config('unionpay.outlet_id'); } + /** + * Notes: 入口 + * @Author: 玄尘 + * @Date : 2020/10/9 9:33 + */ public function start() { $this->updateInputData(); @@ -49,13 +59,15 @@ class UnionPay extends Init break; //销账交易接口 case '002100': + //查询聚合信息 $info = UnionpayLog::where('msg_crrltn_id', $this->params['msg_crrltn_id']) ->where('msg_txn_code', '002025') ->latest() ->first(); - + //获取配置数据 $conf_unionpay = config('unionpay'); + //获取银联渠道 $user = User::find($conf_unionpay['agent_id']); if ($info) { @@ -144,6 +156,7 @@ class UnionPay extends Init $this->params['msg_sys_sn'] = date('ymdHis') . sprintf('%06d', rand(1, 99999999)); } + //获取基础数据 $base = config('unionpay.regular')[$this->msg_txn_code]; $data = []; foreach ($this->params as $key => $param) {