|
|
@@ -11,6 +11,7 @@ use App\Services\WithdrawService;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Validation\ValidationException;
|
|
|
use Exception;
|
|
|
+use App\Models\Config;
|
|
|
|
|
|
class Withdraw extends Controller
|
|
|
{
|
|
|
@@ -91,7 +92,8 @@ class Withdraw extends Controller
|
|
|
]);
|
|
|
$id = request()->input('id');
|
|
|
$status = request()->input('status');
|
|
|
-
|
|
|
+ // 汇率
|
|
|
+ $rate = Config::where('field', 'exchange_rate_rmb')->first()->val??1;
|
|
|
|
|
|
$w = WithdrawService::findOne(['id' => $id, 'status' => 0]);
|
|
|
if (!$w) throw new Exception("数据不存在", HttpStatus::CUSTOM_ERROR);
|
|
|
@@ -101,13 +103,14 @@ class Withdraw extends Controller
|
|
|
|
|
|
|
|
|
} else if ($status == 2) {
|
|
|
+ $rate_rmb_amount = bcmul($w->amount, $rate, 2); // 提现金额 折合RMB
|
|
|
$w->status = 2;
|
|
|
$w->save();
|
|
|
$wallet = WalletService::findOne(['member_id' => $w->member_id]);
|
|
|
- $afterBalance = bcadd($wallet->available_balance, $w->amount, 10);
|
|
|
+ $afterBalance = bcadd($wallet->available_balance, $rate_rmb_amount, 10);
|
|
|
BalanceLogService::addLog(
|
|
|
$w->member_id,
|
|
|
- $w->amount,
|
|
|
+ $w->rate_rmb_amount,
|
|
|
$wallet->available_balance,
|
|
|
$afterBalance,
|
|
|
'提现',
|