import request from './request'; // 发货时效要扫两张订单表 + 出库表(rpt 下全是视图),冷启动实测 40~50 秒, // 超时必须放大到 3 分钟,否则前端会先断开、后端还在跑。 const TIMELINESS_TIMEOUT_MS = 3 * 60 * 1000; // 仓储中心 24 小时发货时效:每个主仓「超时未发」数量 + 超时订单明细 // params.round 'NOON' | 'AFTERNOON'(不传按当前时刻自动判定) // params.limit 明细条数上限 export const getWarehouseShipTimeliness = (params = {}) => request.get( '/api/warehouse-ship-timeliness/list', { params, timeout: TIMELINESS_TIMEOUT_MS, headers: { 'Cache-Control': 'no-cache' }, } ); // 仅取今日两轮核验的描述(不打订单表,秒回),用于顶部提示 export const getWarehouseShipTimelinessRounds = () => request.get( '/api/warehouse-ship-timeliness/rounds', { timeout: 30000 } ); // 「超时未发」明细导出:不分页、不截断,返回本轮考核口径内的全部行。 // 与 /list 共用后端同一份缓存,所以页面刚刷过时这里是秒回; // 冷启动(缓存已过期)仍要全量扫视图,超时同样放大到 3 分钟。 export const getWarehouseShipTimelinessExportRows = (params = {}) => request.get( '/api/warehouse-ship-timeliness/export', { params, timeout: TIMELINESS_TIMEOUT_MS, headers: { 'Cache-Control': 'no-cache' }, } ); // ── 两轮核验完成后推文本到钉钉群(2026-10-27 新增)──────────────────────── // 通道 = 群自定义机器人 webhook(不发 .xlsx,只发 text;加签密钥可选) // 读配置:加签密钥只回掩码(webhookSecretConfigured + webhookSecretPreview) export const getShipTimelinessNotifySettings = () => request.get( '/api/warehouse-ship-timeliness/notify/settings', { timeout: 30000, headers: { 'Cache-Control': 'no-cache' } } ); // 保存配置:加签密钥留空 = 沿用已存的,不必每次重填 export const saveShipTimelinessNotifySettings = (payload = {}) => request.put( '/api/warehouse-ship-timeliness/notify/settings', payload, { timeout: 30000 } ); // 立即推送 / 预览正文 / 测试通道 // dryRun=true 只组装消息不发送(返回正文全文) // probe=true 只发一句通道测试,不查业务数据 // 冷启动要全量扫订单状态视图(生产实测数十秒到几分钟),超时给足 export const runShipTimelinessNotify = (payload = {}) => request.post( '/api/warehouse-ship-timeliness/notify/run', payload, { timeout: 10 * 60 * 1000 } );