WMS_MAIN/config/config.default.js
liufumingren 839d4e2d7f feat(video): 视频补录请求状态收敛与结果通知拆分
1) 新增 wms_video_record_request 模型与迁移(群/人员信息列、状态+通知扫描索引);索引调整为 (status,is_notified,last_request_at) 并移除单列 idx_status。

2) systems/video_record_request.js:settleStatuses 只收敛状态(可用/全部失败/超时/参数缺失),notifyResults 只做结果通知;成功结果按原查询链路(queryPackVideo/queryReturn)取回并回原群,失败/超时回原群并转人工通知(仓库群客服群,未命中不外发)。

3) schedule/notify_video_record_result.js:每 1 分钟串行执行「状态收敛 → 结果通知」,带重入锁,仅在有变化时打日志。

4) inbox/functions.js:查询打包/拆包视频时同步补录请求状态(有视频置 completed),无可用视频时登记补录请求并推送录制服务。

5) config.inbox 新增 videoRecordNotifyLimit / videoRecordNotifyTimeoutMs。
2026-09-11 02:49:27 +08:00

270 lines
8.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const path = require('node:path');
/**
* 生成应用默认配置。
* @param {Egg.EggAppInfo} appInfo 应用信息。
* @return {Egg.EggAppConfig} 应用配置。
*/
module.exports = appInfo => {
/**
* built-in config
* @type {Egg.EggAppConfig}
**/
const config = exports = {};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1745985142442_9900';
// add your middleware config here
config.middleware = [];
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
const tencentCloudConfig = require('./tencent-cloud');
config.redis = {
clients: {
cache: {
port: 6379,
host: '127.0.0.1',
password: 'qwe2019@',
db: 10,
},
printer: {
port: 6379,
host: '127.0.0.1',
password: 'qwe2019@',
db: 11,
},
},
};
config.security = {
csrf: {
enable: false,
},
};
config.qimen = {
appKey: 23535631,
security: 'd0cbd3935e3afa2b42b5dc600c08a795',
};
config.deepseek = {
apiKey: process.env.DEEPSEEK_API_KEY || '',
baseUrl: 'https://api.deepseek.com',
};
// 站内信模块配置
config.inbox = {
imageBaseUrl: '', // 商品图片域名,为空时用请求 ctx.host
// 历史消息过滤:消息原始发送时间距今超过该阈值(毫秒)则跳过 AI 处理,防止补推历史消息被当成新工单
historyMessageMaxAgeMs: 10 * 60 * 1000,
// AI 兜底开关:规则引擎未命中时是否回退 AI 推理(默认关闭,节省费用;开启后未命中消息走 AI)
aiFallback: false,
// 退回收件登记聚合通知防抖窗口(毫秒):等该时长无新登记后合并推送,默认 5 分钟
returnReceivedNotifyDelayMs: 5 * 60 * 1000,
// 视频补录结果通知:单轮处理条数上限(定时任务每 1 分钟扫一次)
videoRecordNotifyLimit: 10,
// 视频补录结果通知:超时阈值(毫秒),超过仍无录像则按超时回信并终止,避免长期占用扫描窗口
videoRecordNotifyTimeoutMs: 60 * 60 * 1000,
};
config.tencentCloud = {
...tencentCloudConfig,
};
config.cos = {
...config.tencentCloud,
bucket: 'ye4s-1255377868',
region: 'ap-guangzhou',
uploadurl: 'https://ye4s-1255377868.cos.ap-guangzhou.myqcloud.com',
cdnurl: 'https://ye4s.file.gzxunren.com',
savekey: '{warehouseId}/{dir}/{year}{mon}{day}/{filemd5}{.suffix}',
expire: 600,
maxsize: '100M',
mimetype: 'jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx,apk',
apiupload: 1,
dirs: {
image: 'images/',
document: 'documents/',
apk: 'apks/',
temp: 'temp/', // 临时文件目录
},
};
config.fileWriter = {
baseDir: path.join(appInfo.baseDir, 'runtime', 'file-writer'),
maxFileSize: 100 * 1024 * 1024,
maxFileLines: 2000,
maxConsumeRecordsPerWindow: 1000,
maxConsumeRecordsPerRun: 1000,
writeWindowSeconds: 1,
maxWriteRecordsPerWindow: 1000,
retentionDays: 7,
cleanupIntervalMs: 60 * 60 * 1000,
sequenceWidth: 4,
stateMapMaxEntries: 256,
fileExtension: '.log',
progressExtension: '.progress',
};
config.fileTypes = {
// 图片类型
image: 'image',
'image/jpeg': 'image',
'image/jpg': 'image',
'image/png': 'image',
'image/gif': 'image',
'image/bmp': 'image',
'image/webp': 'image',
'image/svg+xml': 'image',
// 文档类型
'application/pdf': 'document',
'application/msword': 'document',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'document',
'application/vnd.ms-excel': 'document',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'document',
'application/vnd.ms-powerpoint': 'document',
'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'document',
'text/plain': 'document',
// 压缩文件
'application/zip': 'document',
'application/x-rar-compressed': 'document',
'application/x-7z-compressed': 'document',
// APK
'application/vnd.android.package-archive': 'apk',
// 视频
'video/mp4': 'video',
'video/mpeg': 'video',
'video/quicktime': 'video',
'video/x-msvideo': 'video',
// 音频
'audio/mpeg': 'audio',
'audio/wav': 'audio',
'audio/x-wav': 'audio',
'audio/x-m4a': 'audio',
};
config.cors = {
origin: ctx => ctx.get('Origin'), // 动态返回请求源,配合 credentials: true 使用
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
exposeHeaders: 'Authorization',
credentials: true, // 允许携带 cookie
};
config.mysql = {
clients: {
wms: {
host: '127.0.0.1',
port: '3306',
user: 'wms',
password: 'P6j3YTHTpirepYWz',
database: 'wms',
},
ye4s: {
host: '127.0.0.1',
port: '3306',
user: 'ye4s',
password: 'H@8h^QE4N$L.F_*',
database: 'ye4s',
},
},
app: true,
agent: false,
};
exports.sequelize = {
dialect: 'mysql',
host: '112.124.21.102',
port: 3306,
database: 'wms',
username: 'wms',
password: 'P6j3YTHTpirepYWz',
define: {
freezeTableName: true,
underscored: true,
timestamps: true,
paranoid: true, // 启用软删除
deletedAt: 'deleted_at', // 软删除字段名
},
pool: {
max: 225,
min: 1,
idle: 10000,
acquire: 30000,
},
};
config.jwt = {
expiresIn: 14400,
renewThreshold: 7200,
secret: 'E5#ex.g@,GfL_8?',
};
config.view = {
defaultViewEngine: 'ejs',
mapping: {
'.html': 'ejs',
},
};
config.cluster = {
listen: {
port: 6060, // 使用其他端口避免冲突
hostname: '0.0.0.0',
},
};
config.poloapi = {
};
config.debug = false; // 生成环境默认关闭 debug,开发环境通过 config.local.js 开启
config.platformOauthReservationCodePrefix = '';
config.printService = {
url: 'http://printer.wms.gztbyc.com',
};
// 仓库侧前端地址(通知文案快速查看链接)
config.frontendUrl = 'http://wms.wms.gztbyc.com';
// 货主侧前端地址(货主群通知使用,与仓库侧不同)
config.storeFrontendUrl = 'http://store.wms.gztbyc.com';
config.printRetryCompensation = {
enable: false,
intervalMs: 60 * 1000,
batchSize: 50,
force: false,
};
// 工作台 token 超期强制下线定时任务配置
config.workbenchTokenExpire = {
enable: true,
// 扫描间隔(毫秒),默认每小时扫描一次;开发环境可在 config.local.js 覆盖为短循环
scanIntervalMs: 60 * 60 * 1000,
// token 有效期阈值(毫秒):token_updated_at 距今超过该时长则强制下线(默认 3 个月,按 30 天/月折算)
maxAgeMs: 3 * 30 * 24 * 60 * 60 * 1000,
// 单轮批处理大小(按 id 升序分批)
batchSize: 50,
};
// 系统日志超期清理定时任务配置(每日凌晨 03:00 执行,硬删除 wms_system_log 超期数据释放磁盘空间)
config.systemLogCleanup = {
enable: true,
// 触发 cron(秒 分 时 日 月 周):默认每日凌晨 03:00;本地环境可在 config.local.js 覆盖为短间隔
cron: '0 0 3 * * *',
// 日志保留天数:删除 created_at 早于该天数的日志(默认 60 天,仅接受正整数,非法值回退 60)
retainDays: 60,
// 单批硬删除行数(按 id 升序分批,走主键索引)
batchSize: 2000,
// 批间休眠毫秒数下限/上限:在区间内随机取值,降低数据库瞬时压力
sleepMinMs: 100,
sleepMaxMs: 500,
};
// 打印自定义区模板出口域名
config.customAreaBaseUrl = 'https://api.ye4s.com';
// 仓库前端独立部署:证书部署目录。
// 保存接口(setting.warehouse.saveFrontCert)已不再写暂存文件,证书/私钥内容直接入库;
// 该目录保留供未来定时任务(Egg schedule 或外部 crontab)从库内 cert_pem/cert_key 读取内容后写 nginx 证书目录使用。
config.frontConfig = {
certStagingDir: '/data/wms/cert-staging',
};
return {
...config,
...userConfig,
};
};