Compare commits

1 Commits

Author SHA1 Message Date
95e1f4a163 调整支付 2023-09-06 11:22:06 +08:00
6 changed files with 19 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ class CreateWoUnicomWebsTable extends Migration
*/
public function up()
{
Schema::create('wo_unicom_webs', function (Blueprint $table) {
Schema::create('wounicom_webs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('orderId')->nullable()->comment('订单号');
$table->string('payFloodId')->nullable()->comment('交易流水号');
@@ -34,6 +34,6 @@ class CreateWoUnicomWebsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('wo_unicom_webs');
Schema::dropIfExists('wounicom_webs');
}
}

View File

@@ -161,6 +161,7 @@ class Init
public function getSign(): string
{
$signStr = $this->getSignString();
$private_key = $this->getPrivate();
$privKeyId = openssl_get_privatekey($private_key);
@@ -196,7 +197,9 @@ class Init
ksort($params);
$signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|')));
$signStr .= '|key='.$this->key;
$this->signStr = $signStr;
// $signStr .= '|key='.$this->key;
return $signStr;
}
@@ -319,8 +322,8 @@ class Init
if ($response->getStatusCode() == 200) {
$body = $response->getBody();
$content = str_replace(["\r\n", "\n", "\r", '/n', "\\n",], '&', $body->getContents());
parse_str($content, $data);
parse_str($content, $data);
$this->data = $data;
if (isset($data['queryResult']) && $data['queryResult'] != 'SUCCESS') {

View File

@@ -20,7 +20,8 @@ class Order extends Init
{
$this->addData();
$this->setSignData();
// dump($this);
// dump($this->params);
return $this->getUnicomData('$');
}

View File

@@ -4,6 +4,7 @@ namespace XuanChen\WoUnicomWeb\Action;
/**
* Class Order 查询
*
* @Author : 玄尘
* @Date : 2021/4/30 9:34
* @package XuanChen\Coupon\Action
@@ -16,7 +17,7 @@ class Query extends Init
$this->setIsLower(false);
$this->addData();
$this->setSignData();
$url = config('wounicom.uri.unicom.query');
$url = config('wounicomweb.uri.unicom.query');
$this->sendPost($this->params, $url);
return $this->respond();
@@ -25,17 +26,15 @@ class Query extends Init
public function addData()
{
$order = $this->params;
$data = [
$data = [
'merNo' => $this->merNo,
'orderNo' => $order->orderid,
'orderDate' => $order->created_at->format('Ymd'),
'charSet' => 'UTF-8',
'signType' => config('wounicom.signType'),
'signType' => config('wounicomweb.signType'),
];
$this->params = $data;
}
}

View File

@@ -6,6 +6,7 @@ use Carbon\Carbon;
/**
* Class Order 退款
*
* @Author : 玄尘
* @Date : 2021/4/30 9:34
* @package XuanChen\Coupon\Action
@@ -18,7 +19,7 @@ class Refund extends Init
$this->reSetParams();
$this->setIsLower(false);
$this->setSignData();
$url = config('wounicom.uri.unicom.refund');
$url = config('wounicomweb.uri.unicom.refund');
$this->sendPost($this->params, $url);
return $this->respond();
@@ -29,15 +30,15 @@ class Refund extends Init
$order = $this->params;
$data = [
'refundReqJournl' => 'R' . date('YmdHis') . sprintf('%06d', rand(1, 999999999)),
'refundReqJournl' => 'R'.date('YmdHis').sprintf('%06d', rand(1, 999999999)),
'merNo' => $this->merNo,
'orderNo' => $order->orderid,
'orderDate' => $order->created_at->format('Ymd'),
'payJournl' => $order->payment->out_trade_no,
'merReqTime' => Carbon::now()->format('YmdHis'),
'amount' => $order->payment->amount * 100,
'amount' => bcmul($order->payment->amount,100),
'reason' => '退款',
'signType' => 'RSA_SHA256',
'signType' => config('wounicomweb.signType'),
];
$this->params = $data;

View File

@@ -8,7 +8,7 @@ class WounicomWeb extends Model
{
protected $guarded = [];
public $casts = [
'source' => 'json',
'outsource' => 'json',