loadMissing('profitCommissionProfile'); $data = [ 'id' => (int) $agent->id, 'username' => $agent->username, 'real_name' => $agent->real_name, 'language' => $agent->language ?? 'zh', 'invitation_code' => $agent->invitation_code, 'type' => (int) $agent->type, 'type_text' => $agent->type_text, 'withdraw_fee_rate' => (string) $agent->withdraw_fee_rate, 'has_withdraw_password' => (string) $agent->withdraw_password !== '', ] + $this->domains->format($agent) + $this->wallets->funds($agent); if ($agent->isJoint()) { $profile = $agent->profitCommissionProfile; $data['profit_commission_profile_id'] = $agent->profit_commission_profile_id; $data['profit_commission_profile'] = $profile; $data['required_margin_amount'] = $profile ? (string) $profile->margin_amount : null; $data['profit_active'] = (int) $agent->profit_active; $data['profit_active_text'] = (int) $agent->profit_active ? '分成中' : ($profile ? '保证金不足,暂停分成' : '未开通方案'); } return $data; } }