mirror of
https://gitee.com/liuxioabin/fengketrade.git
synced 2026-04-17 21:03:17 +08:00
代码优化
This commit is contained in:
parent
b7ded5d703
commit
dea4d38267
@ -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 . '才能放款');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -631,19 +631,13 @@
|
||||
<template #append>次</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="限制7天后才能提现打款">
|
||||
<div>
|
||||
<div class="sa-flex">
|
||||
<el-switch v-model="form.model.withdraw.days_7" class="sa-m-r-8"
|
||||
:active-value="1" :inactive-value="0"></el-switch>
|
||||
<div class="label-tip"
|
||||
:class="form.model.withdraw.days_7 == 1?'sa-color--primary':''">
|
||||
{{form.model.withdraw.days_7 == 1?'开启':'关闭'}}
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item label="提现打款时间限制" prop="withdraw.days_7">
|
||||
<el-input class="sa-w-360" v-model="form.model.withdraw.days_7"
|
||||
placeholder="请输入限制小时数" type="number" :min="0">
|
||||
<template #append>小时</template>
|
||||
</el-input>
|
||||
<div class="tip">
|
||||
开启后,如果提现申请时间没有超过7天是不能放款的
|
||||
</div>
|
||||
设置提现申请后需要等待多少小时才能打款,设置为0则不限制
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user