试验性 更改

This commit is contained in:
iVampireSP.com 2022-11-30 20:26:35 +08:00
parent 5eb6f8b5cd
commit 2cf12b01dc
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 8 additions and 4 deletions

View File

@ -23,6 +23,10 @@ class Transaction extends Model
'paid_at',
];
protected $casts = [
'balance' => 'decimal:2',
];
protected $fillable = [
// 交易类型
'type',

View File

@ -113,7 +113,7 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
'balance' => 'float',
'balance' => 'decimal:2',
'banned_at' => 'datetime',
];
@ -125,9 +125,9 @@ protected static function boot()
// balance 四舍五入
if ($model->isDirty('balance')) {
$model->balance = round($model->balance, 2, PHP_ROUND_HALF_DOWN);
}
// if ($model->isDirty('balance')) {
// $model->balance = round($model->balance, 2, PHP_ROUND_HALF_DOWN);
// }
if ($model->isDirty('banned_at')) {
if ($model->banned_at) {