diff --git a/addons/shopro/service/Withdraw.php b/addons/shopro/service/Withdraw.php index 1972886..c37e9b0 100755 --- a/addons/shopro/service/Withdraw.php +++ b/addons/shopro/service/Withdraw.php @@ -76,6 +76,7 @@ class Withdraw $withdraw->withdraw_info = $withdrawInfo; $withdraw->status = 0; $withdraw->platform = request()->header('platform'); + $withdraw->createtime = time(); // 显式设置创建时间 $withdraw->save(); // 佣金钱包变动 @@ -214,7 +215,10 @@ class Withdraw // 如果配置了时间限制,先检查是否满足条件 if ($limitHours > 0) { - $createtime = intval($withdraw->createtime); + // 直接从数据库获取创建时间,避免模型获取器转换 + $createtime = WithdrawModel::where('id', $withdraw->id)->value('createtime'); + $createtime = $createtime ? intval($createtime) : 0; + if ($createtime > 0) { $hoursDiff = (time() - $createtime) / 3600; // 3600秒 = 1小时 if ($hoursDiff < $limitHours) { @@ -318,12 +322,15 @@ class Withdraw // 如果配置了时间限制,检查是否满足条件 if ($limitHours > 0) { - $createtime = intval($withdraw->createtime); + // 直接从数据库获取创建时间,避免模型获取器转换 + $createtime = WithdrawModel::where('id', $withdraw->id)->value('createtime'); + $createtime = $createtime ? intval($createtime) : 0; + if ($createtime > 0) { $hoursDiff = (time() - $createtime) / 3600; // 3600秒 = 1小时 // 调试日志:记录时间差 - \think\Log::write('提现时间限制检查 - 申请时间: ' . date('Y-m-d H:i:s', $createtime) . ', 当前时间: ' . date('Y-m-d H:i:s', time()) . ', 时间差(小时): ' . $hoursDiff, 'info'); + \think\Log::write('提现时间限制检查 - 提现ID: ' . $withdraw->id . ', 申请时间: ' . date('Y-m-d H:i:s', $createtime) . ' (时间戳: ' . $createtime . '), 当前时间: ' . date('Y-m-d H:i:s', time()) . ' (时间戳: ' . time() . '), 时间差(小时): ' . $hoursDiff, 'info'); if ($hoursDiff < $limitHours) { $remainingHours = ceil($limitHours - $hoursDiff); diff --git a/application/admin/controller/shopro/Withdraw.php b/application/admin/controller/shopro/Withdraw.php index 0d9a95e..d71f2b0 100644 --- a/application/admin/controller/shopro/Withdraw.php +++ b/application/admin/controller/shopro/Withdraw.php @@ -100,13 +100,15 @@ class Withdraw extends Common switch ($action) { case 'agree': + $withdrawLib->checkWithdrawTimeLimit($withdraw); $withdraw = $withdrawLib->handleAgree($withdraw); break; case 'withdraw': + $withdrawLib->checkWithdrawTimeLimit($withdraw); $withdraw = $withdrawLib->handleWithdraw($withdraw); break; case 'agree&withdraw': - // 先检查时间限制,再执行同意和打款操作 + // 先检查时间限制,再执行同意和打款操作 $withdrawLib->checkWithdrawTimeLimit($withdraw); $withdraw = $withdrawLib->handleAgree($withdraw); $withdraw = $withdrawLib->handleWithdraw($withdraw);