diff --git a/app/Models/Host.php b/app/Models/Host.php index 7312946..cd5a615 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -101,7 +101,13 @@ public function cost($price = null) // if drops <= price if ($drops < $this->price) { try { - $this->user->toDrops($amount); + // 算出需要补充多少 Drops + $need = $this->price - $drops; + + // 算出需要补充多少余额 + $need_amount = $need / Cache::get('drops_rate', 100) + 1; + + $this->user->toDrops($amount + $need_amount); } catch (BalanceNotEnoughException) { $this->update([ 'status' => 'suspended',