feat: 增强玩家 API,新增 locale 和时间字段,更新钱包 API 以支持可用余额计算,添加错误码与多语言支持
This commit is contained in:
25
app/Models/Currency.php
Normal file
25
app/Models/Currency.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/** 币种枚举表 {@see currencies} */
|
||||
class Currency extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'decimal_places',
|
||||
'is_enabled',
|
||||
'is_bettable',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_enabled' => 'boolean',
|
||||
'is_bettable' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
40
app/Models/TransferOrder.php
Normal file
40
app/Models/TransferOrder.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/** 主站 ↔ 彩票划转订单 {@see transfer_orders} */
|
||||
class TransferOrder extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'transfer_no',
|
||||
'player_id',
|
||||
'direction',
|
||||
'currency_code',
|
||||
'amount',
|
||||
'idempotent_key',
|
||||
'status',
|
||||
'external_request_payload',
|
||||
'external_response_payload',
|
||||
'external_ref_no',
|
||||
'fail_reason',
|
||||
'finished_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'amount' => 'integer',
|
||||
'external_request_payload' => 'array',
|
||||
'external_response_payload' => 'array',
|
||||
'finished_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Player::class);
|
||||
}
|
||||
}
|
||||
46
app/Models/WalletTxn.php
Normal file
46
app/Models/WalletTxn.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/** 彩票钱包流水 {@see wallet_txns} */
|
||||
class WalletTxn extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'txn_no',
|
||||
'player_id',
|
||||
'wallet_id',
|
||||
'biz_type',
|
||||
'biz_no',
|
||||
'direction',
|
||||
'amount',
|
||||
'balance_before',
|
||||
'balance_after',
|
||||
'status',
|
||||
'external_ref_no',
|
||||
'idempotent_key',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'direction' => 'integer',
|
||||
'amount' => 'integer',
|
||||
'balance_before' => 'integer',
|
||||
'balance_after' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Player::class);
|
||||
}
|
||||
|
||||
public function wallet(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PlayerWallet::class, 'wallet_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user