|
|
@@ -152,7 +152,8 @@ class Withdraw extends Controller
|
|
|
DB::beginTransaction();
|
|
|
try {
|
|
|
$validate = [
|
|
|
- 'id' => ['required', 'string', 'min:1'],
|
|
|
+ 'ids' => ['required', 'array', 'min:1'],
|
|
|
+ 'ids.*' => ['required', 'integer', 'min:1'],
|
|
|
'status' => ['required', 'integer', 'in:1,2'],
|
|
|
];
|
|
|
$status = request()->input('status');
|
|
|
@@ -160,49 +161,12 @@ class Withdraw extends Controller
|
|
|
$validate['remark'] = ['required', 'string', 'min:1', 'max:200'];
|
|
|
}
|
|
|
request()->validate($validate);
|
|
|
- $id = request()->input('id');
|
|
|
-
|
|
|
-
|
|
|
- $w = WithdrawService::findOne(['id' => $id, 'status' => 0]);
|
|
|
-
|
|
|
- if (!$w) throw new Exception("数据不存在", HttpStatus::CUSTOM_ERROR);
|
|
|
- // 汇率
|
|
|
- $rate = $w->exchange_rate ?? 1;
|
|
|
- if ($status == 1) {
|
|
|
- $w->status = 1;
|
|
|
- $w->save();
|
|
|
-
|
|
|
-
|
|
|
- } else if ($status == 2) {
|
|
|
- $rate_rmb_amount = bcmul($w->amount, $rate, 2); // 提现金额 折合RMB
|
|
|
- $w->status = 2;
|
|
|
- $remark = request()->input('remark');
|
|
|
- $w->remark = $remark;
|
|
|
- $w->save();
|
|
|
- $wallet = WalletService::findOne(['member_id' => $w->member_id]);
|
|
|
- $afterBalance = bcadd($wallet->available_balance, $rate_rmb_amount, 10);
|
|
|
- BalanceLogService::addLog($w->member_id, $w->rate_rmb_amount, $wallet->available_balance, $afterBalance, '提现', $w->id, '');
|
|
|
- $wallet->available_balance = $afterBalance;
|
|
|
- $wallet->save();
|
|
|
+ $ids = request()->input('ids');
|
|
|
+ $remark = request()->input('remark');
|
|
|
+ foreach ($ids as $id) {
|
|
|
+ WithdrawService::setStatus($id, $status, $remark);
|
|
|
}
|
|
|
|
|
|
- $arr = ['⏳️申请中', '✅️成功', '❌️失败'];
|
|
|
- $text = "📢 提现结果通知\n\n";
|
|
|
-
|
|
|
- $temp = floatval($w->service_charge);
|
|
|
- $text .= "手续费:{$temp} USDT\n";
|
|
|
- $temp = floatval($w->amount);
|
|
|
- $text .= "提现金额:{$temp} USDT\n";
|
|
|
- $temp = floatval($w->to_account);
|
|
|
- $text .= "到账金额:{$temp} USDT\n";
|
|
|
- $text .= "提现地址:{$w->address}\n\n";
|
|
|
- $text .= "状态:{$arr[$w->status]}\n";
|
|
|
- if ($w->remark) $text .= "说明:{$w->remark}";
|
|
|
- $res = WithdrawService::notify([
|
|
|
- 'chat_id' => $w->member_id,
|
|
|
- 'text' => $text,
|
|
|
- ]);
|
|
|
-
|
|
|
|
|
|
DB::commit();
|
|
|
} catch (ValidationException $e) {
|