feat: 实现卡和设备的套餐系列绑定功能
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m37s

- 添加 Device 和 IotCard 模型的 SeriesID 字段
- 实现 DeviceService 和 IotCardService 的套餐系列绑定逻辑
- 添加 DeviceStore 和 IotCardStore 的数据库操作方法
- 更新 API 接口和路由支持套餐系列绑定
- 创建数据库迁移脚本(000027_add_series_binding_fields)
- 添加完整的单元测试和集成测试
- 更新 OpenAPI 文档
- 归档 OpenSpec 变更文档

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-01-28 19:49:45 +08:00
parent 1da680a790
commit a945a4f554
38 changed files with 2906 additions and 318 deletions

View File

@@ -195,3 +195,28 @@ func (h *DeviceHandler) Recall(c *fiber.Ctx) error {
return response.Success(c, result)
}
func (h *DeviceHandler) BatchSetSeriesBinding(c *fiber.Ctx) error {
var req dto.BatchSetDeviceSeriesBindngRequest
if err := c.BodyParser(&req); err != nil {
return errors.New(errors.CodeInvalidParam, "请求参数解析失败")
}
ctx := c.UserContext()
userType := middleware.GetUserTypeFromContext(ctx)
var operatorShopID *uint
if userType == constants.UserTypeAgent {
shopID := middleware.GetShopIDFromContext(ctx)
if shopID > 0 {
operatorShopID = &shopID
}
}
result, err := h.service.BatchSetSeriesBinding(ctx, &req, operatorShopID)
if err != nil {
return err
}
return response.Success(c, result)
}