wesmiler 2 vuotta sitten
vanhempi
commit
e4a7371d25
1 muutettua tiedostoa jossa 5 lisäystä ja 6 poistoa
  1. 5 6
      app/Services/Api/AcceptorService.php

+ 5 - 6
app/Services/Api/AcceptorService.php

@@ -109,11 +109,11 @@ class AcceptorService extends BaseService
             $xdPrice = ConfigService::make()->getConfigByCode('xd_price', 100);
             $currency = isset($params['currency']) && $params['currency']? strtoupper($params['currency']) : 'CNY';
             $tradeType = isset($params['trade_type']) && $params['trade_type']? intval($params['trade_type']) : 1;
-            $cnyPrice = $this->getRealPrice($currency, $tradeType);
+            $cnyPrice = $this->getRealPrice($xdPrice,$currency, $tradeType);
 
             foreach ($datas['data'] as &$item) {
                 $item['avatar'] = $item['avatar'] ? get_image_url($item['avatar']) : '';
-                $item['currency_quota'] = $this->getRealPrice($item['quota'], $currency, 3);
+                $item['currency_quota'] = $this->getRealPrice(floatval($item['quota']), $currency, 3);
                 $item['usdt_price'] = moneyFormat(1 / $xdPrice, 2);
                 $item['price'] = $cnyPrice;
             }
@@ -136,7 +136,6 @@ class AcceptorService extends BaseService
      */
     public function getRealPrice($money,$currency='CNY', $tradeType=1)
     {
-        $xdPrice = $money? $money : ConfigService::make()->getConfigByCode('xd_price', 100);
         $usdtPrice = RedisService::get("caches:wallets:usdt_rate");
         if($usdtPrice<=0){
             $usdtCnyPrice = ConfigService::make()->getConfigByCode('usdt_cny_price', 7.2);
@@ -151,19 +150,19 @@ class AcceptorService extends BaseService
             $xdBuyPriceRate = ConfigService::make()->getConfigByCode('trade_buy_price_rate', 0);
             $xdBuyPriceRate = $xdBuyPriceRate>0 && $xdBuyPriceRate<100? $xdBuyPriceRate : 0;
 
-            $buyPrice = moneyFormat($xdPrice + ($xdPrice * $xdBuyPriceRate / 100), 2);
+            $buyPrice = moneyFormat($money + ($money * $xdBuyPriceRate / 100), 2);
             $cnyBuyPrice = moneyFormat($buyPrice / $usdtPrice , 2);
             return moneyFormat($cnyBuyPrice * $currencyPrice, 2);
         }else if($tradeType == 2){
             $xdSellPriceRate = ConfigService::make()->getConfigByCode('trade_sell_price_rate', 0);
             $xdSellPriceRate = $xdSellPriceRate>0 && $xdSellPriceRate<100? $xdSellPriceRate : 0;
 
-            $sellPrice = moneyFormat($xdPrice + ($xdPrice * $xdSellPriceRate / 100), 2);
+            $sellPrice = moneyFormat($money + ($money * $xdSellPriceRate / 100), 2);
             $cnySellPrice = moneyFormat($sellPrice / $usdtPrice , 2);
             return moneyFormat($cnySellPrice * $currencyPrice, 2);
         }
 
-        $cnyPrice = moneyFormat($xdPrice / $usdtPrice , 2);
+        $cnyPrice = moneyFormat($money / $usdtPrice , 2);
         return moneyFormat($cnyPrice * $currencyPrice, 2);
     }