新增银行功能:存取金币、流水记录、PC/手机端双入口;迁移 bank_jjb 字段和 bank_logs 表

This commit is contained in:
2026-03-18 20:31:19 +08:00
parent 6c4183e175
commit d7a575d8c8
7 changed files with 605 additions and 2 deletions

46
app/Models/BankLog.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
/**
* 文件功能:银行流水记录模型
*
* 对应 bank_logs 表,记录每次存款/取款操作及操作后余额。
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BankLog extends Model
{
/**
* 允许批量赋值的字段
*
* @var list<string>
*/
protected $fillable = [
'user_id',
'type',
'amount',
'balance_after',
];
/**
* 字段类型转换
*/
protected function casts(): array
{
return [
'amount' => 'integer',
'balance_after' => 'integer',
];
}
/**
* 所属用户
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}