6
0
Fork 0

调整经销商提现配置

release
vine_liutk 2022-01-25 16:50:14 +08:00
parent e33d212fbf
commit 448efd7106
4 changed files with 14 additions and 2 deletions

View File

@ -41,6 +41,7 @@ class Dealer extends Form
$this->currency('fee_rate', '手续费比例(百分比)')->symbol('%');
$this->number('withdraw_threshold_amount', '起提金额(元)');
$this->currency('withdraw_fee_rate', '提现费率')->symbol('%');
$this->number('withdraw_days', '提现间隔');
$this->currency('upgrade_amount_'.DealerLvl::Contracted->value, '签约门槛')->symbol('¥');
$this->currency('upgrade_amount_'.DealerLvl::Special->value, '特邀门槛')->symbol('¥');
@ -133,6 +134,7 @@ class Dealer extends Form
'fee_rate'=> $dealerSettings['fee_rate'] ?? '',
'withdraw_threshold_amount'=> $dealerSettings['withdraw_threshold_amount'] ?? 0,
'withdraw_fee_rate'=> $dealerSettings['withdraw_fee_rate'] ?? 0,
'withdraw_days'=> $dealerSettings['withdraw_days'] ?? 7,
'order_auto_allocate_times'=> $dealerSettings['order_auto_allocate_times'] ?? 1,
'upgrade_amount_'.DealerLvl::Contracted->value => $dealerSettings['upgrade_amount_'.DealerLvl::Contracted->value] ?? '',
'upgrade_amount_'.DealerLvl::Special->value => $dealerSettings['upgrade_amount_'.DealerLvl::Special->value] ?? '',

View File

@ -54,6 +54,11 @@ class WalletController extends Controller
throw new BizException('可提账户已被限制提现');
}
//检测是否可以提现
if (!$user->dealer->canWithdraw()) {
throw new BizException('每次提现需要间隔'.app_settings('dealer.withdraw_days', 7).'天');
}
// 校验提现门槛
if (bcdiv($amount, 100, 2) < app_settings('dealer.withdraw_threshold_amount', 0)) {
throw new BizException('提现金额需大于'.app_settings('dealer.withdraw_threshold_amount', 0).'元');

View File

@ -2,7 +2,6 @@
namespace App\Endpoint\Api\Http\Resources\Dealer;
use App\Models\DealerWalletToBankLog;
use Illuminate\Http\Resources\Json\JsonResource;
class DealerResource extends JsonResource
@ -22,7 +21,7 @@ class DealerResource extends JsonResource
'guanli_values'=> $this->calculate_total_amount, //预计管理津贴
'team_sales_value' => $this->team_sales_value,
'pay_info'=>$this->pay_info ?: null,
'can_withdraw'=> DealerWalletToBankLog::where('user_id', $this->user_id)->where('created_at', '>', now()->subDays(7))->doesntExist(),
'can_withdraw'=> $this->canWithdraw(),
];
}
}

View File

@ -391,4 +391,10 @@ class Dealer extends Model
$this->userInfo->save();
}
}
public function canWithdraw()
{
$days = app_settings('dealer.withdraw_days', 7);
return DealerWalletToBankLog::where('user_id', $this->user_id)->where('created_at', '>', now()->subDays($days))->doesntExist();
}
}