23 Commits

Author SHA1 Message Date
liufumingren
d953976391 feat(wms): waybill 入参支持「单号|手机号后四位」,查询轨迹时透传
- WaybillCodes 支持拆分单号与手机号后四位(去空格/非数字,超长取后四位),
  按单号去重保序,无后缀时行为与原来完全一致
- express/Trace 支持 phone:buildQueryString 在有 phone 时追加第 4 段
  (单号|单号|公司代码|后四位),无 phone 时保持原格式;去重键改为 单号|phone
- waybill.getTrace / waybill.getreceive 均透传 phone,响应中单号仍不含手机号

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-12 03:54:52 +08:00
liufumingren
396e9d0581 feat(wms): 新增运单轨迹查询回调 waybill.getTrace
- notify/WaybillTraceHandler:按 {request:{waybill_codes}} 批量查询轨迹(10 单并发),
  输出裸数组 [{waybillNo, trace:[{opTime,outBizCode,memo,opOrgCityName,weight,scanType}]}]
- notify/WaybillCodes:抽取 waybill.* 系列共用的入参解析(兼容平铺结构、去空、去重保序、限量)
- WaybillReceiveHandler 改用 WaybillCodes,行为不变
- express/Trace::parseResult 增加 raw(上游原始轨迹),供 getTrace 原样透出
- Dispatcher 注册 waybill.getTrace

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-11 20:34:06 +08:00
liufumingren
4e5c05dfc3 feat(wms): 新增运单揽收状态查询回调 waybill.getreceive
- express/Recognizer:按字母前缀 + 位数号段识别运单快递公司(p01~p35)
- express/Trace:批量并发查轨迹(curl_multi,默认 10 并发),解析状态/首末轨迹/中转签收时效
- notify/WaybillReceiveHandler:外部传入运单号自动识别公司后查轨迹,轨迹非空即已揽收,
  已揽收结果缓存 24h(命中不再请求接口),未揽收/查不到/识别不出/接口异常一律返回 0
- notify/RawResponse:支持裸数组响应透出,不套 {code,msg,data} 外壳
- new_wms_notify 输出 [{"waybill_code","is_galaxy_receive"}]

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-11 03:22:21 +08:00
liufumingren
7b18287328 fix: 全项目清理 PHP 7.4 升级遗留(open_basedir 临时目录、implode 反序、null 取下标、嵌套三元)
一、open_basedir 不能再写 /tmp(7.4 池子把白名单收紧,Monolog/EasyWeChat 会抛异常)
- addons/shopro/library/Wechat.php:easywechat 日志改到 runtime/easywechat/
- addons/epay/library/Yansongda/Supports/Logger.php:epay 日志默认路径改到 runtime/epay/
- application/admin/library/traits/Backend.php:CSV 导入临时文件改到 runtime/temp/

二、implode 参数反序(7.4 起 E_DEPRECATED,TP5 会抛异常)
- application/api/controller/Datas.php
- application/index/controller/wms/Pda.php
- 另修正 Wms.php 中 1 处(拆分面单提示)

三、null 取下标(7.4 起 "Trying to access array offset on value of type null")
- 覆盖 71 个文件 135 行:find()/value()/json_decode()/redis get 等结果未判空即取下标处,
  统一 (\['k'] ?? null) 兜底;foreach 目标用 ?? [];in_array/count 等数组参数用 ?? []
- 涉及 api/*、admin/shopro/*、addons/shopro/*、addons/epay/*、index/wms/* 等

四、嵌套三元未加括号(7.4 弃用)
- application/index/controller/wms/Wms.php getPackingprice 2 处,补括号后与旧版本解析顺序一致

验证:74 个文件、148 行改动,逐行括号/引号配平与 HEAD 一致,未改动 vendor/ 与 thinkphp/;
剩余扫描命中均为写目标、unset、或已被 if(!\){error()} 拦截的假阳性。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-25 09:47:48 +08:00
liufumingren
276a6ef37d fix(chat): 修复 PHP 7.4 升级引发的其余告警(implode 弃用、null 取下标)
全量检查 chat 相关代码(Chat.php / qiwe/Index.php / library/chat/Orders.php
/ library/qiwe / new_wms/Forward.php),补齐升级后才暴露的问题:

1. implode 参数反序(4 处,PHP 7.4 起 E_DEPRECATED,TP5 会抛成异常):
   Chat.php 群列表/指令/门店查询里  implode(\," and ")
   -> implode(" and ", \),输出 SQL 完全一致
2. carriage 查运费:getOrderInfoByPostnum 未命中返回 false,
   if(\["ID"]) 在 7.4 会抛 bool 取下标 -> 改为 if(\ && \["ID"])
3. kdroomMessageExplpde2 队列消费:json_decode 失败时 \ 为 null,
   补 is_array 判断跳过脏数据
4. qiwe/Index.php 5 处接口返回 json_decode 后直接用 \["code"]:
   补 \ && 前置判断(getRoomList/batchGetRoomDetails/
   batchGetUserinfo/sendImage/sendFile),避免空返回时抛 notice
5. chat/Orders.php createOrderToWms:订单回查为 null 时取 POSTNUM/ID/
   ERRORRECORDS 的兜底,改为 empty() 与 ??

以上均为 7.4 兼容性修复,业务行为保持不变。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-22 14:23:27 +08:00
liufumingren
9b1f656790 feat: notify.reply 支持 extend_props.do 动作(openDoor / registerLicensePlate)
入站通知新增两条相互独立的处理线:文本回复 + 动作指令。

- content trim 后为空(含纯空白)→ 不对外发送,并跳过 IM 通道在线检测,
  避免纯动作请求被 503 拒绝、WMS 反复重试;ext_id 幂等去重仍生效。
- extend_props.do 映射到 notify/action/ 下的动作类(大小写不敏感),
  extend_props.value 为泛类型入参(字符串/数字/布尔/对象/数组/JSON/null)。
- 新增 openDoor:Redis db2 写 {WAREHOUSEID}_channelNum{N}(TTL 300s)+ 写 door_log。
- 新增 registerLicensePlate:Redis db7 写 {WAREHOUSEID}_{车牌} NX EX 21600(6 小时临时通行),
  与 Chat::daohuo()/tihuo() 同一套机制,入口设备读到即放行并删键。
- 公共能力(Redis 连接、仓库解析、操作人解析、车牌提取)上移到 action/Base,
  两个动作共用;仓库解析顺序:value.warehouseId → group_id 反查群 → 默认 5400。
2026-09-16 21:10:15 +08:00
liufumingren
9b25b43e63 1 2026-09-10 14:58:24 +08:00
liufumingren
d63dfcfcd7 1 2026-09-10 14:39:58 +08:00
liufumingren
395cfeb14a feat: new_wms_notify reply 支持多用户 @(user_id 数组/分隔字符串) 2026-08-29 06:36:22 +08:00
liufumingren
e177a4771f feat: IM通道在线检测(qiwe新增getProfile/checkOnline,new_wms_notify reply离线返回503) 2026-08-18 00:55:01 +08:00
liufumingren
2330b6003f fix(wms): do not escape slashes in JSON serialization for signature compatibility with Node WMS 2026-08-15 19:11:58 +08:00
liufumingren
c00708f58c feat: 入站 notify 对接完成(ping/reply + 入站签名算法)
- 新增 notify/PingHandler.php(notify.ping 连通性测试)
- 新增 notify/ReplyHandler.php(notify.reply 消息回复,Redis 幂等 + 推送到 IM)
- Dispatcher 自动注册内置处理器,入站签名改为 MD5(secret+timestamp+bodyJson)
- WmsSign 新增 getAppSecret() 供验签使用
- ReplyHandler 通过 ext_data.source 判断消息来源(wx/qiwe)
2026-08-07 22:52:46 +08:00
liufumingren
3d566595e0 feat: 入站通知接口 + 调试日志增强
- 新增 notify/Dispatcher.php 入站分发器(验签+method路由)
- Wms.php 新增 new_wms_notify 统一入站入口
- Forward.php 修正字段映射(groupId/userId 强转字符串,groupName/userName 修正)
- Base.php 调试日志全部改为 error 级别,打印完整请求/响应
- 移除 sourceType 入参
2026-08-07 21:47:34 +08:00
liufumingren
d617f9ee88 1 2026-08-07 00:37:41 +08:00
liufumingren
dcc016bf42 fix:修复push消息传参 2026-08-07 00:33:21 +08:00
liufumingren
efb69dc45e 1 2026-08-07 00:29:38 +08:00
liufumingren
94fd06c6ab 1 2026-08-07 00:22:37 +08:00
liufumingren
1f40838320 fix: 修复 WMS API 请求格式(query string + timestamp 类型)
- base_url 改为 qimen.wms.gztbyc.com
- query 参数拼入 URL query string(method/timestamp/app_key/sign)
- timestamp 改为整数类型(Unix 秒)
- 移除多余 X-* 自定义 Header
2026-08-06 23:38:27 +08:00
liufumingren
c35ac184ae feat: WMS 开放接口签名 & 消息转发模块
- 新增 extra/wms.php 统一配置(app_key/app_secret/base_url)
- 新增 WmsSign.php 签名工具(canonicalQuery + bodySign + stableStringify)
- 新增 WmsVerify.php 验签工具(恒定时间比较防时序攻击)
- 新增 func/ 目录与远端 API 对应(Index.ping / Store.list / Inbox.push)
- 重构 Forward.php 使用 Inbox.push 转发群聊消息到 WMS 站内信
- Chat.php processMessage 接入 Forward 转发,异常不阻塞原有流程
- 删除冗余 WmsSignConfig.php,配置统一从 config('wms') 读取
- 修复 deploy.js chown/chmod .user.ini 报错
2026-08-06 22:46:30 +08:00
liufumingren
248b8876be 1 2026-08-06 18:06:02 +08:00
liufumingren
8ec39aa20f 1 2026-08-06 18:05:57 +08:00
liufumingren
61b6d603cd 1 2026-08-06 17:46:06 +08:00
liufumingren
e8605149c0 初始化 2026-08-06 17:04:35 +08:00