格式化代码

This commit is contained in:
iVampireSP.com 2023-02-01 00:47:50 +08:00
parent 498030fcf7
commit 6edf5d69b5
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -102,13 +102,13 @@ protected static function boot()
// });
static::deleting(function ($model) {
Cache::forget('user_tasks_' . $model->user_id);
Cache::forget('user_tasks_'.$model->user_id);
});
static::deleted(function ($model) {
broadcast(new Users($model->user_id, 'hosts.deleted', $model));
Cache::forget('user_tasks_' . $model->user_id);
Cache::forget('user_hosts_' . $model->user_id);
Cache::forget('user_tasks_'.$model->user_id);
Cache::forget('user_hosts_'.$model->user_id);
});
}
@ -184,7 +184,7 @@ public function cost(string $amount = null, $auto = true): bool
$real_price = $amount ?? $this->price;
if (!$amount) {
if (! $amount) {
if ($this->managed_price) {
$real_price = $this->managed_price;
}
@ -195,7 +195,7 @@ public function cost(string $amount = null, $auto = true): bool
if ($user_group->discount !== 100 && $user_group->discount !== null) {
$real_price = bcmul($real_price, bcdiv($user_group->discount, '100', 4), 4);
$append_description = ' (折扣 ' . $user_group->discount . '%)';
$append_description = ' (折扣 '.$user_group->discount.'%)';
}
}
@ -223,7 +223,7 @@ public function cost(string $amount = null, $auto = true): bool
$month = now()->month;
$month_cache_key = 'user_' . $this->user_id . '_month_' . $month . '_hosts_balances';
$month_cache_key = 'user_'.$this->user_id.'_month_'.$month.'_hosts_balances';
$hosts_balances = Cache::get($month_cache_key, []);
// 统计 Host 消耗的 Balance
@ -277,7 +277,7 @@ public function addLog(string $amount = '0'): bool
$current_month = now()->month;
$current_year = now()->year;
$cache_key = 'module_earning_' . $this->module_id;
$cache_key = 'module_earning_'.$this->module_id;
// 应支付的提成
$commission = config('billing.commission');
@ -292,7 +292,7 @@ public function addLog(string $amount = '0'): bool
$earnings = Cache::get($cache_key, []);
if (!isset($earnings[$current_year])) {
if (! isset($earnings[$current_year])) {
$earnings[$current_year] = [];
}