This commit is contained in:
2020-09-29 16:56:10 +08:00
parent 3a8093bb57
commit 8db6bc92c6
3 changed files with 13 additions and 7 deletions

View File

@@ -10,7 +10,13 @@ class UnionPayController extends Controller
public function index() 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'; $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); parse_str($str, $arr_str);

View File

@@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
class UnionPayLog extends Model class UnionpayLog extends Model
{ {
protected $casts = [ protected $casts = [

View File

@@ -13,7 +13,7 @@ class UnionPay extends Init
public function __construct($params, $sign = '') public function __construct($params, $sign = '')
{ {
$this->params = collect($params); $this->params = $params;
$this->sign = $sign; $this->sign = $sign;
$this->msg_txn_code = $params['msg_txn_code']; $this->msg_txn_code = $params['msg_txn_code'];
$this->msg_sender = config('unionpay.msg_sender'); $this->msg_sender = config('unionpay.msg_sender');
@@ -21,8 +21,8 @@ class UnionPay extends Init
public function start() public function start()
{ {
$out = $this->out(); $out = $this->out_data();
dump($out);
} }
public function out_data() public function out_data()
@@ -30,11 +30,11 @@ class UnionPay extends Init
$basics = [ $basics = [
"msg_type" => "00", "msg_type" => "00",
"msg_txn_code" => $this->msg_txn_code, "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_flg" => 1,
"msg_sender" => $this->msg_sender, "msg_sender" => $this->msg_sender,
"msg_time" => now()->format('YmdHis'), "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_code" => "0000",
"msg_rsp_desc" => "成功", "msg_rsp_desc" => "成功",
]; ];