Commit 6271b7e
zhangyi01
fix(backend): 填充 admin handler 空壳实现,管理后台 CRUD 功能可用
根因: gen/http/handler/admin/admin_service.go 的 handler 全是 thrift 生成的
空壳(只 new(Resp) 直接返回),未调用 service 层,导致所有 admin API 返回
code:0, data:null。
填充的 handler:
- AdminStats: 调 GetStats(),返回真实统计(用户/文件/存储/今日上传)
- AdminListUsers: 调 GetUsers(),映射 UserResp→UserItem(status: active=1)
- AdminListFiles: 调 GetFiles(),映射 FileCode→FileItem(文件名/大小/过期)
- AdminGetConfig: 调 GetConfig(),返回配置结构
- AdminUpdateUserStatus: 调 UpdateUserStatus(),int↔string 状态转换
- AdminDeleteFile: 兼容 code 和 id 删除(前端传 8 位 code,绕过 int64 绑定)
service 层新增 GetFileByCode 方法。
实测验证: 统计/用户列表/文件列表加载真实数据,用户禁用、文件删除 CRUD 全链路通过。1 parent de0a964 commit 6271b7e
3 files changed
Lines changed: 172 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
168 | 173 | | |
169 | 174 | | |
170 | 175 | | |
| |||
0 commit comments