liufumingren f5bff78d88 fix(shopro): 修复小程序登录 500(EasyWeChat 日志写 /tmp 被 open_basedir 拦截)
现象:微信小程序登录不上。实测 POST /api/user/getWxMiniProgramSessionKey
(appid=wx31f8d1ee127bc64b)返回 500:
[2] ErrorException in monolog StreamHandler.php:210
is_dir(): open_basedir restriction in effect. File(/tmp) is not within the
allowed path(s): (/www/wwwroot/ye4s.wms.gztbyc.com/:/www/server/php/74/var/ye4s-tmp/)

原因:addons/shopro/library/Wechat::setConfig 把 easywechat 日志路径写死成
/tmp/easywechat.log,新环境 open_basedir 不再放行 /tmp,Monolog 建目录时
触发 warning,TP5 转成 ErrorException,整个 code 换 session_key 接口中断。

改动:
- 日志路径改为站点 RUNTIME_PATH/easywechat/easywechat.log,并自动建目录
- 去掉 Model 上不存在的 \->error()(会抛 method not exist),改为
  抛出带 appid 的明确异常

验证:接口已能进入 EasyWeChat 初始化,不再因 open_basedir 中断。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-25 09:35:42 +08:00
..