- 在 AgentNodeProfileController 中添加对父代理能力授予的验证,确保子代理的权限在父代理范围内。 - 更新多个请求类,统一代理资料字段的验证逻辑,提升代码复用性。 - 引入 AgentProfileFieldRules 以简化代理资料更新请求的规则定义。 - 在 AgentProfile 模型中设置主键为 agent_node_id,确保与代理节点的关联性。 - 更新错误信息,增加对授信额度和占成比例的验证,确保数据一致性。
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
final class AgentProfile extends Model
|
|
{
|
|
protected $primaryKey = 'agent_node_id';
|
|
|
|
public $incrementing = false;
|
|
|
|
protected $keyType = 'int';
|
|
|
|
protected $fillable = [
|
|
'agent_node_id',
|
|
'total_share_rate',
|
|
'credit_limit',
|
|
'allocated_credit',
|
|
'used_credit',
|
|
'rebate_limit',
|
|
'default_player_rebate',
|
|
'settlement_cycle',
|
|
'can_grant_extra_rebate',
|
|
'can_create_child_agent',
|
|
'can_create_player',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'agent_node_id' => 'integer',
|
|
'total_share_rate' => 'float',
|
|
'credit_limit' => 'integer',
|
|
'allocated_credit' => 'integer',
|
|
'used_credit' => 'integer',
|
|
'rebate_limit' => 'float',
|
|
'default_player_rebate' => 'float',
|
|
'can_grant_extra_rebate' => 'boolean',
|
|
'can_create_child_agent' => 'boolean',
|
|
'can_create_player' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/** @return BelongsTo<AgentNode, AgentProfile> */
|
|
public function agentNode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AgentNode::class, 'agent_node_id');
|
|
}
|
|
}
|