refactor: 移除 IoT 卡未使用的价格字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m2s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m2s
- 移除 IotCard 模型的 cost_price 和 distribute_price 字段 - 移除 StandaloneIotCardResponse DTO 中对应的字段 - 添加数据库迁移文件 000066_remove_iot_card_price_fields - 更新 opencode.json 配置 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,10 +29,8 @@ type StandaloneIotCardResponse struct {
|
|||||||
IMSI string `json:"imsi,omitempty" description:"IMSI"`
|
IMSI string `json:"imsi,omitempty" description:"IMSI"`
|
||||||
MSISDN string `json:"msisdn,omitempty" description:"卡接入号"`
|
MSISDN string `json:"msisdn,omitempty" description:"卡接入号"`
|
||||||
BatchNo string `json:"batch_no,omitempty" description:"批次号"`
|
BatchNo string `json:"batch_no,omitempty" description:"批次号"`
|
||||||
Supplier string `json:"supplier,omitempty" description:"供应商"`
|
Supplier string `json:"supplier,omitempty" description:"供应商"`
|
||||||
CostPrice int64 `json:"cost_price" description:"成本价(分)"`
|
Status int `json:"status" description:"状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)"`
|
||||||
DistributePrice int64 `json:"distribute_price" description:"分销价(分)"`
|
|
||||||
Status int `json:"status" description:"状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)"`
|
|
||||||
ShopID *uint `json:"shop_id,omitempty" description:"店铺ID"`
|
ShopID *uint `json:"shop_id,omitempty" description:"店铺ID"`
|
||||||
ShopName string `json:"shop_name,omitempty" description:"店铺名称"`
|
ShopName string `json:"shop_name,omitempty" description:"店铺名称"`
|
||||||
ActivatedAt *time.Time `json:"activated_at,omitempty" description:"激活时间"`
|
ActivatedAt *time.Time `json:"activated_at,omitempty" description:"激活时间"`
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ type IotCard struct {
|
|||||||
IMSI string `gorm:"column:imsi;type:varchar(50);comment:IMSI" json:"imsi"`
|
IMSI string `gorm:"column:imsi;type:varchar(50);comment:IMSI" json:"imsi"`
|
||||||
MSISDN string `gorm:"column:msisdn;type:varchar(20);comment:MSISDN(手机号码)" json:"msisdn"`
|
MSISDN string `gorm:"column:msisdn;type:varchar(20);comment:MSISDN(手机号码)" json:"msisdn"`
|
||||||
BatchNo string `gorm:"column:batch_no;type:varchar(100);comment:批次号" json:"batch_no"`
|
BatchNo string `gorm:"column:batch_no;type:varchar(100);comment:批次号" json:"batch_no"`
|
||||||
Supplier string `gorm:"column:supplier;type:varchar(255);comment:供应商" json:"supplier"`
|
Supplier string `gorm:"column:supplier;type:varchar(255);comment:供应商" json:"supplier"`
|
||||||
CostPrice int64 `gorm:"column:cost_price;type:bigint;default:0;comment:成本价(分为单位)" json:"cost_price"`
|
Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-在库 2-已分销 3-已激活 4-已停用" json:"status"`
|
||||||
DistributePrice int64 `gorm:"column:distribute_price;type:bigint;default:0;comment:分销价(分为单位)" json:"distribute_price"`
|
|
||||||
Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-在库 2-已分销 3-已激活 4-已停用" json:"status"`
|
|
||||||
ShopID *uint `gorm:"column:shop_id;index;comment:店铺ID(NULL=平台所有,有值=店铺所有)" json:"shop_id,omitempty"`
|
ShopID *uint `gorm:"column:shop_id;index;comment:店铺ID(NULL=平台所有,有值=店铺所有)" json:"shop_id,omitempty"`
|
||||||
ActivatedAt *time.Time `gorm:"column:activated_at;comment:激活时间" json:"activated_at"`
|
ActivatedAt *time.Time `gorm:"column:activated_at;comment:激活时间" json:"activated_at"`
|
||||||
ActivationStatus int `gorm:"column:activation_status;type:int;default:0;not null;comment:激活状态 0-未激活 1-已激活" json:"activation_status"`
|
ActivationStatus int `gorm:"column:activation_status;type:int;default:0;not null;comment:激活状态 0-未激活 1-已激活" json:"activation_status"`
|
||||||
|
|||||||
@@ -243,11 +243,9 @@ func (s *Service) toStandaloneResponse(card *model.IotCard, shopMap map[uint]str
|
|||||||
CarrierName: card.CarrierName,
|
CarrierName: card.CarrierName,
|
||||||
IMSI: card.IMSI,
|
IMSI: card.IMSI,
|
||||||
MSISDN: card.MSISDN,
|
MSISDN: card.MSISDN,
|
||||||
BatchNo: card.BatchNo,
|
BatchNo: card.BatchNo,
|
||||||
Supplier: card.Supplier,
|
Supplier: card.Supplier,
|
||||||
CostPrice: card.CostPrice,
|
Status: card.Status,
|
||||||
DistributePrice: card.DistributePrice,
|
|
||||||
Status: card.Status,
|
|
||||||
ShopID: card.ShopID,
|
ShopID: card.ShopID,
|
||||||
ActivatedAt: card.ActivatedAt,
|
ActivatedAt: card.ActivatedAt,
|
||||||
ActivationStatus: card.ActivationStatus,
|
ActivationStatus: card.ActivationStatus,
|
||||||
|
|||||||
@@ -211,12 +211,11 @@ func (s *IotCardStore) List(ctx context.Context, opts *store.QueryOptions, filte
|
|||||||
// standaloneListColumns 列表查询只选取响应需要的列,避免 SELECT * 的宽行 I/O
|
// standaloneListColumns 列表查询只选取响应需要的列,避免 SELECT * 的宽行 I/O
|
||||||
var standaloneListColumns = []string{
|
var standaloneListColumns = []string{
|
||||||
"id", "iccid", "card_category", "carrier_id", "carrier_type", "carrier_name",
|
"id", "iccid", "card_category", "carrier_id", "carrier_type", "carrier_name",
|
||||||
"imsi", "msisdn", "batch_no", "supplier", "cost_price", "distribute_price",
|
"imsi", "msisdn", "batch_no", "supplier", "status", "shop_id", "activated_at",
|
||||||
"status", "shop_id", "activated_at", "activation_status", "real_name_status",
|
"activation_status", "real_name_status", "network_status", "data_usage_mb",
|
||||||
"network_status", "data_usage_mb", "current_month_usage_mb", "current_month_start_date",
|
"current_month_usage_mb", "current_month_start_date", "last_month_total_mb",
|
||||||
"last_month_total_mb", "last_data_check_at", "last_real_name_check_at",
|
"last_data_check_at", "last_real_name_check_at", "enable_polling", "series_id",
|
||||||
"enable_polling", "series_id", "first_commission_paid", "accumulated_recharge",
|
"first_commission_paid", "accumulated_recharge", "created_at", "updated_at",
|
||||||
"created_at", "updated_at",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListStandalone 独立卡列表查询入口
|
// ListStandalone 独立卡列表查询入口
|
||||||
|
|||||||
7
migrations/000066_remove_iot_card_price_fields.down.sql
Normal file
7
migrations/000066_remove_iot_card_price_fields.down.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
-- 回滚:恢复 IoT 卡的成本价和分销价字段
|
||||||
|
|
||||||
|
ALTER TABLE tb_iot_card ADD COLUMN IF NOT EXISTS cost_price BIGINT DEFAULT 0;
|
||||||
|
ALTER TABLE tb_iot_card ADD COLUMN IF NOT EXISTS distribute_price BIGINT DEFAULT 0;
|
||||||
|
|
||||||
|
COMMENT ON COLUMN tb_iot_card.cost_price IS '成本价(分为单位)';
|
||||||
|
COMMENT ON COLUMN tb_iot_card.distribute_price IS '分销价(分为单位)';
|
||||||
7
migrations/000066_remove_iot_card_price_fields.up.sql
Normal file
7
migrations/000066_remove_iot_card_price_fields.up.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
-- 移除 IoT 卡的成本价和分销价字段
|
||||||
|
-- 这两个字段未被任何业务逻辑使用,实际的价格管理在套餐分配层面完成
|
||||||
|
|
||||||
|
ALTER TABLE tb_iot_card DROP COLUMN IF EXISTS cost_price;
|
||||||
|
ALTER TABLE tb_iot_card DROP COLUMN IF EXISTS distribute_price;
|
||||||
|
|
||||||
|
COMMENT ON TABLE tb_iot_card IS 'IoT 卡表(移除了未使用的 cost_price 和 distribute_price 字段)';
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
"apiKey": "cr_c12cb1c99754ba7e22b4097762b2a61627112d5dcad90b867c715da0cf45b3a9"
|
"apiKey": "cr_c12cb1c99754ba7e22b4097762b2a61627112d5dcad90b867c715da0cf45b3a9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"openai": {
|
"google": {
|
||||||
"options": {
|
"options": {
|
||||||
"baseURL": "https://txibabrh.cc-coding.com/openai/v1",
|
"baseURL": "https://txibabrh.cc-coding.com/gemini/v1",
|
||||||
"apiKey": "cr_c12cb1c99754ba7e22b4097762b2a61627112d5dcad90b867c715da0cf45b3a9"
|
"apiKey": "cr_c12cb1c99754ba7e22b4097762b2a61627112d5dcad90b867c715da0cf45b3a9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,4 +38,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user