v2board/app/Http/Controllers/User/CommController.php

36 lines
1.0 KiB
PHP
Raw Normal View History

2020-05-19 16:49:33 +08:00
<?php
namespace App\Http\Controllers\User;
2021-04-28 16:56:08 +08:00
use App\Models\Payment;
2021-01-08 00:33:11 +08:00
use App\Utils\Dict;
2020-05-19 16:49:33 +08:00
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class CommController extends Controller
{
public function config()
{
return response([
'data' => [
2021-02-03 18:27:21 +08:00
'is_telegram' => (int)config('v2board.telegram_bot_enable', 0),
'stripe_pk' => config('v2board.stripe_pk_live'),
2021-02-03 18:17:32 +08:00
'withdraw_methods' => config('v2board.commission_withdraw_method', Dict::WITHDRAW_METHOD_WHITELIST_DEFAULT),
'withdraw_close' => (int)config('v2board.withdraw_close_enable', 0)
2020-05-19 16:49:33 +08:00
]
]);
}
2021-04-28 16:56:08 +08:00
public function getStripePublicKey(Request $request)
{
$payment = Payment::where('id', $request->input('id'))
->where('payment', 'StripeCredit')
->first();
if (!$payment) abort(500, 'payment is not found');
$config = json_decode($payment->config, true);
return response([
'data' => $config['stripe_pk_live']
]);
}
2020-05-19 16:49:33 +08:00
}