stanley-king vor 3 Jahren
Ursprung
Commit
8f2af98853

+ 1 - 1
helper/refill/api/xyz/hongxudagy/RefillPhone.php

@@ -20,7 +20,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['mer_oid'] = $order_sn;
         $params['product_face'] = $amount;
         $params['product_num'] = 1;
-        $params['recharge_amount'] = $amount * config::PRICE;
+        $params['recharge_amount'] = round($amount * config::PRICE, 2);
         $params['phone_no'] = $phone;
         $params['notify_url'] = config::NOTIFY_URL;
         $params['request_time'] = date("YmdHis");

+ 2 - 1
helper/refill/api/xyz/hongxudayz/RefillPhone.php

@@ -6,6 +6,7 @@ require_once(BASE_HELPER_RAPI_PATH . '/hongxudayz/config.php');
 
 use refill;
 use Log;
+use refill\hongxudagy\config;
 
 class RefillPhone extends refill\IRefillPhone
 {
@@ -20,7 +21,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['mer_oid'] = $order_sn;
         $params['product_face'] = $amount;
         $params['product_num'] = 1;
-        $params['recharge_amount'] = $amount * config::PRICE;
+        $params['recharge_amount'] = round($amount * config::PRICE, 2);
         $params['phone_no'] = $phone;
         $params['notify_url'] = config::NOTIFY_URL;
         $params['request_time'] = date("YmdHis");

+ 8 - 0
test/TestCardNo.php

@@ -2,6 +2,7 @@
 
 
 use PHPUnit\Framework\TestCase;
+use refill\hongxudagy\config;
 
 define('APP_ID', 'test');
 define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
@@ -43,4 +44,11 @@ class TestCardNo extends TestCase
         [$validate,$card_type,$region_no] = mtopcard\valid_phone('1000113700023619278');
         Log::record("validate={$validate} card_type={$card_type} region_no={$region_no}",Log::DEBUG);
     }
+
+    public function testRound()
+    {
+        $price = round(30 * 0.992, 4);
+        $params['recharge_amount'] = number_format($price,4,'.','');
+
+    }
 }