feat: 修改了支付方式处理逻辑

This commit is contained in:
mkm 2024-06-22 17:58:58 +08:00
parent 74e70c92bb
commit 2a02ac8213
7 changed files with 61 additions and 37 deletions

View File

@ -139,8 +139,10 @@ class StoreOrderController extends BaseAdminController
$auth_code = $this->request->post('auth_code'); //微信支付条码 $auth_code = $this->request->post('auth_code'); //微信支付条码
$uid = $this->request->post('uid'); $uid = $this->request->post('uid');
$params = $this->request->post(); $params = $this->request->post();
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS if (
&& $pay_type != PayEnum::GIFT_FUNDS) { $auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS
&& $pay_type != PayEnum::GIFT_FUNDS
) {
return $this->fail('支付条码不能为空'); return $this->fail('支付条码不能为空');
} }
if (count($cartId) > 100) { if (count($cartId) > 100) {
@ -360,6 +362,11 @@ class StoreOrderController extends BaseAdminController
$order = UserRecharge::create($data); $order = UserRecharge::create($data);
$order['pay_price'] = $order['price']; $order['pay_price'] = $order['price'];
switch ($pay_type) { switch ($pay_type) {
case PayEnum::CASH_PAY:
//现金支付
PayNotifyLogic::handle('recharge', $order['order_id'], $order);
return $this->success('现金支付成功', ['id' => $order['id']]);
break;
case PayEnum::WECHAT_PAY_BARCODE: case PayEnum::WECHAT_PAY_BARCODE:
//微信条码支付 //微信条码支付
$result = PaymentLogic::codepay($auth_code, $order); $result = PaymentLogic::codepay($auth_code, $order);

View File

@ -48,7 +48,7 @@
"next/var-dumper": "^0.1.0", "next/var-dumper": "^0.1.0",
"w7corp/easywechat": "^6.8", "w7corp/easywechat": "^6.8",
"hyperf/pimple": "~2.2.0", "hyperf/pimple": "~2.2.0",
"yansongda/pay": "~3.7.3", "yansongda/pay": "^3.7",
"webman/redis-queue": "^1.3", "webman/redis-queue": "^1.3",
"webman/push": "^1.0", "webman/push": "^1.0",
"ext-bcmath": "*", "ext-bcmath": "*",

20
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "54acb0fe3bc70f1e94406e7b79e84b8a", "content-hash": "86e88af6d3f2d3a637cb64522dc7ad21",
"packages": [ "packages": [
{ {
"name": "aliyuncs/oss-sdk-php", "name": "aliyuncs/oss-sdk-php",
@ -7167,17 +7167,23 @@
}, },
{ {
"name": "yansongda/pay", "name": "yansongda/pay",
"version": "v3.7.3", "version": "v3.7.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/yansongda/pay.git", "url": "https://github.com/yansongda/pay.git",
"reference": "747806ee09caa53702b87d6a805c84f072898e1a" "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/yansongda/pay/zipball/747806ee09caa53702b87d6a805c84f072898e1a", "url": "https://api.github.com/repos/yansongda/pay/zipball/a57a52f057aa4ca49afa14bd61b888885e1eed28",
"reference": "747806ee09caa53702b87d6a805c84f072898e1a", "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28",
"shasum": "" "shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"ext-bcmath": "*", "ext-bcmath": "*",
@ -7235,7 +7241,7 @@
"issues": "https://github.com/yansongda/pay/issues", "issues": "https://github.com/yansongda/pay/issues",
"source": "https://github.com/yansongda/pay" "source": "https://github.com/yansongda/pay"
}, },
"time": "2024-05-08T15:13:04+00:00" "time": "2024-05-16T13:31:29+00:00"
}, },
{ {
"name": "yansongda/supports", "name": "yansongda/supports",

View File

@ -7482,18 +7482,24 @@
}, },
{ {
"name": "yansongda/pay", "name": "yansongda/pay",
"version": "v3.7.3", "version": "v3.7.4",
"version_normalized": "3.7.3.0", "version_normalized": "3.7.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/yansongda/pay.git", "url": "https://github.com/yansongda/pay.git",
"reference": "747806ee09caa53702b87d6a805c84f072898e1a" "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/yansongda/pay/zipball/747806ee09caa53702b87d6a805c84f072898e1a", "url": "https://api.github.com/repos/yansongda/pay/zipball/a57a52f057aa4ca49afa14bd61b888885e1eed28",
"reference": "747806ee09caa53702b87d6a805c84f072898e1a", "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28",
"shasum": "" "shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"ext-bcmath": "*", "ext-bcmath": "*",
@ -7521,7 +7527,7 @@
"symfony/psr-http-message-bridge": "^2.1", "symfony/psr-http-message-bridge": "^2.1",
"symfony/var-dumper": "^5.1" "symfony/var-dumper": "^5.1"
}, },
"time": "2024-05-08T15:13:04+00:00", "time": "2024-05-16T13:31:29+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -1074,9 +1074,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'yansongda/pay' => array( 'yansongda/pay' => array(
'pretty_version' => 'v3.7.3', 'pretty_version' => 'v3.7.4',
'version' => '3.7.3.0', 'version' => '3.7.4.0',
'reference' => '747806ee09caa53702b87d6a805c84f072898e1a', 'reference' => 'a57a52f057aa4ca49afa14bd61b888885e1eed28',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../yansongda/pay', 'install_path' => __DIR__ . '/../yansongda/pay',
'aliases' => array(), 'aliases' => array(),

View File

@ -1,3 +1,9 @@
## v3.7.4
### optimized
- optimize: 使用 is_file 代替字符串结尾判断(#982)
## v3.7.3 ## v3.7.3
### fixed ### fixed

View File

@ -25,7 +25,6 @@ use Yansongda\Pay\Provider\Alipay;
use Yansongda\Pay\Provider\Unipay; use Yansongda\Pay\Provider\Unipay;
use Yansongda\Pay\Provider\Wechat; use Yansongda\Pay\Provider\Wechat;
use Yansongda\Supports\Collection; use Yansongda\Supports\Collection;
use Yansongda\Supports\Str;
use function Yansongda\Artful\get_radar_body; use function Yansongda\Artful\get_radar_body;
use function Yansongda\Artful\get_radar_method; use function Yansongda\Artful\get_radar_method;
@ -37,12 +36,12 @@ function get_tenant(array $params = []): string
function get_public_cert(string $key): string function get_public_cert(string $key): string
{ {
return Str::endsWith($key, ['.cer', '.crt', '.pem']) ? file_get_contents($key) : $key; return is_file($key) ? file_get_contents($key) : $key;
} }
function get_private_cert(string $key): string function get_private_cert(string $key): string
{ {
if (Str::endsWith($key, ['.crt', '.pem'])) { if (is_file($key)) {
return file_get_contents($key); return file_get_contents($key);
} }