重构: 将卡/设备的套餐系列绑定从分配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:
@@ -99,21 +99,21 @@ func setupOrderTestEnv(t *testing.T) *testEnv {
|
||||
|
||||
shopIDPtr := &shop.ID
|
||||
card := &model.IotCard{
|
||||
ICCID: "89860000000000000002",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
ICCID: "89860000000000000002",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
}
|
||||
require.NoError(t, iotCardStore.Create(ctx, card))
|
||||
|
||||
device := &model.Device{
|
||||
DeviceNo: "DEV_TEST_ORDER_001",
|
||||
ShopID: shopIDPtr,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
DeviceNo: "DEV_TEST_ORDER_001",
|
||||
ShopID: shopIDPtr,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
}
|
||||
require.NoError(t, deviceStore.Create(ctx, device))
|
||||
|
||||
@@ -569,12 +569,12 @@ func TestOrderService_IdempotencyAndConcurrency(t *testing.T) {
|
||||
|
||||
shopIDPtr := &shop.ID
|
||||
card := &model.IotCard{
|
||||
ICCID: "89860000000000000099",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
ICCID: "89860000000000000099",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
}
|
||||
require.NoError(t, iotCardStore.Create(ctx, card))
|
||||
|
||||
@@ -769,7 +769,7 @@ func TestOrderService_ForceRechargeValidation(t *testing.T) {
|
||||
ICCID: "89860000000000000FR1",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
FirstCommissionPaid: false,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
@@ -820,7 +820,7 @@ func TestOrderService_ForceRechargeValidation(t *testing.T) {
|
||||
ICCID: "89860000000000000FR2",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
FirstCommissionPaid: true,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
@@ -917,7 +917,7 @@ func TestOrderService_GetPurchaseCheck(t *testing.T) {
|
||||
ICCID: "89860000000000000PC1",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
FirstCommissionPaid: false,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
@@ -949,7 +949,7 @@ func TestOrderService_GetPurchaseCheck(t *testing.T) {
|
||||
ICCID: "89860000000000000PC2",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
FirstCommissionPaid: true,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
@@ -1055,12 +1055,12 @@ func TestOrderService_WalletPay_PurchaseOnBehalf(t *testing.T) {
|
||||
|
||||
shopIDPtr := &shop.ID
|
||||
card := &model.IotCard{
|
||||
ICCID: "89860000000000000WP1",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesAllocationID: &allocation.ID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
ICCID: "89860000000000000WP1",
|
||||
ShopID: shopIDPtr,
|
||||
CarrierID: carrier.ID,
|
||||
SeriesID: &allocation.SeriesID,
|
||||
Status: constants.StatusEnabled,
|
||||
BaseModel: model.BaseModel{Creator: 1, Updater: 1},
|
||||
}
|
||||
require.NoError(t, iotCardStore.Create(ctx, card))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user