全面使用 余额,废除 Drops

This commit is contained in:
iVampireSP.com 2022-11-19 22:42:47 +08:00
parent 7871ba709e
commit f3581eea45
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
19 changed files with 141 additions and 445 deletions

View File

@ -49,9 +49,6 @@ public function handle()
$transaction = new Transaction();
$drops = $transaction->getDrops($user->id);
$this->warn('用户基本信息');
$this->info('用户 ID: ' . $user->id);
@ -59,9 +56,6 @@ public function handle()
$this->info('邮箱: ' . $user->email);
$this->info('余额:' . $user->balance . ' 元');
$this->info('Drops' . $drops);
$this->warn('前 10 条充值记录');
$balances = Balance::where('user_id', $user->id)->whereNotNull('paid_at')->latest()->limit(10)->get();
@ -77,7 +71,9 @@ public function handle()
// 倒序
foreach (array_reverse($hosts->toArray()) as $host) {
$this->info('[' . $host['module']['name'] . '](' . $host['price'] . ' Drops) ' . $host['name']);
$this->info('[' . $host['module']['name'] . '](' . $host['price'] . ' ) ' . $host['name']);
}
return 0;
}
}

View File

@ -1,60 +0,0 @@
<?php
namespace App\Console\Commands;
use App\Models\Transaction;
use App\Models\User;
use Illuminate\Console\Command;
use Symfony\Component\Console\Command\Command as CommandAlias;
class UserAddDrops extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:add-drops {user_id} {amount}';
/**
* The console command description.
*
* @var string
*/
protected $description = '给用户添加 Drops';
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
$user_id = $this->argument('user_id');
$amount = $this->argument('amount');
$user = User::findOrFail($user_id);
$transaction = new Transaction();
$current_drops = $transaction->getDrops($user->id);
$this->info($user->name . ', 当前 ' . $current_drops . ' Drops');
$this->info($user->name . ', 当前余额: ' . $user->balance . ' 元');
$this->info('添加后 ' . $current_drops + $amount . ' Drops');
if (!$this->confirm('确认添加 ' . $amount . ' Drops?')) {
$this->info('已取消。');
return 0;
}
$transaction->increaseDrops($user->id, $amount, '管理员添加 Drops', 'console');
$this->info('添加成功。');
return CommandAlias::SUCCESS;
}
}

View File

@ -29,7 +29,7 @@ protected function schedule(Schedule $schedule)
$schedule->command('sanctum:prune-expired --hours=24')->daily();
// 扣费
$schedule->job(new HostCost())->everyFiveMinutes();
$schedule->job(new HostCost(now()->hour))->hourly()->withoutOverlapping()->onOneServer();
// 获取模块暴露的信息(服务器等)
$schedule->job(new FetchModule())->withoutOverlapping()->everyMinute();

View File

@ -55,16 +55,12 @@ public function edit(User $user)
{
//
$transaction = new Transaction();
$drops = $transaction->getDrops($user->id);
$hosts = Host::where('user_id', $user->id)->latest()->paginate(50, ['*'], 'hosts_page');
$workOrders = WorkOrder::where('user_id', $user->id)->latest()->paginate(50, ['*'], 'workOrders_page');
$balances = Balance::where('user_id', $user->id)->latest()->paginate(50, ['*'], 'balances_page');
return view('admin.users.edit', compact('user', 'drops', 'hosts', 'workOrders', 'balances'));
return view('admin.users.edit', compact('user', 'hosts', 'workOrders', 'balances'));
}
/**
@ -79,9 +75,7 @@ public function update(Request $request, User $user)
{
//
$request->validate([
'balance' => 'nullable|numeric|min:0.01|max:1000',
'drops' => 'nullable|numeric|min:1|max:10000',
]);
$transaction = new Transaction();
@ -92,10 +86,6 @@ public function update(Request $request, User $user)
$transaction->addAmount($user->id, 'console', $request->balance, '管理员汇入', true);
}
if ($request->filled('drops')) {
$transaction->increaseDrops($user->id, $request->drops, '管理员汇入', 'console');
}
if ($request->is_banned) {
$user->banned_at = Carbon::now();

View File

@ -62,14 +62,13 @@ public function usages(): JsonResponse
{
$month = now()->month;
$month_cache_key = 'user_' . auth()->id() . '_month_' . $month . '_hosts_drops';
$hosts_drops = Cache::get($month_cache_key, []);
// $month_cache_key = 'user_' . auth()->id() . '_month_' . $month . '_hosts_drops';
// $hosts_drops = Cache::get($month_cache_key, []);
$month_cache_key = 'user_' . auth()->id() . '_month_' . $month . '_hosts_balances';
$hosts_balances = Cache::get($month_cache_key, []);
return $this->success([
'drops' => $hosts_drops,
'balances' => $hosts_balances
]);
}

View File

@ -12,14 +12,6 @@ class UserController extends Controller
public function index(Request $request)
{
$user = $request->user();
$transaction = new Transaction();
$user['drops'] = $transaction->getDrops($user['id']);
$user['drops_rate'] = config('drops.rate');
return $this->success($user);
return $this->success($request->user());
}
}

View File

@ -103,12 +103,10 @@ public function update(Request $request, Host $host): JsonResponse
//
$this->validate($request, [
'status' => 'sometimes|in:running,stopped,error,suspended,pending',
// 'managed_price' => 'sometimes|numeric|nullable',
'managed_price' => 'sometimes|numeric|nullable',
// 如果是立即扣费
'cost_once' => 'sometimes|numeric|nullable',
'cost_balance' => 'sometimes|numeric|nullable',
]);
// if has cost_once
@ -118,13 +116,6 @@ public function update(Request $request, Host $host): JsonResponse
return $this->updated();
}
if ($request->has('cost_balance')) {
$host->costBalance($request->cost_balance ?? 0);
return $this->updated();
}
$update = $request->except(['module_id', 'user_id']);
$host->update($update);

View File

@ -49,9 +49,6 @@ public function show(User $user)
{
$transaction = new Transaction();
$user['drops'] = $transaction->getDrops($user['id']);
$user['drops_rate'] = config('drops.rate');
return $this->success($user);
}

View File

@ -18,18 +18,11 @@ class BalanceController extends Controller
public function index(Request $request): View
{
$transaction = new Transaction();
$drops = $transaction->getDrops();
$balance = $request->user()->balance;
$balances = Balance::thisUser()->latest()->paginate(100);
$drops_rate = config('drops.rate');
return view('balances.index', compact('drops', 'balance', 'balances', 'drops_rate'));
return view('balances.index', compact('balance', 'balances'));
}
public function store(Request $request)

View File

@ -15,9 +15,8 @@ public function index(Request $request)
{
$user = $request->user();
$balance = $user->balance;
$drops = (new Transaction())->getDrops($user->id);
return view('transfer.search', compact('balance', 'drops'));
return view('transfer.search', compact('balance'));
}
public function transfer(Request $request)
@ -25,10 +24,8 @@ public function transfer(Request $request)
$request->validate([
'amount' => 'numeric|min:1|max:100',
'description' => 'nullable|string|max:100',
'type' => 'string|in:balance,drops'
]);
$to = User::where('email', $request->to)->first();
if (!$to) {
return back()->withErrors(['to' => '找不到用户。']);
@ -41,25 +38,12 @@ public function transfer(Request $request)
$transaction = new Transaction();
if ($request->type === 'balance') {
if ($user->balance < $request->amount) {
return back()->withErrors(['amount' => '您的余额不足。']);
} else {
$transaction->transfer($user, $to, $request->amount, $request->description);
}
} else if ($request->type === 'drops') {
$transaction = new Transaction();
$drops = $transaction->getDrops($user->id);
if ($drops < $request->amount) {
return back()->withErrors(['amount' => '您的 Drops 不足。']);
} else {
if (!$transaction->transferDrops($user, $to, $request->amount, $request->description)) {
return back()->withErrors(['amount' => '转账失败。']);
}
}
if ($user->balance < $request->amount) {
return back()->withErrors(['amount' => '您的余额不足。']);
} else {
$transaction->transfer($user, $to, $request->amount, $request->description);
}
return back()->with('success', '转账成功,已达对方账户。');

View File

@ -13,16 +13,17 @@ class HostCost implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels, Lock;
public $cache_key, $cache, $user;
public $hour, $cache, $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
public function __construct($hour)
{
//
$this->hour = $hour;
}
/**
@ -32,10 +33,8 @@ public function __construct()
*/
public function handle()
{
// $this->cache = new Cache();
// chunk hosts and load user
Host::whereIn('status', ['running', 'stopped'])->with('user')->chunk(1000, function ($hosts) {
Host::where('hour', $this->hour)->whereIn('status', ['running', 'stopped'])->with('user')->chunk(1000, function ($hosts) {
foreach ($hosts as $host) {
$host->cost();
}

View File

@ -3,7 +3,6 @@
namespace App\Models;
use App\Events\UserEvent;
use App\Exceptions\User\BalanceNotEnoughException;
use App\Models\WorkOrder\WorkOrder;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -11,7 +10,6 @@
use Illuminate\Database\Eloquent\Relations\BelongsTo as BelongsToAlias;
use Illuminate\Database\Eloquent\Relations\HasMany as HasManyAlias;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
// use Illuminate\Database\Eloquent\SoftDeletes;
@ -140,87 +138,87 @@ public function safeDelete(): bool
return true;
}
public function cost($price = null, $auto = true): bool
// 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 addLog($type = 'drops', float|null $amount = 0): 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 addLog($type = 'drops', float $amount = 0): bool
{
if ($amount == 0) {
if ($amount === 0 || $amount === null) {
return false;
}
@ -230,24 +228,7 @@ public function addLog($type = 'drops', float $amount = 0): bool
$cache_key = 'module_earning_' . $this->module_id;
$rate = (int)config('drops.rate');
$commission = (float)config('drops.commission');
if ($type == 'drops') {
// 换成 余额
$amount = $amount / $rate;
}
// $amount = round($amount, 2);
// Log::debug('addLog', [
// 'amount' => $amount,
// 'rate' => $rate,
// 'commission' => $commission,
// ]);
$commission = (float)config('billing.commission');
$should_amount = round($amount * $commission, 2);
@ -260,24 +241,15 @@ public function addLog($type = 'drops', float $amount = 0): bool
$earnings[$current_year] = [];
}
if ($type == 'drops') {
$drops = $amount;
} else {
$drops = 0;
}
if (isset($earnings[$current_year][$current_month])) {
$earnings[$current_year][$current_month]['balance'] += $amount;
$earnings[$current_year][$current_month]['should_balance'] += $should_balance;
$earnings[$current_year][$current_month]['drops'] += $drops;
} else {
$earnings[$current_year][$current_month] = [
'balance' => $amount,
// 应得(交了手续费)
'should_balance' => $should_balance,
'drops' => $drops
];
}
@ -295,8 +267,29 @@ public function addLog($type = 'drops', float $amount = 0): bool
return true;
}
public function costBalance($amount = 1): bool
public function cost($amount = null, $auto = true): bool
{
$this->load('user');
$real_price = $amount ?? $this->price;
if (!$amount) {
if ($this->managed_price) {
$real_price = $this->managed_price;
}
}
if ($real_price == 0) {
return true;
}
$real_price = round($real_price ?? 0, 2);
if ($real_price < 0.01) {
return true;
}
$transaction = new Transaction();
$month = now()->month;
@ -304,19 +297,24 @@ public function costBalance($amount = 1): bool
$month_cache_key = 'user_' . $this->user_id . '_month_' . $month . '_hosts_balances';
$hosts_drops = Cache::get($month_cache_key, []);
// 统计 Host 消耗的 Drops
// 统计 Host 消耗的 Balance
if (isset($hosts_drops[$this->id])) {
$hosts_drops[$this->id] += $amount;
$hosts_drops[$this->id] += $real_price;
} else {
$hosts_drops[$this->id] = $amount;
$hosts_drops[$this->id] = $real_price;
}
Cache::put($month_cache_key, $hosts_drops, 604800);
$left = $transaction->reduceHostAmount($this->user_id, $this->id, $this->module_id, $amount);
$description = '模块发起的扣费。';
$this->addLog('balance', $amount);
if ($auto) {
$description = '自动扣费。';
}
$left = $transaction->reduceHostAmount($this->user_id, $this->id, $this->module_id, $real_price, $description);
$this->addLog('balance', $real_price);
broadcast(new UserEvent($this->user_id, 'balances.amount.reduced', $this->user));

View File

@ -38,27 +38,16 @@ class Transaction extends Model
// 入账
'income',
// 入账 Drops
'income_drops',
// 出账
'outcome',
// 出账 Drops
'outcome_drops',
// 可用余额
'balances',
'balance',
// 可用 Drops
'drops',
// 赠送金额
'gift',
// 赠送 Drops
'gift_drops',
'user_id',
'host_id',
'module_id',
@ -71,51 +60,12 @@ public function scopeThisUser($query)
return $query->where('user_id', auth()->id());
}
public function increaseCurrentUserDrops($amount = 0)
{
return $this->increaseDrops(auth()->id(), $amount);
}
public function increaseDrops($user_id, $amount, $description = null, $payment = null)
{
$cache_key = 'user_drops_' . $user_id;
$current_drops = Cache::get($cache_key, [
'drops' => 0,
]);
$current_drops['drops'] += $amount;
Cache::forever($cache_key, $current_drops);
$this->addIncomeDrops($user_id, $amount, $description, $payment);
return $current_drops['drops'];
}
public function addIncomeDrops($user_id, $amount, $description, $payment = 'balance')
{
$data = [
'type' => 'income',
'payment' => $payment,
'description' => $description,
'income' => 0,
'income_drops' => (float)$amount,
'outcome' => 0,
'outcome_drops' => 0,
];
return $this->addLog($user_id, $data);
}
private function addLog($user_id, $data)
{
$user = User::find($user_id);
$current = [
'balance' => (float)$user->balance,
'drops' => $this->getDrops($user_id),
'user_id' => intval($user_id),
];
@ -128,73 +78,6 @@ private function addLog($user_id, $data)
return $this->create($data);
}
public function getDrops($user_id = null): float
{
//
if (!$user_id) {
$user_id = auth()->id();
}
$cache_key = 'user_drops_' . $user_id;
$drops = Cache::get($cache_key, [
'drops' => 0,
]);
// 保留 8 位
$drops['drops'] = round($drops['drops'], 8);
return $drops['drops'];
}
public function reduceDrops($user_id, $host_id, $module_id, $auto = 1, $amount = 0)
{
$cache_key = 'user_drops_' . $user_id;
$current_drops = Cache::get($cache_key, [
'drops' => 0,
]);
$current_drops['drops'] = $current_drops['drops'] - $amount;
$current_drops['drops'] = round($current_drops['drops'], 5);
Cache::forever($cache_key, $current_drops);
if (!$auto) {
$description = '集成模块发起的扣费。';
$this->addPayoutDrops($user_id, $amount, $description, $host_id, $module_id);
}
}
public function addPayoutDrops($user_id, $amount, $description, $host_id, $module_id)
{
$data = [
'type' => 'payout',
'payment' => 'drops',
'description' => $description,
'income' => 0,
'income_drops' => 0,
'outcome' => 0,
'outcome_drops' => (float)$amount,
'host_id' => $host_id,
'module_id' => $module_id,
];
// $amount = (double) $amount;
// Log::debug($amount);
// $month = now()->month;
// Cache::increment('user_' . $user_id . '_month_' . $month . '_drops', $amount);
return $this->addLog($user_id, $data);
}
public function reduceAmount($user_id, $amount = 0, $description = '扣除费用请求。')
{
@ -223,9 +106,7 @@ public function addPayoutBalance($user_id, $amount, $description, $module_id = n
'payment' => 'balance',
'description' => $description,
'income' => 0,
'income_drops' => 0,
'outcome' => (float)$amount,
'outcome_drops' => 0
];
if ($module_id) {
@ -290,9 +171,7 @@ public function addHostPayoutBalance($user_id, $host_id, $module_id, $amount, $d
'payment' => 'balance',
'description' => $description,
'income' => 0,
'income_drops' => 0,
'outcome' => (float)$amount,
'outcome_drops' => 0,
'host_id' => $host_id,
'module_id' => $module_id,
];
@ -351,9 +230,7 @@ public function addIncomeBalance($user_id, $payment, $amount, $description)
'payment' => $payment,
'description' => $description,
'income' => (float)$amount,
'income_drops' => 0,
'outcome' => 0,
'outcome_drops' => 0,
];
return $this->addLog($user_id, $data);
@ -393,43 +270,4 @@ public function transfer(User $user, User $to, float $amount, string|null $descr
return $user->balance;
}
public function transferDrops(User $user, User $to, float $amount, string|null $description = null): bool
{
$user_drops = $this->getDrops($user->id);
// if drops not enough
if ($user_drops < $amount) {
return false;
}
$description_new = "转账给 {$to->name}($to->email) {$amount} Drops $description";
$this->reduceDropsWithoutHost($user->id, $amount, $description_new);
$description_new = "收到来自 {$to->name}($to->email) 转来的 {$amount} Drops $description";
$this->increaseDrops($to->id, $amount, $description_new, 'transfer');
return true;
}
public function reduceDropsWithoutHost($user_id, $amount = 0, $description = null)
{
$cache_key = 'user_drops_' . $user_id;
$current_drops = Cache::get($cache_key, [
'drops' => 0,
]);
$current_drops['drops'] = $current_drops['drops'] - $amount;
$current_drops['drops'] = round($current_drops['drops'], 5);
Cache::forever($cache_key, $current_drops);
$this->addPayoutDrops($user_id, $amount, $description, null, null);
}
}

View File

@ -1,7 +1,7 @@
<?php
return [
'rate' => 1000,
'drops_rate' => 1000,
// 提成
'commission' => 0.1,
];

View File

@ -17,7 +17,7 @@
{{-- </div>--}}
<div class="form-group">
<label for="managed_price" class="col-sm-2 col-form-label">新的价格 (Drops)</label>
<label for="managed_price" class="col-sm-2 col-form-label">新的价格 ()</label>
<input type="text" class="form-control" id="managed_price" name="managed_price"
value="{{ $host->managed_price }}" placeholder="{{ $host->price }}">
留空以使用默认价格

View File

@ -11,7 +11,7 @@
@endif
<p>余额: {{ $user->balance }} , {{ $drops }} Drops</p>
<p>余额: {{ $user->balance }} </p>
<p>注册时间: {{ $user->created_at }}</p>
@ -27,13 +27,11 @@
<th>ID</th>
<th>模块</th>
<th>名称</th>
<th>价格 / 5 分钟</th>
<th>价格 / </th>
<th>操作</th>
</thead>
<tbody>
@php($drops_rage = config('drops.rate'))
@foreach($hosts as $host)
<tr>
<td>
@ -44,9 +42,9 @@
</td>
<td>{{ $host->name }}</td>
<td>
<span>{{ $host->managed_price ?? $host->price }} Drops</span>
<span>{{ $host->managed_price ?? $host->price }} </span>
<span>{{ round($host->managed_price ?? $host->price / $drops_rage * (30 * 24 * 60 / 5), 2) }} / </span>
{{-- <span>{{ round($host->managed_price ?? $host->price / $drops_rage * (30 * 24 * 60 / 5), 2) }} / </span>--}}
</td>
<td>
@ -139,11 +137,6 @@
<input type="text" class="form-control" id="balance" name="balance" placeholder="充值金额">
</div>
<div class="form-group">
<label for="drops">充值 Drops</label>
<input type="text" class="form-control" id="drops" name="drops" placeholder="充值 Drops">
</div>
{{-- 封禁 --}}
<div class="form-group">
<label for="is_banned">封禁</label>

View File

@ -7,7 +7,6 @@
<p>您的余额: {{ $balance }} </p>
<p>Drops: {{ $drops }} </p>
<h2>添加到余额</h2>
<form name="charge" method="POST" target="_blank" action="{{ route('balances.store') }}"
@ -16,7 +15,6 @@
<input type="number" id="amount" name="amount" value="10" min="1" max="1000"/>
<button type="submit" class="btn btn-primary">充值</button>
</form>
<span> <span id="to_drops"></span> Drops</span>
<div class="mt-2">
<div>
@ -86,7 +84,7 @@
{{ $balances->links() }}
<script>
{{-- <script>
let rate = {{ $drops_rate }};
let to_drops = document.querySelector('#to_drops')
let amount = document.querySelector('#amount')
@ -100,6 +98,6 @@ function calc(el) {
calc(amount)
</script>
</script> --}}
@endsection

View File

@ -48,20 +48,14 @@
</td>
<td class="text-success">
{{ $t->income }}
<br/>
{{ $t->income_drops }} Drops
</td>
<td class="text-danger">
{{ $t->outcome }}
<br/>
{{ $t->outcome_drops }} Drops
</td>
<td>
{{ $t->balance ?? $t->balances }}
<br/>
{{ $t->drops }} Drops
</td>
<td>
{{ $t->created_at }}

View File

@ -5,7 +5,7 @@
@section('content')
<h2>转账</h2>
<p>将您的余额转入到其他莱云账号,并且无需对方确认。</p>
<p>您有: {{ $balance }} ,以及 {{ $drops }} Drops </p>
<p>您有: {{ $balance }} </p>
<form method="post" action="{{ route('transfer') }}" onsubmit="return beforeContinue()">
@csrf
@ -15,12 +15,6 @@
</div>
<div class="form-group">
<label for="type">类型</label>
<select class="form-control" id="type" name="type">
<option value="balance">余额</option>
<option value="drops">Drops</option>
</select>
<div class="form-group">
<label for="amount">金额</label>
<input type="number" class="form-control" id="amount" name="amount" placeholder="请输入转账金额" min="1"