package constants // ======================================== // IoT SIM 管理系统常量定义 // ======================================== // ======================================== // 1. 核心业务常量 // ======================================== // IoT 卡状态 const ( IotCardStatusInStock = 1 // 在库 IotCardStatusDistributed = 2 // 已分销 IotCardStatusActivated = 3 // 已激活 IotCardStatusSuspended = 4 // 已停用 ) // IoT 卡业务类型 const ( CardCategoryNormal = "normal" // 普通卡(需要实名认证) CardCategoryIndustry = "industry" // 行业卡(无需实名认证) ) // 设备状态 const ( DeviceStatusInStock = 1 // 在库 DeviceStatusDistributed = 2 // 已分销 DeviceStatusActivated = 3 // 已激活 DeviceStatusSuspended = 4 // 已停用 ) // 号卡状态 const ( NumberCardStatusOnSale = 1 // 在售 NumberCardStatusOffSale = 2 // 下架 ) // IoT 卡激活状态 const ( ActivationStatusInactive = 0 // 未激活 ActivationStatusActive = 1 // 已激活 ) // IoT 卡实名状态 const ( RealNameStatusNotVerified = 0 // 未实名 RealNameStatusVerified = 1 // 已实名 ) // IoT 卡网络状态 const ( NetworkStatusOffline = 0 // 停机 NetworkStatusOnline = 1 // 开机 ) // IoT 卡停机原因 const ( StopReasonTrafficExhausted = "traffic_exhausted" // 流量耗尽 StopReasonManual = "manual" // 手动停机 StopReasonArrears = "arrears" // 欠费 StopReasonProtectPeriod = "protect_period" // 保护期一致性检查自动停机 StopReasonNoPackage = "no_package" // 停机原因:无有效套餐 StopReasonNotRealname = "not_realname" // 停机原因:非行业卡且未完成实名认证 ) // 套餐流量类型 const ( DataTypeReal = "real" // 真流量 DataTypeVirtual = "virtual" // 虚流量 ) // 套餐类型 const ( PackageTypeFormal = "formal" // 正式套餐 PackageTypeAddon = "addon" // 附加套餐 ) // 订单类型 const ( OrderTypePackage = 1 // 套餐订单 OrderTypeNumberCard = 2 // 号卡订单 ) // 订单状态 (IoT 模块) const ( IotOrderStatusPending = 1 // 待支付 IotOrderStatusPaid = 2 // 已支付 IotOrderStatusCompleted = 3 // 已完成 IotOrderStatusCancelled = 4 // 已取消 IotOrderStatusRefunded = 5 // 已退款 ) // 支付方式 const ( PaymentMethodWallet = "wallet" // 钱包 PaymentMethodOnline = "online" // 在线支付 PaymentMethodCarrier = "carrier" // 运营商支付 ) // 所有者类型(统一枚举,仅支持 platform 和 shop) const ( OwnerTypePlatform = "platform" // 平台 OwnerTypeShop = "shop" // 店铺(代理商) ) // 企业卡授权状态 const ( EnterpriseCardAuthStatusValid = 1 // 有效 EnterpriseCardAuthStatusRevoked = 0 // 已回收 ) // 资产分配类型 const ( AssetAllocationTypeAllocate = "allocate" // 分配 AssetAllocationTypeRecall = "recall" // 回收 ) // 资产类型 const ( AssetTypeIotCard = "iot_card" // 物联网卡 AssetTypeDevice = "device" // 设备 ) // 放款类型 const ( PaymentTypeManual = "manual" // 人工打款 ) // 绑定状态 const ( BindStatusBound = 1 // 已绑定 BindStatusUnbound = 2 // 已解绑 ) // ======================================== // 2. 套餐和轮询相关常量 // ======================================== // 套餐使用类型 const ( PackageUsageTypeSingleCard = "single_card" // 单卡套餐 PackageUsageTypeDevice = "device" // 设备级套餐 ) // 注意:套餐使用状态常量已迁移至 constants.go(扩展为 5 个状态:0-4) // 轮询配置卡条件 const ( CardConditionNotRealName = "not_real_name" // 未实名 CardConditionRealName = "real_name" // 已实名 CardConditionActivated = "activated" // 已激活 CardConditionSuspended = "suspended" // 已停用 ) // 流量使用记录来源 const ( DataUsageSourcePolling = "polling" // 轮询 DataUsageSourceManual = "manual" // 手动 DataUsageSourceGateway = "gateway" // Gateway回调 ) // ======================================== // 3. 分佣相关常量 // ======================================== // 分佣类型 const ( CommissionTypeOneTime = "one_time" // 一次性分佣 CommissionTypeLongTerm = "long_term" // 长期分佣 CommissionTypeCombined = "combined" // 组合分佣 ) // 分佣模式 const ( CommissionModeFixed = "fixed" // 固定金额 CommissionModePercent = "percent" // 百分比 ) // 分佣状态 const ( CommissionStatusFrozen = 1 // 已冻结 CommissionStatusUnfreezing = 2 // 解冻中 CommissionStatusReleased = 3 // 已发放 CommissionStatusInvalid = 4 // 已失效 CommissionStatusPendingReview = 99 // 待人工修正(链路断裂,需平台处理) ) // 阶梯类型([预留] 用于分佣阶梯功能,待产品规划) const ( LadderTypeActivation = "activation" // 激活量([预留]) LadderTypePickup = "pickup" // 提货量([预留]) LadderTypeDeposit = "deposit" // 充值量([预留]) ) // 卡类型 const ( CardTypeNumberCard = "number_card" // 号卡 CardTypeIotCard = "iot_card" // IoT卡 ) // 审批类型([预留] 用于审批流程功能,待产品规划) const ( ApprovalTypeAuto = "auto" // 自动([预留]) ApprovalTypeManual = "manual" // 人工([预留]) ) // 审批状态([预留] 用于审批流程功能,待产品规划) const ( ApprovalStatusPending = 1 // 待审批([预留]) ApprovalStatusApproved = 2 // 已通过([预留]) ApprovalStatusRejected = 3 // 已拒绝([预留]) ) // ======================================== // 4. 财务管理常量 // ======================================== // 提现状态 const ( WithdrawalStatusPending = 1 // 待审核 WithdrawalStatusApproved = 2 // 已通过 WithdrawalStatusRejected = 3 // 已拒绝 WithdrawalStatusPaid = 4 // 已到账 ) // 提现方式 const ( WithdrawalMethodAlipay = "alipay" // 支付宝 WithdrawalMethodWechat = "wechat" // 微信 WithdrawalMethodBank = "bank" // 银行卡 ) // 商户类型([预留] 用于未来商户管理功能,待产品规划) const ( MerchantTypeAlipay = "alipay" // 支付宝([预留]) MerchantTypeWechat = "wechat" // 微信([预留]) MerchantTypeBank = "bank" // 银行卡([预留]) ) // ======================================== // 5. 系统管理常量 // ======================================== // 换卡申请状态([预留] 用于换卡申请功能,待产品规划) const ( ReplacementStatusPending = 1 // 待处理([预留]) ReplacementStatusApproved = 2 // 已通过([预留]) ReplacementStatusRejected = 3 // 已拒绝([预留]) ReplacementStatusCompleted = 4 // 已完成([预留]) ) // ======================================== // 运营商编码 // ======================================== const ( CarrierCodeCMCC = "CMCC" // 中国移动 CarrierCodeCUCC = "CUCC" // 中国联通 CarrierCodeCTCC = "CTCC" // 中国电信 CarrierCodeCBN = "CBN" // 广电 ) // 换货原因([预留] 用于换卡原因管理功能,待产品规划) const ( ReplacementReasonDamaged = "damaged" // 损坏([预留]) ReplacementReasonLost = "lost" // 丢失([预留]) ReplacementReasonMalfunction = "malfunction" // 故障([预留]) ReplacementReasonUpgrade = "upgrade" // 升级([预留]) ReplacementReasonOther = "other" // 其他([预留]) ) // ======================================== // 状态名称映射函数 // ======================================== // GetIotCardStatusName 获取 IoT 卡业务状态名称 // 对应 IotCardStatus* 常量:1=在库, 2=已分销, 3=已激活, 4=已停用 func GetIotCardStatusName(status int) string { switch status { case IotCardStatusInStock: return "在库" case IotCardStatusDistributed: return "已分销" case IotCardStatusActivated: return "已激活" case IotCardStatusSuspended: return "已停用" default: return "未知" } } // GetActivationStatusName 获取激活状态名称 // 对应 ActivationStatus* 常量:0=未激活, 1=已激活 func GetActivationStatusName(status int) string { switch status { case ActivationStatusInactive: return "未激活" case ActivationStatusActive: return "已激活" default: return "未知" } } // GetRealNameStatusName 获取实名状态名称 // 对应 RealNameStatus* 常量:0=未实名, 1=已实名 func GetRealNameStatusName(status int) string { switch status { case RealNameStatusNotVerified: return "未实名" case RealNameStatusVerified: return "已实名" default: return "未知" } } // GetNetworkStatusName 获取网络状态名称 // 对应 NetworkStatus* 常量:0=停机, 1=开机 func GetNetworkStatusName(status int) string { switch status { case NetworkStatusOffline: return "停机" case NetworkStatusOnline: return "开机" default: return "未知" } } // GetCommissionRecordStatusName 获取佣金记录状态名称 // 对应 CommissionStatus* 常量:1=已冻结, 2=解冻中, 3=已发放, 4=已失效, 99=待人工修正 func GetCommissionRecordStatusName(status int) string { switch status { case CommissionStatusFrozen: return "已冻结" case CommissionStatusUnfreezing: return "解冻中" case CommissionStatusReleased: return "已发放" case CommissionStatusInvalid: return "已失效" case CommissionStatusPendingReview: return "待人工修正" default: return "未知" } } // GetOrderPaymentStatusName 获取订单支付状态名称 // 1=待支付, 2=已支付, 3=已取消, 4=已退款 func GetOrderPaymentStatusName(status int) string { switch status { case 1: return "待支付" case 2: return "已支付" case 3: return "已取消" case 4: return "已退款" default: return "未知" } } // GetOrderCommissionStatusName 获取订单佣金计算状态名称 // 1=待计算, 2=已计算 func GetOrderCommissionStatusName(status int) string { switch status { case 1: return "待计算" case 2: return "已计算" default: return "未知" } } // GetRefundStatusName 获取退款申请状态名称 // 1=待审批, 2=已通过, 3=已拒绝, 4=已退回 func GetRefundStatusName(status int) string { switch status { case 1: return "待审批" case 2: return "已通过" case 3: return "已拒绝" case 4: return "已退回" default: return "未知" } } // GetWithdrawalStatusName 获取提现申请状态名称 // 对应 WithdrawalStatus* 常量:1=待审核, 2=已通过, 3=已拒绝, 4=已到账 func GetWithdrawalStatusName(status int) string { switch status { case WithdrawalStatusPending: return "待审核" case WithdrawalStatusApproved: return "已通过" case WithdrawalStatusRejected: return "已拒绝" case WithdrawalStatusPaid: return "已到账" default: return "未知" } } // GetEnterpriseCardAuthStatusName 获取企业卡授权状态名称 // 对应 EnterpriseCardAuthStatus* 常量:0=已回收, 1=有效 func GetEnterpriseCardAuthStatusName(status int) string { switch status { case EnterpriseCardAuthStatusRevoked: return "已回收" case EnterpriseCardAuthStatusValid: return "有效" default: return "未知" } }