1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 20:00:27 +08:00

修正微信支付验证浮点数精度丢失问题

This commit is contained in:
koogua 2021-09-08 12:18:06 +08:00
parent 4bba205420
commit 7ac456bb67

View File

@ -185,7 +185,12 @@ class Wxpay extends PayService
if (!$trade) return false; if (!$trade) return false;
if ($data->total_fee != 100 * $trade->amount) { /**
* 注意浮点数精度丢失问题
*/
$amount = intval(strval(100 * $trade->amount));
if ($data->total_fee != $amount) {
return false; return false;
} }