mirror of
https://gitee.com/niucloud-team/niucloud.git
synced 2025-12-14 02:22:48 +00:00
up
This commit is contained in:
parent
bae138de57
commit
8c0e4ad87a
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'version' => '0.5.2',
|
'version' => '0.5.3',
|
||||||
'code' => '202409120001'
|
'code' => '202410280001'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -5,11 +5,13 @@ namespace core\pay;
|
|||||||
use app\dict\pay\OnlinePayDict;
|
use app\dict\pay\OnlinePayDict;
|
||||||
use app\dict\pay\RefundDict;
|
use app\dict\pay\RefundDict;
|
||||||
use app\dict\pay\TransferDict;
|
use app\dict\pay\TransferDict;
|
||||||
|
use core\exception\CommonException;
|
||||||
use core\exception\PayException;
|
use core\exception\PayException;
|
||||||
use Psr\Http\Message\MessageInterface;
|
use Psr\Http\Message\MessageInterface;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use think\Response;
|
use think\Response;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
use Yansongda\Artful\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
@ -48,6 +50,7 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function mp(array $params)
|
public function mp(array $params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$result = $this->returnFormat(Pay::wechat()->mp([
|
$result = $this->returnFormat(Pay::wechat()->mp([
|
||||||
'out_trade_no' => $params['out_trade_no'],
|
'out_trade_no' => $params['out_trade_no'],
|
||||||
'description' => $params['body'],
|
'description' => $params['body'],
|
||||||
@ -62,8 +65,13 @@ class Wechatpay extends BasePay
|
|||||||
if ($code == 0) return $result;
|
if ($code == 0) return $result;
|
||||||
//支付错误抛出
|
//支付错误抛出
|
||||||
throw new PayException($result['message']);
|
throw new PayException($result['message']);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机网页支付
|
* 手机网页支付
|
||||||
@ -72,6 +80,7 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function wap(array $params)
|
public function wap(array $params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$order = [
|
$order = [
|
||||||
'out_trade_no' => $params['out_trade_no'],
|
'out_trade_no' => $params['out_trade_no'],
|
||||||
'description' => $params['body'],
|
'description' => $params['body'],
|
||||||
@ -90,6 +99,12 @@ class Wechatpay extends BasePay
|
|||||||
$order['_type'] = 'mini'; // 注意这一行
|
$order['_type'] = 'mini'; // 注意这一行
|
||||||
}
|
}
|
||||||
return $this->returnFormat(Pay::wechat()->h5($order));
|
return $this->returnFormat(Pay::wechat()->h5($order));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function web(array $params)
|
public function web(array $params)
|
||||||
@ -104,6 +119,7 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function app(array $params)
|
public function app(array $params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
return $this->returnFormat(Pay::wechat()->app([
|
return $this->returnFormat(Pay::wechat()->app([
|
||||||
'out_trade_no' => $params['out_trade_no'],
|
'out_trade_no' => $params['out_trade_no'],
|
||||||
'description' => $params['body'],
|
'description' => $params['body'],
|
||||||
@ -111,6 +127,12 @@ class Wechatpay extends BasePay
|
|||||||
'total' => $params['money'],
|
'total' => $params['money'],
|
||||||
],
|
],
|
||||||
]));
|
]));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +142,7 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function mini(array $params)
|
public function mini(array $params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
return $this->returnFormat(Pay::wechat()->mini([
|
return $this->returnFormat(Pay::wechat()->mini([
|
||||||
'out_trade_no' => $params['out_trade_no'],
|
'out_trade_no' => $params['out_trade_no'],
|
||||||
'description' => $params['body'],
|
'description' => $params['body'],
|
||||||
@ -131,6 +154,12 @@ class Wechatpay extends BasePay
|
|||||||
'openid' => $params['openid'],
|
'openid' => $params['openid'],
|
||||||
]
|
]
|
||||||
]));
|
]));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,6 +169,7 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function pos(array $params)
|
public function pos(array $params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$order = [
|
$order = [
|
||||||
'out_trade_no' => $params['out_trade_no'],
|
'out_trade_no' => $params['out_trade_no'],
|
||||||
'body' => $params['body'],
|
'body' => $params['body'],
|
||||||
@ -149,6 +179,12 @@ class Wechatpay extends BasePay
|
|||||||
];
|
];
|
||||||
$result = Pay::wechat()->pos($order);
|
$result = Pay::wechat()->pos($order);
|
||||||
return $this->returnFormat($result);
|
return $this->returnFormat($result);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,6 +194,7 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function scan(array $params)
|
public function scan(array $params)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
return $this->returnFormat(Pay::wechat()->scan([
|
return $this->returnFormat(Pay::wechat()->scan([
|
||||||
'out_trade_no' => $params['out_trade_no'],
|
'out_trade_no' => $params['out_trade_no'],
|
||||||
'description' => $params['body'],
|
'description' => $params['body'],
|
||||||
@ -165,6 +202,12 @@ class Wechatpay extends BasePay
|
|||||||
'total' => $params['money'],
|
'total' => $params['money'],
|
||||||
],
|
],
|
||||||
]));
|
]));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user