diff --git a/addons/shopro/controller/Withdraw.php b/addons/shopro/controller/Withdraw.php index a206e49..ba89f1c 100644 --- a/addons/shopro/controller/Withdraw.php +++ b/addons/shopro/controller/Withdraw.php @@ -77,8 +77,11 @@ class Withdraw extends Common // 支付宝提现+自动打款 if ($withdraw->withdraw_type === 'alipay' && $withdrawService->config['auto_arrival']) { try { - // 记录提现日志 + // 记录提现日志(会自动检查时间限制) $withdrawService->handleAlipayWithdraw($withdraw); + } catch (\addons\shopro\exception\ShoproException $e) { + // 时间限制检查失败,不自动打款,保持待审核状态 + $this->error($e->getMessage()); } catch (HttpResponseException $e) { $data = $e->getResponse()->getData(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage(); diff --git a/addons/shopro/service/Withdraw.php b/addons/shopro/service/Withdraw.php index e6ab07b..3c8b5d5 100755 --- a/addons/shopro/service/Withdraw.php +++ b/addons/shopro/service/Withdraw.php @@ -277,18 +277,17 @@ class Withdraw throw new ShoproException('请勿重复操作'); } - // 检查提现打款时间限制(小时) - $limitHours = isset($this->config['days_7']) ? intval($this->config['days_7']) : 0; - - // 如果配置中没有读取到,尝试重新读取一次(不使用缓存) - if (!isset($this->config['days_7'])) { - $freshConfig = sheep_config('shop.recharge_withdraw.withdraw', false); - if (is_array($freshConfig) && isset($freshConfig['days_7'])) { - $limitHours = intval($freshConfig['days_7']); - $this->config['days_7'] = $limitHours; - } + // 检查提现打款时间限制(小时)- 每次都重新读取配置确保最新 + $freshConfig = sheep_config('shop.recharge_withdraw.withdraw', false); + $limitHours = 0; + if (is_array($freshConfig) && isset($freshConfig['days_7'])) { + $limitHours = intval($freshConfig['days_7']); + $this->config['days_7'] = $limitHours; // 更新实例配置 + } elseif (isset($this->config['days_7'])) { + $limitHours = intval($this->config['days_7']); } + // 如果配置了时间限制,检查是否满足条件 if ($limitHours > 0) { $createtime = intval($withdraw->createtime); if ($createtime > 0) { diff --git a/application/admin/controller/shopro/Withdraw.php b/application/admin/controller/shopro/Withdraw.php index 4188c89..d760880 100644 --- a/application/admin/controller/shopro/Withdraw.php +++ b/application/admin/controller/shopro/Withdraw.php @@ -116,10 +116,11 @@ class Withdraw extends Common Db::commit(); } catch (ShoproException $e) { - // 不回滚,记录错误日志 - Db::commit(); + // 时间限制检查失败等业务异常,需要回滚事务 + Db::rollback(); $this->error($e->getMessage()); } catch (HttpResponseException $e) { + Db::rollback(); $data = $e->getResponse()->getData(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage(); $this->error($message);