All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 13m40s
统一时间筛选:新增共享严格解析器 pkg/utils/time_range.go,只接受带显式时区的 RFC3339 秒级时间(拒绝小数秒、无时区、date-only、空格分隔、±hhmm、未补零、非法日期与越界偏移),闭区间含两端、归一为 UTC 瞬时,创建期与执行期共用同一份实现。 端点改造(13 个入口):IoT 卡导入任务、设备导入任务、导出任务列表、订单列表参数名不变仅收紧解析;换货、分配记录、代理充值、临期列表改名 start_time/end_time(旧参数名显式拒绝);提现记录两处删除解析失败静默跳过,非法参数一律 1001;授权记录由起始闭结束开改为闭区间含两端;临期列表改按当前生效主套餐最终到期时刻比较,保留剩余天数上下限与既有粗放窗口。 临期导出新建:新场景 expiring_asset 与受控入口 POST /api/admin/expiring-assets/export,复用列表候选预筛与最终到期推算,一行一资产、加油包不单独成行,列序与 111 §18.1 逐列一致,店铺/业务员/用户组按执行时当前归属补充且不超出创建时冻结范围。 佣金明细导出新增按创建时间闭区间筛选(原佣金与回溯两条分支各自创建时间列),记录粒度、列定义与余额口径不变。 冻结与遗留任务:创建期把筛选与时间边界规范化为 UTC RFC3339 秒级串写入既有 query_json,无新列无迁移;执行期只按冻结值严格解析,非法冻结值在任何分片与文件动作前落任务失败并写安全摘要,不放行全量;重试沿用原快照。达量预警导出执行期同样纳入严格解析(其入口契约、列定义与触发快照口径不变)。 归档 add-export-time-filter-standards 并新建主 Spec openspec/specs/export-time-filter/spec.md,同步 requirement-evidence.json 与入口能力矩阵,README 导出场景清单更新为 11 个场景。 验证:junhong_cmp_test + 本地隔离 Redis(DB7,测试部署共享队列 DB6 未被占用)实跑 85 PASS / 0 FAIL(接受/拒绝集合、区间与顺序语义、列表与导出同筛选行集一致、代理 HTTP 全链路与范围冻结、遗留旧格式任务安全失败、列与余额口径回归、表头逐字),门禁 gofmt/go build/gendocs 两次一致/openspec validate/doctor/context-health 全绿;无 Schema 变更、无迁移、无运行时开关。
151 lines
13 KiB
Go
151 lines
13 KiB
Go
package dto
|
||
|
||
// CreateAgentRechargeRequest 创建代理充值请求
|
||
type CreateAgentRechargeRequest struct {
|
||
ShopID *uint `json:"shop_id,omitempty" description:"目标店铺ID,仅平台线下代充可填;代理在线充值禁止传入"`
|
||
Amount int64 `json:"amount" validate:"required,min=1,max=100000000" required:"true" minimum:"1" maximum:"100000000" description:"充值金额(分),范围1分~100万元"`
|
||
PaymentMethod string `json:"payment_method" validate:"required,oneof=wechat alipay offline" required:"true" description:"支付方式 (wechat:微信在线支付, alipay:支付宝在线支付, offline:线下转账仅平台可用)"`
|
||
RequestID string `json:"request_id,omitempty" validate:"omitempty,max=64" maxLength:"64" description:"在线充值幂等请求标识,微信或支付宝支付时必填"`
|
||
PaymentVoucherKey []string `json:"payment_voucher_key" validate:"omitempty,max=5,dive,max=500" maxItems:"5" description:"支付凭证对象存储Key列表(payment_method=offline 时至少1个,最多5个,在线支付时禁止传入)"`
|
||
OtherVoucherKey []string `json:"other_voucher_key" validate:"omitempty,max=5,dive,max=500" maxItems:"5" description:"其他凭证对象存储Key列表(线下代充可选,最多5个,在线支付时禁止传入)"`
|
||
OfflinePaymentMethodID uint `json:"offline_payment_method_id" description:"线下收款方式字典ID(payment_method=offline 时必填,须取自启用中的线下收款方式字典)"`
|
||
ExternalTransactionNo string `json:"external_transaction_no" validate:"omitempty,max=128" maxLength:"128" description:"交易流水号(payment_method=offline 时必填,由付款凭证识别预填并经人工确认;系统不做跨记录去重)"`
|
||
Remark string `json:"remark" validate:"omitempty,max=1000" maxLength:"1000" description:"运营备注(可选,创建后只读)"`
|
||
}
|
||
|
||
// AgentRechargeOnlineResponse 代理在线扫码充值创建响应。
|
||
type AgentRechargeOnlineResponse struct {
|
||
RechargeID uint `json:"recharge_id" description:"充值记录ID"`
|
||
RechargeNo string `json:"recharge_no" description:"充值单号(ARCH前缀)"`
|
||
PaymentNo string `json:"payment_no" description:"支付单号(PAY前缀)"`
|
||
PaymentMethod string `json:"payment_method" description:"支付方式 (wechat:微信, alipay:支付宝)"`
|
||
RechargeSource string `json:"recharge_source" description:"充值来源 (agent_online:代理在线自充)"`
|
||
RechargeSourceName string `json:"recharge_source_name" description:"充值来源名称(中文)"`
|
||
Amount int64 `json:"amount" description:"在线充值金额(分),范围10000分~100000000分"`
|
||
QRContent string `json:"qr_content" description:"支付链接(HTTPS URL),由前端渲染二维码"`
|
||
Status int `json:"status" description:"状态 (1:待支付, 2:已支付, 3:已完成, 4:已关闭, 5:已退款, 6:已驳回)"`
|
||
StatusName string `json:"status_name" description:"状态名称(中文)"`
|
||
}
|
||
|
||
// AgentRechargePaymentMethodsResponse 代理在线充值可用支付方式响应。
|
||
type AgentRechargePaymentMethodsResponse struct {
|
||
Methods []string `json:"methods" description:"可用支付方式,固定顺序 (wechat:微信, alipay:支付宝)"`
|
||
MinAmount int64 `json:"min_amount" description:"在线充值最小金额(分),固定为10000"`
|
||
MaxAmount int64 `json:"max_amount" description:"在线充值最大金额(分),固定为100000000"`
|
||
}
|
||
|
||
// AgentRechargePaymentStatusResponse 代理充值本地支付与到账状态响应。
|
||
type AgentRechargePaymentStatusResponse struct {
|
||
RechargeID uint `json:"recharge_id" description:"充值记录ID"`
|
||
RechargeNo string `json:"recharge_no" description:"充值单号(ARCH前缀)"`
|
||
RechargeSource string `json:"recharge_source" description:"充值来源 (platform_offline:平台线下代充, agent_online:代理在线自充)"`
|
||
RechargeSourceName string `json:"recharge_source_name" description:"充值来源名称(中文)"`
|
||
Status int `json:"status" description:"充值状态 (1:待支付, 2:已支付, 3:已完成, 4:已关闭, 5:已退款, 6:已驳回)"`
|
||
StatusName string `json:"status_name" description:"充值状态名称(中文)"`
|
||
PaymentStatus int `json:"payment_status" description:"支付状态 (0:待支付, 1:已支付, 2:已失败, 3:已退款)"`
|
||
PaymentStatusName string `json:"payment_status_name" description:"支付状态名称(中文)"`
|
||
PaidAt *string `json:"paid_at" description:"第三方支付确认时间"`
|
||
CompletedAt *string `json:"completed_at" description:"钱包入账完成时间"`
|
||
}
|
||
|
||
// AgentSelfRechargePaymentMethodsUpdateRequest 修改代理在线自充允许范围请求。
|
||
// 枚举取值必须在 description 与 enum 标签两处与 pkg/constants 的 AgentSelfRechargeAllowed* 保持一致。
|
||
type AgentSelfRechargePaymentMethodsUpdateRequest struct {
|
||
AllowedMethods string `json:"allowed_methods" validate:"required,oneof=wechat_only alipay_only both" required:"true" enum:"wechat_only,alipay_only,both" description:"允许范围 (wechat_only:仅微信, alipay_only:仅支付宝, both:同时支持微信和支付宝)"`
|
||
}
|
||
|
||
// AgentSelfRechargePaymentMethodsUpdateResponse 修改代理在线自充允许范围响应。
|
||
type AgentSelfRechargePaymentMethodsUpdateResponse struct {
|
||
AllowedMethods string `json:"allowed_methods" description:"允许范围 (wechat_only:仅微信, alipay_only:仅支付宝, both:同时支持微信和支付宝)"`
|
||
AllowedMethodsName string `json:"allowed_methods_name" description:"允许范围名称(中文)"`
|
||
UpdatedAt string `json:"updated_at" description:"最近更新时间,带时区 RFC3339 格式"`
|
||
}
|
||
|
||
// AgentRechargePaymentVoucherOCRRequest 付款凭证识别请求。
|
||
type AgentRechargePaymentVoucherOCRRequest struct {
|
||
PaymentVoucherKey string `json:"payment_voucher_key" validate:"required,min=1,max=500" required:"true" minLength:"1" maxLength:"500" description:"付款凭证对象存储Key,必须指向已上传的图片类型附件"`
|
||
}
|
||
|
||
// AgentRechargePaymentVoucherOCRResponse 付款凭证识别响应,只返回交易流水号预填值。
|
||
type AgentRechargePaymentVoucherOCRResponse struct {
|
||
ExternalTransactionNo string `json:"external_transaction_no" description:"识别出的交易流水号预填值,必须经人工确认或更正后提交;金额、备注、付款人、支付方式与支付时间一律不返回"`
|
||
}
|
||
|
||
// AgentOfflinePayRequest 代理线下充值确认请求
|
||
type AgentOfflinePayRequest struct {
|
||
OperationPassword string `json:"operation_password" validate:"required" required:"true" description:"操作密码"`
|
||
}
|
||
|
||
// AgentOfflinePayParams 确认线下充值聚合参数 (用于文档生成)
|
||
type AgentOfflinePayParams struct {
|
||
IDReq
|
||
AgentOfflinePayRequest
|
||
}
|
||
|
||
// AgentRechargeResponse 代理充值记录响应
|
||
type AgentRechargeResponse struct {
|
||
ID uint `json:"id" description:"充值记录ID"`
|
||
RechargeNo string `json:"recharge_no" description:"充值单号(ARCH前缀)"`
|
||
ShopID uint `json:"shop_id" description:"店铺ID"`
|
||
ShopName string `json:"shop_name" description:"店铺名称"`
|
||
AgentWalletID uint `json:"agent_wallet_id" description:"代理钱包ID"`
|
||
Amount int64 `json:"amount" description:"充值金额(分)"`
|
||
PaymentMethod string `json:"payment_method" description:"支付方式 (wechat:微信在线支付, alipay:支付宝在线支付, offline:线下转账)"`
|
||
RechargeSource string `json:"recharge_source" description:"充值来源 (platform_offline:平台线下代充, agent_online:代理在线自充)"`
|
||
RechargeSourceName string `json:"recharge_source_name" description:"充值来源名称(中文)"`
|
||
PaymentChannel string `json:"payment_channel" description:"实际支付通道 (wechat_direct:微信直连, fuyou:富友, offline:线下转账)"`
|
||
PaymentConfigID *uint `json:"payment_config_id" description:"关联支付配置ID,线下充值为null"`
|
||
PaymentTransactionID string `json:"payment_transaction_id" description:"第三方支付流水号(在线渠道权威值,仅在线支付有值)"`
|
||
// ExternalTransactionNo 是线下充值人工确认的交易流水号,独立于在线渠道第三方交易号。
|
||
ExternalTransactionNo string `json:"external_transaction_no" description:"交易流水号(线下充值人工确认值,独立于在线渠道第三方交易号)"`
|
||
OfflinePaymentMethodID uint `json:"offline_payment_method_id,omitempty" description:"线下收款方式字典ID,仅线下充值有值"`
|
||
OfflinePaymentMethodCode string `json:"offline_payment_method_code,omitempty" description:"线下收款方式稳定编码快照,仅线下充值有值"`
|
||
OfflinePaymentMethodName string `json:"offline_payment_method_name,omitempty" description:"线下收款方式名称快照,仅线下充值有值"`
|
||
OtherVoucherKey []string `json:"other_voucher_key" description:"其他凭证对象存储Key列表,仅线下充值有值;不返回凭证内容"`
|
||
PaymentVoucherKey []string `json:"payment_voucher_key" description:"支付凭证对象存储Key列表(线下支付时存在,最多5个)"`
|
||
Remark string `json:"remark,omitempty" description:"运营备注"`
|
||
Status int `json:"status" description:"状态 (1:待支付, 2:已支付, 3:已完成, 4:已关闭, 5:已退款, 6:已驳回)"`
|
||
StatusName string `json:"status_name" description:"状态名称(中文)"`
|
||
RejectionReason *string `json:"rejection_reason,omitempty" description:"驳回原因,仅 status=6 时有值"`
|
||
SubmitterID uint `json:"submitter_id" description:"提交人账号ID"`
|
||
SubmitterName string `json:"submitter_name" description:"提交人账号名称"`
|
||
ApprovalInstanceID *uint `json:"approval_instance_id,omitempty" description:"通用审批实例ID,在线充值为null"`
|
||
ApprovalProvider string `json:"approval_provider,omitempty" description:"审批渠道,企微审批为wecom"`
|
||
ApprovalStatus *int `json:"approval_status,omitempty" description:"审批状态 (0:提交中, 1:审批中, 2:已通过, 3:已拒绝, 4:已撤销, 5:通过后撤销, 6:已删除, 7:提交失败, 8:提交结果未知)"`
|
||
ApprovalStatusName string `json:"approval_status_name,omitempty" description:"审批状态名称(中文)"`
|
||
PaidAt *string `json:"paid_at" description:"支付时间"`
|
||
CompletedAt *string `json:"completed_at" description:"完成时间"`
|
||
CreatedAt string `json:"created_at" description:"创建时间"`
|
||
UpdatedAt string `json:"updated_at" description:"更新时间"`
|
||
}
|
||
|
||
// AgentRechargeRejectRequest 驳回代理充值订单请求
|
||
type AgentRechargeRejectRequest struct {
|
||
RejectionReason string `json:"rejection_reason" validate:"required,max=500" required:"true" description:"驳回原因(必填,最多500字)"`
|
||
}
|
||
|
||
// AgentRechargeRejectParams 驳回代理充值订单聚合参数(用于文档生成)
|
||
type AgentRechargeRejectParams struct {
|
||
IDReq
|
||
AgentRechargeRejectRequest
|
||
}
|
||
|
||
// AgentRechargeListRequest 代理充值记录列表请求
|
||
type AgentRechargeListRequest struct {
|
||
Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码,默认1"`
|
||
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页条数,默认20,最大100"`
|
||
ShopID *uint `json:"shop_id" query:"shop_id" description:"按店铺ID过滤"`
|
||
Status *int `json:"status" query:"status" description:"按状态过滤 (1:待支付, 2:已支付, 3:已完成, 4:已关闭, 5:已退款, 6:已驳回)"`
|
||
RechargeSource string `json:"recharge_source" query:"recharge_source" validate:"omitempty,oneof=platform_offline agent_online" description:"按充值来源过滤 (platform_offline:平台线下代充, agent_online:代理在线自充)"`
|
||
StartTime string `json:"start_time" query:"start_time" description:"创建时间起始(带时区的 RFC3339 秒级时间,闭区间含该时刻,如 2026-09-01T00:00:00+08:00)"`
|
||
EndTime string `json:"end_time" query:"end_time" description:"创建时间结束(带时区的 RFC3339 秒级时间,闭区间含该时刻,如 2026-09-30T23:59:59+08:00)"`
|
||
}
|
||
|
||
// AgentRechargeListResponse 代理充值记录列表响应
|
||
type AgentRechargeListResponse struct {
|
||
Total int64 `json:"total" description:"总记录数"`
|
||
Page int `json:"page" description:"当前页码"`
|
||
PageSize int `json:"size" description:"每页条数"`
|
||
List []*AgentRechargeResponse `json:"items" description:"充值记录列表"`
|
||
}
|