diff --git a/app/Models/Host.php b/app/Models/Host.php index 52719be..05fb365 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -99,7 +99,7 @@ public function cost($price = null, $auto = true) $this->price = $price; } - $this->price = round($this->price, 5); + $this->price = round($this->price, 8); $amount = $price / config('drops.rate') + 1; diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 66aad03..8c9d96f 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -83,8 +83,8 @@ public function getDrops($user_id = null) 'drops' => 0, ]); - // 保留 5 位 - $drops['drops'] = round($drops['drops'], 5); + // 保留 8 位 + $drops['drops'] = round($drops['drops'], 8); return $drops['drops']; } diff --git a/app/Models/User.php b/app/Models/User.php index 3adce98..cf257ad 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -70,6 +70,10 @@ public function toDrops($amount = 1) $total += $amount * $rate; + + // amount 保留两位小数 + $amount = round($amount, 2); + $lock = Cache::lock("lock_" . $cache_key, 5); try { $lock->block(5);