import request from './request'; // 转运异常要扫一遍「昨日发货」的物流宽表(rpt 下全是视图),冷启动实测 20 秒左右, // 超时放大到 3 分钟,避免前端先断开、后端还在跑。 const TIMEOUT_MS = 3 * 60 * 1000; // 仓储中心物流转运异常:12 个发货仓的异常单量 + 明细 // params.date 核验日 'YYYY-MM-DD'(默认:已过 09:00 用今天,否则用昨天) // params.limit 明细条数上限 // params.force 1 = 绕过 5 分钟结果缓存 export const getWarehouseLogisticsExceptions = (params = {}) => request.get( '/api/warehouse-logistics-exception/list', { params, timeout: TIMEOUT_MS, headers: { 'Cache-Control': 'no-cache' }, } ); // 口径元数据(12 个仓、异常类型、回看天数),不打库,秒回 export const getWarehouseLogisticsExceptionMeta = () => request.get( '/api/warehouse-logistics-exception/meta', { timeout: 30000 } ); // 导出用:同一套口径、不分页(明细上限放到 5000),比列表更慢,超时再放大 export const getWarehouseLogisticsExceptionExportRows = (params = {}) => request.get( '/api/warehouse-logistics-exception/export', { params, timeout: 5 * 60 * 1000, headers: { 'Cache-Control': 'no-cache' }, } ); // ── 每天定点推文本到钉钉群 ──────────────────────────────────────────────── // 通道 = 群自定义机器人 webhook(不发 .xlsx,只发 text;加签密钥可选) // 读配置:加签密钥只回掩码(webhookSecretConfigured + webhookSecretPreview) export const getWarehouseLogisticsExceptionNotifySettings = () => request.get( '/api/warehouse-logistics-exception/notify/settings', { timeout: 30000, headers: { 'Cache-Control': 'no-cache' } } ); // 保存配置:加签密钥留空 = 沿用已存的,不必每次重填 export const saveWarehouseLogisticsExceptionNotifySettings = (payload = {}) => request.put( '/api/warehouse-logistics-exception/notify/settings', payload, { timeout: 30000 } ); // 立即推送 / 预览正文 / 测试通道 // dryRun=true 只组装消息不发送(返回正文全文) // probe=true 只发一句通道测试,不查业务数据 // 冷启动要全量扫一遍物流宽表(生产实测 3~4 分钟),超时给足 export const runWarehouseLogisticsExceptionNotify = (payload = {}) => request.post( '/api/warehouse-logistics-exception/notify/run', payload, { timeout: 10 * 60 * 1000 } );