diff --git a/app/Models/Host.php b/app/Models/Host.php index 0cab31c..c682826 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -111,7 +111,6 @@ protected static function boot() if ($model->managed_price !== null) { $model->managed_price = round($model->managed_price, 2); - } }); @@ -121,7 +120,6 @@ protected static function boot() }); static::updating(function ($model) { - if ($model->isDirty('status')) { if ($model->status == 'suspended') { $model->suspended_at = now(); @@ -132,12 +130,10 @@ protected static function boot() if ($model->isDirty('price')) { $model->price = round($model->price, 2); - } if ($model->isDirty('managed_price') && $model->managed_price !== null) { $model->managed_price = round($model->managed_price, 2); - } broadcast(new UserEvent($model->user_id, 'hosts.updating', $model)); @@ -150,7 +146,6 @@ protected static function boot() Cache::forget('user_hosts_' . $model->user_id); Cache::forget('user_tasks_' . $model->user_id); - broadcast(new UserEvent($model->user_id, 'hosts.updated', $model)); }); @@ -170,8 +165,6 @@ protected static function boot() }); } - // module - public function getUserHosts($user_id = null) { return $this->where('user_id', $user_id)->with('module', function ($query) { @@ -179,15 +172,11 @@ public function getUserHosts($user_id = null) })->get(); } - // workOrders - public function user(): BelongsToAlias { return $this->belongsTo(User::class); } - // scope - public function module(): BelongsToAlias { return $this->belongsTo(Module::class); @@ -301,7 +290,6 @@ public function safeDelete(): bool public function cost($amount = null, $auto = true): bool { - $this->load('user'); $real_price = $amount ?? $this->price; @@ -312,9 +300,6 @@ public function cost($amount = null, $auto = true): bool } } - // 测试 余额支付 - // echo '拿到的价格' . $real_price . '元' . PHP_EOL; - if ($auto) { // 获取本月天数 $days = now()->daysInMonth;