refactor(account): 移除卡类型字段、优化账号列表查询和权限检查
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m18s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m18s
- 移除 IoT 卡和号卡的 card_type 字段(数据库迁移) - 优化账号列表查询,支持按店铺和企业筛选 - 账号响应增加店铺名称和企业名称字段 - 实现批量加载店铺和企业名称,避免 N+1 查询 - 更新权限检查中间件,完善权限验证逻辑 - 更新相关测试用例,确保功能正确性
This commit is contained in:
@@ -81,7 +81,7 @@ func TestEnterpriseDeviceH5_GetDeviceDetail(t *testing.T) {
|
||||
}
|
||||
require.NoError(t, env.TX.Create(device).Error)
|
||||
|
||||
card := &model.IotCard{ICCID: prefix + "0001", CardType: "normal", CarrierID: carrier.ID, Status: 2, ShopID: &shop.ID, NetworkStatus: 1}
|
||||
card := &model.IotCard{ICCID: prefix + "0001", CarrierID: carrier.ID, Status: 2, ShopID: &shop.ID, NetworkStatus: 1}
|
||||
require.NoError(t, env.TX.Create(card).Error)
|
||||
|
||||
now := time.Now()
|
||||
@@ -168,7 +168,7 @@ func TestEnterpriseDeviceH5_SuspendCard(t *testing.T) {
|
||||
}
|
||||
require.NoError(t, env.TX.Create(device).Error)
|
||||
|
||||
card := &model.IotCard{ICCID: prefix + "0001", CardType: "normal", CarrierID: carrier.ID, Status: 2, ShopID: &shop.ID, NetworkStatus: 1}
|
||||
card := &model.IotCard{ICCID: prefix + "0001", CarrierID: carrier.ID, Status: 2, ShopID: &shop.ID, NetworkStatus: 1}
|
||||
require.NoError(t, env.TX.Create(card).Error)
|
||||
|
||||
now := time.Now()
|
||||
@@ -215,7 +215,7 @@ func TestEnterpriseDeviceH5_SuspendCard(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("卡不属于设备返回错误", func(t *testing.T) {
|
||||
card2 := &model.IotCard{ICCID: prefix + "0002", CardType: "normal", CarrierID: carrier.ID, Status: 2}
|
||||
card2 := &model.IotCard{ICCID: prefix + "0002", CarrierID: carrier.ID, Status: 2}
|
||||
require.NoError(t, env.TX.Create(card2).Error)
|
||||
|
||||
reqBody := dto.DeviceCardOperationReq{Reason: "测试停机"}
|
||||
@@ -252,7 +252,7 @@ func TestEnterpriseDeviceH5_ResumeCard(t *testing.T) {
|
||||
}
|
||||
require.NoError(t, env.TX.Create(device).Error)
|
||||
|
||||
card := &model.IotCard{ICCID: prefix + "0001", CardType: "normal", CarrierID: carrier.ID, Status: 2, ShopID: &shop.ID, NetworkStatus: 0}
|
||||
card := &model.IotCard{ICCID: prefix + "0001", CarrierID: carrier.ID, Status: 2, ShopID: &shop.ID, NetworkStatus: 0}
|
||||
require.NoError(t, env.TX.Create(card).Error)
|
||||
|
||||
now := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user