移除 Drops 的痕迹
This commit is contained in:
parent
76336f935f
commit
653844751b
@ -215,84 +215,6 @@ public function safeDelete(): bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function cost($price = null, $auto = true): bool
|
|
||||||
// {
|
|
||||||
// $this->load('user');
|
|
||||||
//
|
|
||||||
// $transaction = new Transaction();
|
|
||||||
//
|
|
||||||
// $drops = $transaction->getDrops($this->user_id);
|
|
||||||
//
|
|
||||||
// $real_price = $price ?? $this->price;
|
|
||||||
//
|
|
||||||
// if (!$price) {
|
|
||||||
//
|
|
||||||
// if ($this->managed_price) {
|
|
||||||
// $real_price = $this->managed_price;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ($real_price == 0) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $real_price = round($real_price ?? 0, 8);
|
|
||||||
//
|
|
||||||
// $amount = $price / config('drops.rate') + 1;
|
|
||||||
//
|
|
||||||
// // if drops <= price
|
|
||||||
// if ($drops < $real_price) {
|
|
||||||
// try {
|
|
||||||
// // 算出需要补充多少 Drops
|
|
||||||
// $need = $real_price - $drops;
|
|
||||||
//
|
|
||||||
// // 算出需要补充多少余额
|
|
||||||
// $need_amount = $need / config('drops.rate') + 1;
|
|
||||||
//
|
|
||||||
// $this->user->toDrops($amount + $need_amount);
|
|
||||||
// } catch (BalanceNotEnoughException) {
|
|
||||||
// $this->update([
|
|
||||||
// 'status' => 'suspended',
|
|
||||||
// ]);
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// } else if ($this->status == 'suspended') {
|
|
||||||
// $this->update([
|
|
||||||
// 'status' => 'stopped',
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $month = now()->month;
|
|
||||||
//
|
|
||||||
// $month_cache_key = 'user_' . $this->user_id . '_month_' . $month . '_hosts_drops';
|
|
||||||
// $hosts_drops = Cache::get($month_cache_key, []);
|
|
||||||
//
|
|
||||||
// // 统计 Host 消耗的 Drops
|
|
||||||
// if (isset($hosts_drops[$this->id])) {
|
|
||||||
// $hosts_drops[$this->id] += $real_price;
|
|
||||||
// } else {
|
|
||||||
// $hosts_drops[$this->id] = $real_price;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Cache::put($month_cache_key, $hosts_drops, 604800);
|
|
||||||
//
|
|
||||||
// $transaction->reduceDrops($this->user_id, $this->id, $this->module_id, $auto, $real_price);
|
|
||||||
//
|
|
||||||
// $this->addLog('drops', $real_price);
|
|
||||||
//
|
|
||||||
// broadcast(new UserEvent($this->user_id, 'balances.drops.reduced', $this->user));
|
|
||||||
//
|
|
||||||
// // 检测用户余额是否足够
|
|
||||||
// if ($this->user->balance < 0) {
|
|
||||||
// $this->update([
|
|
||||||
// 'status' => 'suspended',
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function cost($amount = null, $auto = true): bool
|
public function cost($amount = null, $auto = true): bool
|
||||||
{
|
{
|
||||||
$this->load('user');
|
$this->load('user');
|
||||||
|
Loading…
Reference in New Issue
Block a user