diff --git a/internal/model/dto/iot_card_dto.go b/internal/model/dto/iot_card_dto.go index d2fb153..35deed7 100644 --- a/internal/model/dto/iot_card_dto.go +++ b/internal/model/dto/iot_card_dto.go @@ -29,10 +29,8 @@ type StandaloneIotCardResponse struct { IMSI string `json:"imsi,omitempty" description:"IMSI"` MSISDN string `json:"msisdn,omitempty" description:"卡接入号"` BatchNo string `json:"batch_no,omitempty" description:"批次号"` - Supplier string `json:"supplier,omitempty" description:"供应商"` - CostPrice int64 `json:"cost_price" description:"成本价(分)"` - DistributePrice int64 `json:"distribute_price" description:"分销价(分)"` - Status int `json:"status" description:"状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)"` + Supplier string `json:"supplier,omitempty" description:"供应商"` + Status int `json:"status" description:"状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)"` ShopID *uint `json:"shop_id,omitempty" description:"店铺ID"` ShopName string `json:"shop_name,omitempty" description:"店铺名称"` ActivatedAt *time.Time `json:"activated_at,omitempty" description:"激活时间"` diff --git a/internal/model/iot_card.go b/internal/model/iot_card.go index 3dd116c..c2a5758 100644 --- a/internal/model/iot_card.go +++ b/internal/model/iot_card.go @@ -22,10 +22,8 @@ type IotCard struct { IMSI string `gorm:"column:imsi;type:varchar(50);comment:IMSI" json:"imsi"` 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"` - 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"` - 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"` + Supplier string `gorm:"column:supplier;type:varchar(255);comment:供应商" json:"supplier"` + 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"` 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"` diff --git a/internal/service/iot_card/service.go b/internal/service/iot_card/service.go index d3f93d8..8bbbb2a 100644 --- a/internal/service/iot_card/service.go +++ b/internal/service/iot_card/service.go @@ -243,11 +243,9 @@ func (s *Service) toStandaloneResponse(card *model.IotCard, shopMap map[uint]str CarrierName: card.CarrierName, IMSI: card.IMSI, MSISDN: card.MSISDN, - BatchNo: card.BatchNo, - Supplier: card.Supplier, - CostPrice: card.CostPrice, - DistributePrice: card.DistributePrice, - Status: card.Status, + BatchNo: card.BatchNo, + Supplier: card.Supplier, + Status: card.Status, ShopID: card.ShopID, ActivatedAt: card.ActivatedAt, ActivationStatus: card.ActivationStatus, diff --git a/internal/store/postgres/iot_card_store.go b/internal/store/postgres/iot_card_store.go index 9746bdf..e665ec1 100644 --- a/internal/store/postgres/iot_card_store.go +++ b/internal/store/postgres/iot_card_store.go @@ -211,12 +211,11 @@ func (s *IotCardStore) List(ctx context.Context, opts *store.QueryOptions, filte // standaloneListColumns 列表查询只选取响应需要的列,避免 SELECT * 的宽行 I/O var standaloneListColumns = []string{ "id", "iccid", "card_category", "carrier_id", "carrier_type", "carrier_name", - "imsi", "msisdn", "batch_no", "supplier", "cost_price", "distribute_price", - "status", "shop_id", "activated_at", "activation_status", "real_name_status", - "network_status", "data_usage_mb", "current_month_usage_mb", "current_month_start_date", - "last_month_total_mb", "last_data_check_at", "last_real_name_check_at", - "enable_polling", "series_id", "first_commission_paid", "accumulated_recharge", - "created_at", "updated_at", + "imsi", "msisdn", "batch_no", "supplier", "status", "shop_id", "activated_at", + "activation_status", "real_name_status", "network_status", "data_usage_mb", + "current_month_usage_mb", "current_month_start_date", "last_month_total_mb", + "last_data_check_at", "last_real_name_check_at", "enable_polling", "series_id", + "first_commission_paid", "accumulated_recharge", "created_at", "updated_at", } // ListStandalone 独立卡列表查询入口 diff --git a/migrations/000066_remove_iot_card_price_fields.down.sql b/migrations/000066_remove_iot_card_price_fields.down.sql new file mode 100644 index 0000000..418cfd6 --- /dev/null +++ b/migrations/000066_remove_iot_card_price_fields.down.sql @@ -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 '分销价(分为单位)'; diff --git a/migrations/000066_remove_iot_card_price_fields.up.sql b/migrations/000066_remove_iot_card_price_fields.up.sql new file mode 100644 index 0000000..761215d --- /dev/null +++ b/migrations/000066_remove_iot_card_price_fields.up.sql @@ -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 字段)'; diff --git a/opencode.json b/opencode.json index 7ac1320..03766ce 100644 --- a/opencode.json +++ b/opencode.json @@ -7,9 +7,9 @@ "apiKey": "cr_c12cb1c99754ba7e22b4097762b2a61627112d5dcad90b867c715da0cf45b3a9" } }, - "openai": { + "google": { "options": { - "baseURL": "https://txibabrh.cc-coding.com/openai/v1", + "baseURL": "https://txibabrh.cc-coding.com/gemini/v1", "apiKey": "cr_c12cb1c99754ba7e22b4097762b2a61627112d5dcad90b867c715da0cf45b3a9" } } @@ -38,4 +38,4 @@ } } } -} \ No newline at end of file +}