重构: 将卡/设备的套餐系列绑定从分配ID改为系列ID

- 数据库: 重命名 series_allocation_id → series_id
- Model: IotCard 和 Device 字段重命名
- DTO: 所有请求/响应字段统一为 series_id
- Store: 方法重命名,新增 GetByShopAndSeries 查询
- Service: 业务逻辑优化,系列验证和权限验证分离
- 测试: 更新所有测试用例,新增 shop_series_allocation_store_test.go
- 文档: 更新 API 文档说明参数变更

BREAKING CHANGE: API 参数从 series_allocation_id 改为 series_id
This commit is contained in:
2026-02-02 12:09:53 +08:00
parent a30b3036bb
commit 37f43d2e2d
27 changed files with 673 additions and 301 deletions

View File

@@ -60,15 +60,15 @@ func createTestIotCard(t *testing.T, tx *gorm.DB, shopID *uint, seriesAllocation
Creator: 1,
Updater: 1,
},
ICCID: fmt.Sprintf("89860%014d", timestamp%100000000000000),
CardType: "流量卡",
CardCategory: "normal",
CarrierID: 1,
CarrierType: "CMCC",
CarrierName: "中国移动",
Status: 1,
ShopID: shopID,
SeriesAllocationID: seriesAllocationID,
ICCID: fmt.Sprintf("89860%014d", timestamp%100000000000000),
CardType: "流量卡",
CardCategory: "normal",
CarrierID: 1,
CarrierType: "CMCC",
CarrierName: "中国移动",
Status: 1,
ShopID: shopID,
SeriesID: seriesAllocationID,
}
require.NoError(t, tx.Create(card).Error)
return card
@@ -83,12 +83,12 @@ func createTestDevice(t *testing.T, tx *gorm.DB, shopID *uint, seriesAllocationI
Creator: 1,
Updater: 1,
},
DeviceNo: fmt.Sprintf("DEV%014d", timestamp%100000000000000),
DeviceName: "测试设备",
DeviceType: "GPS",
Status: 1,
ShopID: shopID,
SeriesAllocationID: seriesAllocationID,
DeviceNo: fmt.Sprintf("DEV%014d", timestamp%100000000000000),
DeviceName: "测试设备",
DeviceType: "GPS",
Status: 1,
ShopID: shopID,
SeriesID: seriesAllocationID,
}
require.NoError(t, tx.Create(device).Error)
return device