diff --git a/addons/shopro/service/Withdraw.php b/addons/shopro/service/Withdraw.php index a7a7afd..a71b796 100755 --- a/addons/shopro/service/Withdraw.php +++ b/addons/shopro/service/Withdraw.php @@ -235,15 +235,27 @@ class Withdraw throw new ShoproException('请勿重复操作'); } - // 检查7天限制 - $days7Enabled = isset($this->config['days_7']) && (intval($this->config['days_7']) == 1 || $this->config['days_7'] === '1' || $this->config['days_7'] === true); - if ($days7Enabled) { + // 检查提现打款时间限制(小时) + $limitHours = isset($this->config['days_7']) ? intval($this->config['days_7']) : 0; + if ($limitHours > 0) { $createtime = intval($withdraw->createtime); if ($createtime > 0) { - $daysDiff = (time() - $createtime) / 86400; // 86400秒 = 1天 - if ($daysDiff < 7) { - $remainingDays = ceil(7 - $daysDiff); - throw new ShoproException('提现申请时间未超过7天,还需等待' . $remainingDays . '天才能放款'); + $hoursDiff = (time() - $createtime) / 3600; // 3600秒 = 1小时 + if ($hoursDiff < $limitHours) { + $remainingHours = ceil($limitHours - $hoursDiff); + $remainingDays = floor($remainingHours / 24); + $remainingHoursInDay = $remainingHours % 24; + $timeText = ''; + if ($remainingDays > 0) { + $timeText = $remainingDays . '天'; + } + if ($remainingHoursInDay > 0) { + $timeText .= ($timeText ? '零' : '') . $remainingHoursInDay . '小时'; + } + if (empty($timeText)) { + $timeText = '1小时'; + } + throw new ShoproException('提现申请时间未超过' . $limitHours . '小时,还需等待' . $timeText . '才能放款'); } } } diff --git a/application/admin/view/shopro/config/index.html b/application/admin/view/shopro/config/index.html index 184f698..1153be4 100644 --- a/application/admin/view/shopro/config/index.html +++ b/application/admin/view/shopro/config/index.html @@ -631,19 +631,13 @@ 次 - - - - - - {{form.model.withdraw.days_7 == 1?'开启':'关闭'}} - - - - 开启后,如果提现申请时间没有超过7天是不能放款的 - + + + 小时 + + + 设置提现申请后需要等待多少小时才能打款,设置为0则不限制