From 8db6bc92c6abf61c0f6d67277255b7a7a8bb6e25 Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Tue, 29 Sep 2020 16:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Api/Controllers/UnionPayController.php | 8 +++++++- app/Models/{UnionPayLog.php => UnionpayLog.php} | 2 +- packages/unionpay/src/UnionPay.php | 10 +++++----- 3 files changed, 13 insertions(+), 7 deletions(-) rename app/Models/{UnionPayLog.php => UnionpayLog.php} (80%) diff --git a/app/Api/Controllers/UnionPayController.php b/app/Api/Controllers/UnionPayController.php index 364c36d..5350b4d 100644 --- a/app/Api/Controllers/UnionPayController.php +++ b/app/Api/Controllers/UnionPayController.php @@ -10,7 +10,13 @@ class UnionPayController extends Controller public function index() { - + $user_ext_info = [ + 'mobile_no' => '15663876870', + 'user_code' => '1', + 'user_code_type' => '8521475DDDeeee', + 'dev_id' => '1', + ]; + dd(json_encode($user_ext_info)); $str = 'msg_type=00&msg_txn_code=002100&msg_crrltn_id=12345678901234567890123456789000&msg_flg=0&msg_sender=01&msg_time=20130318162412&msg_sys_sn=12345678900987654321&msg_ver=0.1&mchnt_no=8981231234567890&term_no=12345678&shop_no=086123456123456789&req_serial_no=12345678900987654321&orig_req_serial_no=12345678900987654321&enc_card_no=123123123123123123123sdfadqerqr&acq_term_sn=123456&refer_no=123456789012&sett_date=20130318&txn_date=20130318&txn_time=162850&orig_amt=10000&discount_amt=2000&pay_amt=8000&pay_mode=1'; parse_str($str, $arr_str); diff --git a/app/Models/UnionPayLog.php b/app/Models/UnionpayLog.php similarity index 80% rename from app/Models/UnionPayLog.php rename to app/Models/UnionpayLog.php index e52ec04..254b874 100644 --- a/app/Models/UnionPayLog.php +++ b/app/Models/UnionpayLog.php @@ -2,7 +2,7 @@ namespace App\Models; -class UnionPayLog extends Model +class UnionpayLog extends Model { protected $casts = [ diff --git a/packages/unionpay/src/UnionPay.php b/packages/unionpay/src/UnionPay.php index a3c1d9a..5a23b15 100644 --- a/packages/unionpay/src/UnionPay.php +++ b/packages/unionpay/src/UnionPay.php @@ -13,7 +13,7 @@ class UnionPay extends Init public function __construct($params, $sign = '') { - $this->params = collect($params); + $this->params = $params; $this->sign = $sign; $this->msg_txn_code = $params['msg_txn_code']; $this->msg_sender = config('unionpay.msg_sender'); @@ -21,8 +21,8 @@ class UnionPay extends Init public function start() { - $out = $this->out(); - + $out = $this->out_data(); + dump($out); } public function out_data() @@ -30,11 +30,11 @@ class UnionPay extends Init $basics = [ "msg_type" => "00", "msg_txn_code" => $this->msg_txn_code, - "msg_crrltn_id" => $this->params->msg_crrltn_id, + "msg_crrltn_id" => $this->params['msg_crrltn_id'], "msg_flg" => 1, "msg_sender" => $this->msg_sender, "msg_time" => now()->format('YmdHis'), - "msg_sys_sn" => $this->params->msg_sys_sn, + "msg_sys_sn" => $this->params['msg_sys_sn']??, "msg_rsp_code" => "0000", "msg_rsp_desc" => "成功", ];