This commit is contained in:
2020-10-09 09:47:34 +08:00
parent f6c4ba3ae5
commit d0ae80aeff
2 changed files with 15 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ return [
'public' => storage_path('cert/unionpay/public_rsa.pem'), 'public' => storage_path('cert/unionpay/public_rsa.pem'),
], ],
], ],
//基础数据
'regular' => [ 'regular' => [
'002025' => [ '002025' => [
"msg_type", "msg_type",

View File

@@ -13,6 +13,11 @@ use XuanChen\Coupon\Coupon;
class UnionPay extends Init class UnionPay extends Init
{ {
/**
* UnionPay constructor.
* @param $params
* @param string $sign
*/
public function __construct($params, $sign = '') public function __construct($params, $sign = '')
{ {
$this->params = $params; $this->params = $params;
@@ -22,6 +27,11 @@ class UnionPay extends Init
$this->outlet_id = config('unionpay.outlet_id'); $this->outlet_id = config('unionpay.outlet_id');
} }
/**
* Notes: 入口
* @Author: 玄尘
* @Date : 2020/10/9 9:33
*/
public function start() public function start()
{ {
$this->updateInputData(); $this->updateInputData();
@@ -49,13 +59,15 @@ class UnionPay extends Init
break; break;
//销账交易接口 //销账交易接口
case '002100': case '002100':
//查询聚合信息
$info = UnionpayLog::where('msg_crrltn_id', $this->params['msg_crrltn_id']) $info = UnionpayLog::where('msg_crrltn_id', $this->params['msg_crrltn_id'])
->where('msg_txn_code', '002025') ->where('msg_txn_code', '002025')
->latest() ->latest()
->first(); ->first();
//获取配置数据
$conf_unionpay = config('unionpay'); $conf_unionpay = config('unionpay');
//获取银联渠道
$user = User::find($conf_unionpay['agent_id']); $user = User::find($conf_unionpay['agent_id']);
if ($info) { if ($info) {
@@ -144,6 +156,7 @@ class UnionPay extends Init
$this->params['msg_sys_sn'] = date('ymdHis') . sprintf('%06d', rand(1, 99999999)); $this->params['msg_sys_sn'] = date('ymdHis') . sprintf('%06d', rand(1, 99999999));
} }
//获取基础数据
$base = config('unionpay.regular')[$this->msg_txn_code]; $base = config('unionpay.regular')[$this->msg_txn_code];
$data = []; $data = [];
foreach ($this->params as $key => $param) { foreach ($this->params as $key => $param) {