diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 6cf10d97d..1c8f35bd5 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -84,7 +84,7 @@ class StoreOrderController extends BaseAdminController $cartId = (array)$this->request->post('cart_id', []); $params = $this->request->post(); $params['store_id'] = $this->adminInfo['store_id']; - $user=User::where('id',$params['uid'])->find(); + $user = User::where('id', $params['uid'])->find(); $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, $user, $params); if ($res == false) { $msg = StoreOrderLogic::getError(); @@ -109,17 +109,17 @@ class StoreOrderController extends BaseAdminController if (!$order) { return $this->fail(StoreOrderLogic::getError()); } - if($params['type'] == 1){ + if ($params['type'] == 1) { if ($order['order']['pay_price'] > $user['purchase_funds']) { return $this->fail('当前用户采购款不足支付'); } - }elseif ($params['type'] == 2){ + } elseif ($params['type'] == 2) { if ($order['order']['pay_price'] > $user['integral']) { return $this->fail('当前用户礼品券不足支付'); } } - $res = (new StoreOrderLogic())->dealSendSms($params,$params['type']); + $res = (new StoreOrderLogic())->dealSendSms($params, $params['type']); if ($res) { return $this->success('发送成功', [], 1, 0); } else { @@ -137,25 +137,27 @@ class StoreOrderController extends BaseAdminController $pay_type = (int)$this->request->post('pay_type'); $addressId = (int)$this->request->post('address_id'); $auth_code = $this->request->post('auth_code'); //微信支付条码 - $uid=$this->request->post('uid'); + $uid = $this->request->post('uid'); $params = $this->request->post(); - if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS - && $pay_type != PayEnum::GIFT_FUNDS) { + if ( + $auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS + && $pay_type != PayEnum::GIFT_FUNDS + ) { return $this->fail('支付条码不能为空'); } if (count($cartId) > 100) { return $this->fail('购物车商品不能超过100个'); } - if($pay_type == PayEnum::PURCHASE_FUNDS){ - $remark = $uid.'_smsPay'; + if ($pay_type == PayEnum::PURCHASE_FUNDS) { + $remark = $uid . '_smsPay'; $code = Cache::get($remark); if ($code && isset($params['code']) && $code != $params['code']) { throw new Exception('验证码错误'); } } - if($pay_type == PayEnum::GIFT_FUNDS){ - $remark = $uid.'_giftPay'; + if ($pay_type == PayEnum::GIFT_FUNDS) { + $remark = $uid . '_giftPay'; $code = Cache::get($remark); if ($code && isset($params['code']) && $code != $params['code']) { throw new Exception('验证码错误'); @@ -173,15 +175,15 @@ class StoreOrderController extends BaseAdminController case PayEnum::PURCHASE_FUNDS: //采购款支付 PayNotifyLogic::handle('purchase_funds', $order['order_id'], [ - 'uid' => $uid,'store_id'=>$this->request->adminInfo['store_id'], - 'staff_id'=>$this->request->adminInfo['admin_id'] + 'uid' => $uid, 'store_id' => $this->request->adminInfo['store_id'], + 'staff_id' => $this->request->adminInfo['admin_id'] ]); return $this->success('采购款支付成功', ['id' => $order['id']]); case PayEnum::GIFT_FUNDS: //礼品券支付 - PayNotifyLogic::handle('gift_pay', $order['order_id'],[ - 'store_id'=>$this->request->adminInfo['store_id'], - 'staff_id'=>$this->request->adminInfo['admin_id'] + PayNotifyLogic::handle('gift_pay', $order['order_id'], [ + 'store_id' => $this->request->adminInfo['store_id'], + 'staff_id' => $this->request->adminInfo['admin_id'] ]); return $this->success('礼品券支付成功', ['id' => $order['id']]); case PayEnum::CASH_PAY: @@ -360,6 +362,11 @@ class StoreOrderController extends BaseAdminController $order = UserRecharge::create($data); $order['pay_price'] = $order['price']; 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: //微信条码支付 $result = PaymentLogic::codepay($auth_code, $order); diff --git a/composer.json b/composer.json index 5a665d605..d51fe4f0e 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "next/var-dumper": "^0.1.0", "w7corp/easywechat": "^6.8", "hyperf/pimple": "~2.2.0", - "yansongda/pay": "~3.7.3", + "yansongda/pay": "^3.7", "webman/redis-queue": "^1.3", "webman/push": "^1.0", "ext-bcmath": "*", diff --git a/composer.lock b/composer.lock index 02626c932..147b8916d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "54acb0fe3bc70f1e94406e7b79e84b8a", + "content-hash": "86e88af6d3f2d3a637cb64522dc7ad21", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -7167,17 +7167,23 @@ }, { "name": "yansongda/pay", - "version": "v3.7.3", + "version": "v3.7.4", "source": { "type": "git", "url": "https://github.com/yansongda/pay.git", - "reference": "747806ee09caa53702b87d6a805c84f072898e1a" + "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yansongda/pay/zipball/747806ee09caa53702b87d6a805c84f072898e1a", - "reference": "747806ee09caa53702b87d6a805c84f072898e1a", - "shasum": "" + "url": "https://api.github.com/repos/yansongda/pay/zipball/a57a52f057aa4ca49afa14bd61b888885e1eed28", + "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-bcmath": "*", @@ -7235,7 +7241,7 @@ "issues": "https://github.com/yansongda/pay/issues", "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", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 9dfcf3b4e..75033121f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -7482,18 +7482,24 @@ }, { "name": "yansongda/pay", - "version": "v3.7.3", - "version_normalized": "3.7.3.0", + "version": "v3.7.4", + "version_normalized": "3.7.4.0", "source": { "type": "git", "url": "https://github.com/yansongda/pay.git", - "reference": "747806ee09caa53702b87d6a805c84f072898e1a" + "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yansongda/pay/zipball/747806ee09caa53702b87d6a805c84f072898e1a", - "reference": "747806ee09caa53702b87d6a805c84f072898e1a", - "shasum": "" + "url": "https://api.github.com/repos/yansongda/pay/zipball/a57a52f057aa4ca49afa14bd61b888885e1eed28", + "reference": "a57a52f057aa4ca49afa14bd61b888885e1eed28", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-bcmath": "*", @@ -7521,7 +7527,7 @@ "symfony/psr-http-message-bridge": "^2.1", "symfony/var-dumper": "^5.1" }, - "time": "2024-05-08T15:13:04+00:00", + "time": "2024-05-16T13:31:29+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index b1b2bed46..7a15816c4 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1074,9 +1074,9 @@ 'dev_requirement' => false, ), 'yansongda/pay' => array( - 'pretty_version' => 'v3.7.3', - 'version' => '3.7.3.0', - 'reference' => '747806ee09caa53702b87d6a805c84f072898e1a', + 'pretty_version' => 'v3.7.4', + 'version' => '3.7.4.0', + 'reference' => 'a57a52f057aa4ca49afa14bd61b888885e1eed28', 'type' => 'library', 'install_path' => __DIR__ . '/../yansongda/pay', 'aliases' => array(), diff --git a/vendor/yansongda/pay/CHANGELOG.md b/vendor/yansongda/pay/CHANGELOG.md index 460ff177d..3d3fcfcbc 100644 --- a/vendor/yansongda/pay/CHANGELOG.md +++ b/vendor/yansongda/pay/CHANGELOG.md @@ -1,3 +1,9 @@ +## v3.7.4 + +### optimized + +- optimize: 使用 is_file 代替字符串结尾判断(#982) + ## v3.7.3 ### fixed diff --git a/vendor/yansongda/pay/src/Functions.php b/vendor/yansongda/pay/src/Functions.php index 420b50bb3..0a3018410 100644 --- a/vendor/yansongda/pay/src/Functions.php +++ b/vendor/yansongda/pay/src/Functions.php @@ -25,7 +25,6 @@ use Yansongda\Pay\Provider\Alipay; use Yansongda\Pay\Provider\Unipay; use Yansongda\Pay\Provider\Wechat; use Yansongda\Supports\Collection; -use Yansongda\Supports\Str; use function Yansongda\Artful\get_radar_body; use function Yansongda\Artful\get_radar_method; @@ -37,12 +36,12 @@ function get_tenant(array $params = []): 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 { - if (Str::endsWith($key, ['.crt', '.pem'])) { + if (is_file($key)) { return file_get_contents($key); }