归档: fix-status-convention-comments

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-11 12:21:02 +08:00
parent 510a5bfb21
commit 7e613a0d2b
5 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
## 1. 修正 model GORM comment 注释
- [x] 1.1 修改 `internal/model/package.go`PackageSeries.Status 和 Package.Status 的 comment 从 `1-启用 2-禁用` 改为 `0=禁用 1=启用`
- [x] 1.2 修改 `internal/model/shop_package_allocation.go`ShopPackageAllocation.Status 的 comment 从 `1-启用 2-禁用` 改为 `0=禁用 1=启用`
- [x] 1.3 修改 `internal/model/shop_series_allocation.go`ShopSeriesAllocation.Status 的 comment 从 `1-启用 2-禁用` 改为 `0=禁用 1=启用`
- [x] 1.4 修改 `internal/model/system.go`DevCapabilityConfig.Status 的 comment 从 `1-启用 2-禁用` 改为 `0=禁用 1=启用`
- [x] 1.5 修改 `internal/model/financial.go`PaymentMerchantSetting.Status 的 comment 从 `1-启用 2-禁用` 改为 `0=禁用 1=启用`
- [x] 1.6 验证:`go vet ./internal/model/...` 无报错
## 2. 删除僵尸常量
- [x] 2.1 删除 `pkg/constants/iot.go` 中的 `DevCapabilityStatusEnabled = 1``DevCapabilityStatusDisabled = 2` 两行
- [x] 2.2 验证:`go build ./...` 编译通过,证明无代码依赖这两个常量
## 3. 修正 DTO validate 标签和 description关键修复 API 层约定冲突)
> 当前 DTO 有 `validate:"oneof=1 2"` 但 service 层用 `StatusDisabled=0`,二者不兼容。
> 修复方向:将 DTO 对齐到全局约定 `oneof=0 1`。
- [x] 3.1 修改 `internal/model/dto/package_dto.go`
- `UpdatePackageStatusRequest.Status` 的 validate 从 `oneof=1 2` 改为 `oneof=0 1`description 从 `(1:启用, 2:禁用)` 改为 `(0:禁用, 1:启用)`
- `PackageListRequest.Status` 的 description 同步修正
- `PackageResponse.Status` 的 description 同步修正
- [x] 3.2 修改 `internal/model/dto/package_series_dto.go`
- `UpdatePackageSeriesStatusRequest.Status` 的 validate 从 `oneof=1 2` 改为 `oneof=0 1`description 修正
- `PackageSeriesListRequest.Status` 的 description 修正
- `PackageSeriesResponse.Status` 的 description 修正
- [x] 3.3 修改 `internal/model/dto/shop_series_grant_dto.go`status 相关字段 description 全部修正为 `0=禁用 1=启用`
- [x] 3.4 修改 `internal/model/dto/my_package.go`status 相关字段 description 全部修正
- [x] 3.5 验证:`go vet ./internal/model/dto/...` 无报错
## 4. 修正 service 层语义混用
- [x] 4.1 修改 `internal/service/shop_series_grant/service.go`:将所有 `ShelfStatus: constants.StatusEnabled` 改为 `ShelfStatus: constants.ShelfStatusOn`(两处,行约 342、676
- [x] 4.2 验证:`go vet ./internal/service/shop_series_grant/...` 无报错
## 5. 最终验证
- [x] 5.1 执行 `go build ./...` 确认全项目编译通过
- [x] 5.2 执行 `go vet ./...` 无报错
- [x] 5.3 执行 `go test ./internal/service/package/... ./internal/service/package_series/... ./internal/service/shop_series_grant/...` 确认测试通过