From 862b437ad53fbb32f14665d1d370f674b56d1051 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Thu, 15 Sep 2022 20:57:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20Host=20autocost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Remote/Host/HostController.php | 2 +- app/Models/Host.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Remote/Host/HostController.php b/app/Http/Controllers/Remote/Host/HostController.php index 5c0cba7..028c79f 100644 --- a/app/Http/Controllers/Remote/Host/HostController.php +++ b/app/Http/Controllers/Remote/Host/HostController.php @@ -90,7 +90,7 @@ public function update(Request $request, Host $host) // if has cost_once if ($request->has('cost_once')) { - $host->cost($request->cost_once); + $host->cost($request->cost_once, false); return $this->updated($request->cost_once); } diff --git a/app/Models/Host.php b/app/Models/Host.php index 7f286b0..74dd48f 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -86,7 +86,7 @@ public function scopeThisUser($query, $module = null) // cost - public function cost($price = null) + public function cost($price = null, $auto = true) { $this->load('user'); @@ -137,7 +137,7 @@ public function cost($price = null) Cache::put($month_cache_key, $hosts_drops, 604800); - $transaction->reduceDrops($this->user_id, $this->id, $this->module_id, 1, $this->price); + $transaction->reduceDrops($this->user_id, $this->id, $this->module_id, $auto, $this->price); return true; }