fix: 修复后端导入错误并统一错误处理机制

## 主要修复内容

### 🔧 导入错误修复
- 修复 updateCategoryLogic.go 缺失的导入 (errorx, model, sql, time)
- 修复 loginLogic.go 中 errors 包应为 errorx 包的问题
- 修复 uploadPhotoLogic.go 中错误处理不统一的问题
- 修复 photo 查询相关文件缺失 model 包导入

###  错误处理统一化
- 统一使用项目自定义的 errorx 包替代标准库 errors
- 完善 model.ErrNotFound 错误判断逻辑
- 添加详细的错误日志记录
- 统一响应代码使用 errorx.Success

### 🆕 错误代码扩展
- 新增 UserDisabled (1003) 错误代码
- 新增 InvalidParameter (400) 错误代码别名
- 完善错误代码到 HTTP 状态码的映射
- 修复重复错误代码导致的编译问题

###  代码质量保证
- 解决所有编译错误,确保 go build 成功
- 修复 15 个后端逻辑文件的导入问题
- 整理 go.mod 依赖包
- 更新项目任务进度文档

## 影响的文件
- backend/internal/logic/auth/loginLogic.go
- backend/internal/logic/category/updateCategoryLogic.go
- backend/internal/logic/photo/uploadPhotoLogic.go
- backend/internal/logic/photo/getPhotoLogic.go
- backend/internal/logic/photo/getPhotoListLogic.go
- backend/pkg/errorx/errorx.go
- TASK_PROGRESS.md
This commit is contained in:
iriver
2025-07-10 23:15:21 +08:00
parent 604b9e59ba
commit 17078683e6
8 changed files with 158 additions and 53 deletions

View File

@ -3,7 +3,9 @@ module photography-backend
go 1.23
require (
github.com/disintegration/imaging v1.6.2
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/google/uuid v1.6.0
github.com/zeromicro/go-zero v1.8.4
golang.org/x/crypto v0.33.0
gorm.io/driver/mysql v1.5.2
@ -17,13 +19,11 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sql-driver/mysql v1.9.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/pyroscope-go v1.2.2 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect