All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m0s
单卡回收优化: - 移除 from_shop_id 参数,系统自动识别卡所属店铺 - 保持直属下级限制,混合来源分别处理 - 新增 GetDistributedStandaloneByICCIDRange/GetDistributedStandaloneByFilters 方法 店铺禁用拦截: - 登录时检查关联店铺状态,禁用店铺无法登录 - 新增 CodeShopDisabled 错误码 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
107 lines
5.2 KiB
Go
107 lines
5.2 KiB
Go
package dto
|
||
|
||
// ========== 选卡方式常量 ==========
|
||
|
||
const (
|
||
// SelectionTypeList ICCID列表选择
|
||
SelectionTypeList = "list"
|
||
// SelectionTypeRange 号段范围选择
|
||
SelectionTypeRange = "range"
|
||
// SelectionTypeFilter 筛选条件选择
|
||
SelectionTypeFilter = "filter"
|
||
)
|
||
|
||
// ========== 分配请求/响应 ==========
|
||
|
||
// AllocateStandaloneCardsRequest 分配单卡请求
|
||
type AllocateStandaloneCardsRequest struct {
|
||
// ToShopID 目标店铺ID(必填,必须是直属下级)
|
||
ToShopID uint `json:"to_shop_id" validate:"required,min=1" required:"true" minimum:"1" description:"目标店铺ID"`
|
||
|
||
// SelectionType 选卡方式(必填)
|
||
// list: ICCID列表选择
|
||
// range: 号段范围选择
|
||
// filter: 筛选条件选择
|
||
SelectionType string `json:"selection_type" validate:"required,oneof=list range filter" required:"true" enum:"list,range,filter" description:"选卡方式 (list:ICCID列表, range:号段范围, filter:筛选条件)"`
|
||
|
||
// ===== selection_type=list 时使用 =====
|
||
// ICCIDs ICCID列表(最多1000个)
|
||
ICCIDs []string `json:"iccids" validate:"required_if=SelectionType list,omitempty,max=1000,dive,required,max=20" description:"ICCID列表(selection_type=list时必填,最多1000个)"`
|
||
|
||
// ===== selection_type=range 时使用 =====
|
||
// ICCIDStart 起始ICCID
|
||
ICCIDStart string `json:"iccid_start" validate:"required_if=SelectionType range,omitempty,max=20" maxLength:"20" description:"起始ICCID(selection_type=range时必填)"`
|
||
// ICCIDEnd 结束ICCID
|
||
ICCIDEnd string `json:"iccid_end" validate:"required_if=SelectionType range,omitempty,max=20" maxLength:"20" description:"结束ICCID(selection_type=range时必填)"`
|
||
|
||
// ===== selection_type=filter 时使用 =====
|
||
// CarrierID 运营商ID
|
||
CarrierID *uint `json:"carrier_id" description:"运营商ID(selection_type=filter时可选)"`
|
||
// BatchNo 批次号
|
||
BatchNo string `json:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号(selection_type=filter时可选)"`
|
||
// Status 卡状态
|
||
Status *int `json:"status" validate:"omitempty,min=1,max=4" minimum:"1" maximum:"4" description:"卡状态 (1:在库, 2:已分销)(selection_type=filter时可选)"`
|
||
|
||
// Remark 备注
|
||
Remark string `json:"remark" validate:"omitempty,max=500" maxLength:"500" description:"备注"`
|
||
}
|
||
|
||
// AllocateStandaloneCardsResponse 分配单卡响应
|
||
type AllocateStandaloneCardsResponse struct {
|
||
// TotalCount 待分配总数
|
||
TotalCount int `json:"total_count" description:"待分配总数"`
|
||
// SuccessCount 成功数
|
||
SuccessCount int `json:"success_count" description:"成功数"`
|
||
// FailCount 失败数
|
||
FailCount int `json:"fail_count" description:"失败数"`
|
||
// AllocationNo 分配单号
|
||
AllocationNo string `json:"allocation_no" description:"分配单号"`
|
||
// FailedItems 失败项列表
|
||
FailedItems []AllocationFailedItem `json:"failed_items" description:"失败项列表"`
|
||
}
|
||
|
||
// AllocationFailedItem 分配失败项
|
||
type AllocationFailedItem struct {
|
||
// ICCID 卡ICCID
|
||
ICCID string `json:"iccid" description:"ICCID"`
|
||
// Reason 失败原因
|
||
Reason string `json:"reason" description:"失败原因"`
|
||
}
|
||
|
||
// ========== 回收请求/响应 ==========
|
||
|
||
// RecallStandaloneCardsRequest 回收单卡请求
|
||
// 系统自动识别卡所属店铺,只要是操作者的直属下级店铺即可回收
|
||
type RecallStandaloneCardsRequest struct {
|
||
// SelectionType 选卡方式(必填)
|
||
SelectionType string `json:"selection_type" validate:"required,oneof=list range filter" required:"true" enum:"list,range,filter" description:"选卡方式 (list:ICCID列表, range:号段范围, filter:筛选条件)"`
|
||
|
||
// ===== selection_type=list 时使用 =====
|
||
ICCIDs []string `json:"iccids" validate:"required_if=SelectionType list,omitempty,max=1000,dive,required,max=20" description:"ICCID列表(selection_type=list时必填,最多1000个)"`
|
||
|
||
// ===== selection_type=range 时使用 =====
|
||
ICCIDStart string `json:"iccid_start" validate:"required_if=SelectionType range,omitempty,max=20" maxLength:"20" description:"起始ICCID(selection_type=range时必填)"`
|
||
ICCIDEnd string `json:"iccid_end" validate:"required_if=SelectionType range,omitempty,max=20" maxLength:"20" description:"结束ICCID(selection_type=range时必填)"`
|
||
|
||
// ===== selection_type=filter 时使用 =====
|
||
CarrierID *uint `json:"carrier_id" description:"运营商ID(selection_type=filter时可选)"`
|
||
BatchNo string `json:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号(selection_type=filter时可选)"`
|
||
|
||
// Remark 备注
|
||
Remark string `json:"remark" validate:"omitempty,max=500" maxLength:"500" description:"备注"`
|
||
}
|
||
|
||
// RecallStandaloneCardsResponse 回收单卡响应
|
||
type RecallStandaloneCardsResponse struct {
|
||
// TotalCount 待回收总数
|
||
TotalCount int `json:"total_count" description:"待回收总数"`
|
||
// SuccessCount 成功数
|
||
SuccessCount int `json:"success_count" description:"成功数"`
|
||
// FailCount 失败数
|
||
FailCount int `json:"fail_count" description:"失败数"`
|
||
// AllocationNo 回收单号
|
||
AllocationNo string `json:"allocation_no" description:"回收单号"`
|
||
// FailedItems 失败项列表
|
||
FailedItems []AllocationFailedItem `json:"failed_items" description:"失败项列表"`
|
||
}
|