Przeglądaj źródła

佣金逻辑修改

Kirin 3 lat temu
rodzic
commit
3e8f19a4b4
1 zmienionych plików z 13 dodań i 0 usunięć
  1. 13 0
      app/common.php

+ 13 - 0
app/common.php

@@ -664,6 +664,18 @@ if (!function_exists('get_hpool_price')) {
                 break;
             }
         }
+        if($price == 0){
+            $res = do_request('https://www.ihpool.com/api/home/list?type=coo', [], null, false);
+            $res = json_decode($res, true);
+            $price = 0;
+            if (!isset($res['code']) || $res['code'] != 200) $price = 0;
+            foreach ($res['data'] as $v) {
+                if ($v['unit'] == $unit) {
+                    $price = bcdiv($v['income'], 1024, 8);
+                    break;
+                }
+            }
+        }
         return $price;
     }
 }
@@ -690,6 +702,7 @@ if (!function_exists('get_fil_price')) {
         $coins = bcdiv($coins, '1000000000000000000', 8);
         $power = bcdiv($power, bcpow(1024, 5), 8);
         $price = bcdiv($coins, $power, 8);
+        $price = bcdiv($price, 1024, 8);
         return $price;
     }
 }