Skip to content

Commit

Permalink
fix:修复微信支付小于1元不能发起支付的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Dec 13, 2023
1 parent 9c09feb commit c366789
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/Plugins/Core/src/Lib/Pay/Service/WechatPay.php
Expand Up @@ -14,15 +14,16 @@ class WechatPay implements PayInterFace
* @var int | float
*/
private int|float $amount_multiple = 100;

/**
* 计算实际金额
* @param string|int $amount
* @param string|int|float $amount
* @param bool $dividing
* @return float|int
*/
protected function calculate_amount(string|int $amount, bool $dividing = false) : float|int
protected function calculate_amount(string|int|float $amount, bool $dividing = false) : float|int
{
if (!is_numeric($amount)) {
if (!is_numeric($amount) && is_float($amount)) {
return 0;
}
if ($dividing === true) {
Expand Down
2 changes: 1 addition & 1 deletion app/Plugins/User/src/Controller/AssetController.php
Expand Up @@ -38,7 +38,7 @@ public function money()
public function money_recharge_submit()
{
$payment = request()->input('payment');
$amount = request()->input('amount');
$amount = (float) request()->input('amount');
$captcha = request()->input('captcha');
if (!$payment || !$amount || !$captcha) {
return Json_Api(403, false, ['msg' => '请求参数不足']);
Expand Down

0 comments on commit c366789

Please sign in to comment.