From e2301d5f3b1c4310ac852081c535ad2d9743b5ec Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 19 May 2026 12:10:59 +0800 Subject: [PATCH] =?UTF-8?q?chore(=E9=9B=86=E6=88=90=E9=AA=8C=E8=AF=81):=20?= =?UTF-8?q?gofmt=20=E4=BF=AE=E5=A4=8D=20DTO=20=E6=A0=BC=E5=BC=8F=E5=B9=B6?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=20OpenAPI=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 ListStandaloneIotCardRequest 和 ListDeviceRequest 字段对齐格式 - 重新生成 docs/admin-openapi.yaml,两个列表接口均新增 has_active_package 参数 - go build ./cmd/api、go build ./cmd/worker 均通过验证 Co-Authored-By: Claude Sonnet 4.6 --- docs/admin-openapi.yaml | 33 +++++++++++++++++++++++--- internal/model/dto/device_dto.go | 6 ++--- internal/model/dto/iot_card_dto.go | 38 +++++++++++++++--------------- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/docs/admin-openapi.yaml b/docs/admin-openapi.yaml index 50f1ccb..487fcdc 100644 --- a/docs/admin-openapi.yaml +++ b/docs/admin-openapi.yaml @@ -4675,7 +4675,7 @@ components: description: 状态名称 type: string virtual_no: - description: 设备虚拟号 + description: 卡虚拟号 type: string type: object DtoEnterpriseCardPageResult: @@ -13249,6 +13249,13 @@ paths: format: date-time nullable: true type: string + - description: 是否有生效中的套餐(true:有生效中主套餐, false:无生效中主套餐) + in: query + name: has_active_package + schema: + description: 是否有生效中的套餐(true:有生效中主套餐, false:无生效中主套餐) + nullable: true + type: boolean responses: "200": content: @@ -14925,11 +14932,17 @@ paths: schema: description: ICCID(模糊查询) type: string - - description: 虚拟号(模糊查询) + - description: 卡虚拟号(模糊查询) in: query name: virtual_no schema: - description: 虚拟号(模糊查询) + description: 卡虚拟号(模糊查询) + type: string + - description: 手机号(模糊查询) + in: query + name: msisdn + schema: + description: 手机号(模糊查询) type: string - description: 企业ID in: path @@ -16538,6 +16551,13 @@ paths: description: ICCID(模糊查询) maxLength: 20 type: string + - description: 卡虚拟号(模糊查询) + in: query + name: virtual_no + schema: + description: 卡虚拟号(模糊查询) + maxLength: 100 + type: string - description: 卡接入号(模糊查询) in: query name: msisdn @@ -16581,6 +16601,13 @@ paths: description: 是否有换卡记录 (true:有换卡记录, false:无换卡记录) nullable: true type: boolean + - description: 是否有生效中的套餐 (true:有生效中套餐, false:无生效中套餐, 不传:不过滤) + in: query + name: has_active_package + schema: + description: 是否有生效中的套餐 (true:有生效中套餐, false:无生效中套餐, 不传:不过滤) + nullable: true + type: boolean - description: ICCID起始号 in: query name: iccid_start diff --git a/internal/model/dto/device_dto.go b/internal/model/dto/device_dto.go index 1222a41..418d1bd 100644 --- a/internal/model/dto/device_dto.go +++ b/internal/model/dto/device_dto.go @@ -15,9 +15,9 @@ type ListDeviceRequest struct { BatchNo string `json:"batch_no" query:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号"` DeviceType string `json:"device_type" query:"device_type" validate:"omitempty,max=50" maxLength:"50" description:"设备类型"` Manufacturer string `json:"manufacturer" query:"manufacturer" validate:"omitempty,max=255" maxLength:"255" description:"制造商(模糊查询)"` - CreatedAtStart *time.Time `json:"created_at_start" query:"created_at_start" description:"创建时间起始"` - CreatedAtEnd *time.Time `json:"created_at_end" query:"created_at_end" description:"创建时间结束"` - HasActivePackage *bool `json:"has_active_package" query:"has_active_package" description:"是否有生效中的套餐(true:有生效中主套餐, false:无生效中主套餐)"` + CreatedAtStart *time.Time `json:"created_at_start" query:"created_at_start" description:"创建时间起始"` + CreatedAtEnd *time.Time `json:"created_at_end" query:"created_at_end" description:"创建时间结束"` + HasActivePackage *bool `json:"has_active_package" query:"has_active_package" description:"是否有生效中的套餐(true:有生效中主套餐, false:无生效中主套餐)"` } type DeviceResponse struct { diff --git a/internal/model/dto/iot_card_dto.go b/internal/model/dto/iot_card_dto.go index 1293a82..856f23e 100644 --- a/internal/model/dto/iot_card_dto.go +++ b/internal/model/dto/iot_card_dto.go @@ -3,25 +3,25 @@ package dto import "time" type ListStandaloneIotCardRequest struct { - Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"` - PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"` - Status *int `json:"status" query:"status" validate:"omitempty,min=1,max=4" minimum:"1" maximum:"4" description:"状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)"` - CarrierID *uint `json:"carrier_id" query:"carrier_id" description:"运营商ID"` - ShopID *uint `json:"shop_id" query:"shop_id" description:"分销商ID(兼容旧参数,单选)"` - ShopIDs []uint `json:"shop_ids" query:"shop_ids" validate:"omitempty,dive,min=1" description:"分销商ID列表(多选)"` - SeriesID *uint `json:"series_id" query:"series_id" description:"套餐系列ID"` - ICCID string `json:"iccid" query:"iccid" validate:"omitempty,max=20" maxLength:"20" description:"ICCID(模糊查询)"` - VirtualNo string `json:"virtual_no" query:"virtual_no" validate:"omitempty,max=100" maxLength:"100" description:"卡虚拟号(模糊查询)"` - MSISDN string `json:"msisdn" query:"msisdn" validate:"omitempty,max=20" maxLength:"20" description:"卡接入号(模糊查询)"` - IsStandalone *bool `json:"is_standalone" query:"is_standalone" description:"是否为独立卡(true:仅返回未绑定设备的卡, false:仅返回已绑定设备的卡, 不传:返回全部)"` - BatchNo string `json:"batch_no" query:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号"` - PackageID *uint `json:"package_id" query:"package_id" description:"套餐ID"` - IsDistributed *bool `json:"is_distributed" query:"is_distributed" description:"是否已分销 (true:已分销, false:未分销)"` - IsReplaced *bool `json:"is_replaced" query:"is_replaced" description:"是否有换卡记录 (true:有换卡记录, false:无换卡记录)"` - HasActivePackage *bool `json:"has_active_package" query:"has_active_package" description:"是否有生效中的套餐 (true:有生效中套餐, false:无生效中套餐, 不传:不过滤)"` - ICCIDStart string `json:"iccid_start" query:"iccid_start" validate:"omitempty,max=20" maxLength:"20" description:"ICCID起始号"` - ICCIDEnd string `json:"iccid_end" query:"iccid_end" validate:"omitempty,max=20" maxLength:"20" description:"ICCID结束号"` - CarrierName string `json:"carrier_name" query:"carrier_name" validate:"omitempty,max=100" maxLength:"100" description:"运营商名称(模糊查询)"` + Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"` + PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"` + Status *int `json:"status" query:"status" validate:"omitempty,min=1,max=4" minimum:"1" maximum:"4" description:"状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)"` + CarrierID *uint `json:"carrier_id" query:"carrier_id" description:"运营商ID"` + ShopID *uint `json:"shop_id" query:"shop_id" description:"分销商ID(兼容旧参数,单选)"` + ShopIDs []uint `json:"shop_ids" query:"shop_ids" validate:"omitempty,dive,min=1" description:"分销商ID列表(多选)"` + SeriesID *uint `json:"series_id" query:"series_id" description:"套餐系列ID"` + ICCID string `json:"iccid" query:"iccid" validate:"omitempty,max=20" maxLength:"20" description:"ICCID(模糊查询)"` + VirtualNo string `json:"virtual_no" query:"virtual_no" validate:"omitempty,max=100" maxLength:"100" description:"卡虚拟号(模糊查询)"` + MSISDN string `json:"msisdn" query:"msisdn" validate:"omitempty,max=20" maxLength:"20" description:"卡接入号(模糊查询)"` + IsStandalone *bool `json:"is_standalone" query:"is_standalone" description:"是否为独立卡(true:仅返回未绑定设备的卡, false:仅返回已绑定设备的卡, 不传:返回全部)"` + BatchNo string `json:"batch_no" query:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号"` + PackageID *uint `json:"package_id" query:"package_id" description:"套餐ID"` + IsDistributed *bool `json:"is_distributed" query:"is_distributed" description:"是否已分销 (true:已分销, false:未分销)"` + IsReplaced *bool `json:"is_replaced" query:"is_replaced" description:"是否有换卡记录 (true:有换卡记录, false:无换卡记录)"` + HasActivePackage *bool `json:"has_active_package" query:"has_active_package" description:"是否有生效中的套餐 (true:有生效中套餐, false:无生效中套餐, 不传:不过滤)"` + ICCIDStart string `json:"iccid_start" query:"iccid_start" validate:"omitempty,max=20" maxLength:"20" description:"ICCID起始号"` + ICCIDEnd string `json:"iccid_end" query:"iccid_end" validate:"omitempty,max=20" maxLength:"20" description:"ICCID结束号"` + CarrierName string `json:"carrier_name" query:"carrier_name" validate:"omitempty,max=100" maxLength:"100" description:"运营商名称(模糊查询)"` } type StandaloneIotCardResponse struct {