FilamentAdmin 访问时出现以下错误:
FilamentManager::getUserName() 返回 null 而不是 string127.0.0.1:5015 (Question Bank API)文件: /Volumes/T9/code/math/apis/FilamentAdmin/app/Models/User.php
问题: User 表使用 full_name 字段,但 Filament 尝试访问 name 字段返回 null
解决方案:
HasName 接口FilamentUser, HasName 接口添加 getFilamentName() 方法
class User extends Authenticatable implements FilamentUser, HasName
{
public function getFilamentName(): string
{
return $this->full_name ?: $this->username ?: $this->email ?: 'Unknown User';
}
}
文件: /Volumes/T9/code/math/apis/docker-compose.microservices.yml
问题: api-question-bank 服务没有暴露外部端口 5015
解决方案:
"5015:5015"文件: /Volumes/T9/code/math/apis/QuestionBankService/Dockerfile
问题: 容器内应用运行在 6001 端口,但外部访问需要 5015 端口
解决方案:
EXPOSE 5015 和 --port 5015文件: /Volumes/T9/code/math/apis/docker-compose.microservices.yml
问题: api-knowledge 服务没有暴露外部端口 5011
解决方案:
"5011:5011"文件: /Volumes/T9/code/math/apis/docker-compose.microservices.yml
问题: nginx 服务依赖 filament-admin,但该服务已禁用
解决方案:
所有 API 服务现在正常工作:
✅ Question Bank API (5015): HTTP 200
GET http://127.0.0.1:5015/health
GET http://127.0.0.1:5015/questions?page=1&per_page=5
✅ Knowledge API (5011): HTTP 200
GET http://127.0.0.1:5011/health
✅ MathRecSys API (5010): HTTP 200
GET http://127.0.0.1:5010/health
api-question-bank 0.0.0.0:5015->5015/tcp
api-knowledge 0.0.0.0:5011->5011/tcp
mathrecsys-api 0.0.0.0:5010->5010/tcp
mathrecsys-frontend 0.0.0.0:3000->3000/tcp
清理 Laravel 缓存:
cd /Volumes/T9/code/math/apis/FilamentAdmin
php artisan config:clear
php artisan cache:clear
访问 FilamentAdmin:
http://fa.test/admin
验证 API 连接:
curl http://127.0.0.1:5015/health
curl http://127.0.0.1:5011/health
curl http://127.0.0.1:5010/health
2025-11-17 13:10
Claude Code