mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
fix: something
This commit is contained in:
parent
7c40a146a9
commit
cdddbae19a
@ -18,6 +18,9 @@ class OrderController extends Controller
|
|||||||
{
|
{
|
||||||
public function alipayNotify(Request $request)
|
public function alipayNotify(Request $request)
|
||||||
{
|
{
|
||||||
|
if (!(int)config('v2board.alipay_enable')) {
|
||||||
|
die('fail');
|
||||||
|
}
|
||||||
// Log::info('alipayNotifyData: ' . json_encode($_POST));
|
// Log::info('alipayNotifyData: ' . json_encode($_POST));
|
||||||
$gateway = Omnipay::create('Alipay_AopF2F');
|
$gateway = Omnipay::create('Alipay_AopF2F');
|
||||||
$gateway->setSignType('RSA2'); //RSA/RSA2
|
$gateway->setSignType('RSA2'); //RSA/RSA2
|
||||||
@ -57,6 +60,9 @@ class OrderController extends Controller
|
|||||||
{
|
{
|
||||||
// Log::info('stripeNotifyData: ' . json_encode($request->input()));
|
// Log::info('stripeNotifyData: ' . json_encode($request->input()));
|
||||||
|
|
||||||
|
if (!(int)config('v2board.stripe_alipay_enable') && !(int)config('v2board.stripe_wepay_enable')) {
|
||||||
|
die('fail');
|
||||||
|
}
|
||||||
\Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
\Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||||
try {
|
try {
|
||||||
$event = \Stripe\Webhook::constructEvent(
|
$event = \Stripe\Webhook::constructEvent(
|
||||||
@ -99,6 +105,9 @@ class OrderController extends Controller
|
|||||||
|
|
||||||
public function bitpayXNotify(Request $request)
|
public function bitpayXNotify(Request $request)
|
||||||
{
|
{
|
||||||
|
if (!(int)config('v2board.bitpayx_enable')) {
|
||||||
|
die('fail');
|
||||||
|
}
|
||||||
$inputString = file_get_contents('php://input', 'r');
|
$inputString = file_get_contents('php://input', 'r');
|
||||||
// Log::info('bitpayXNotifyData: ' . $inputString);
|
// Log::info('bitpayXNotifyData: ' . $inputString);
|
||||||
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
|
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
|
||||||
@ -132,6 +141,9 @@ class OrderController extends Controller
|
|||||||
|
|
||||||
public function mgateNotify(Request $request)
|
public function mgateNotify(Request $request)
|
||||||
{
|
{
|
||||||
|
if (!(int)config('v2board.mgate_enable')) {
|
||||||
|
die('fail');
|
||||||
|
}
|
||||||
$mgate = new MGate(config('v2board.mgate_url'), config('v2board.mgate_app_id'), config('v2board.mgate_app_secret'));
|
$mgate = new MGate(config('v2board.mgate_url'), config('v2board.mgate_app_id'), config('v2board.mgate_app_secret'));
|
||||||
if (!$mgate->verify($request->input())) {
|
if (!$mgate->verify($request->input())) {
|
||||||
abort(500, 'fail');
|
abort(500, 'fail');
|
||||||
@ -144,6 +156,9 @@ class OrderController extends Controller
|
|||||||
|
|
||||||
public function epayNotify(Request $request)
|
public function epayNotify(Request $request)
|
||||||
{
|
{
|
||||||
|
if (!(int)config('v2board.epay_enable')) {
|
||||||
|
die('fail');
|
||||||
|
}
|
||||||
$epay = new Epay(config('v2board.epay_url'), config('v2board.epay_pid'), config('v2board.epay_key'));
|
$epay = new Epay(config('v2board.epay_url'), config('v2board.epay_pid'), config('v2board.epay_key'));
|
||||||
if (!$epay->verify($request->input())) {
|
if (!$epay->verify($request->input())) {
|
||||||
abort(500, 'fail');
|
abort(500, 'fail');
|
||||||
|
@ -17,8 +17,13 @@ class UserController extends Controller
|
|||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
|
$user = User::where('is_admin', 0)
|
||||||
|
->where('id', $request->input('id'))
|
||||||
|
->where('is_staff', 0)
|
||||||
|
->first();
|
||||||
|
if (!$user) abort(500, '用户不存在');
|
||||||
return response([
|
return response([
|
||||||
'data' => User::find($request->input('id'))
|
'data' => $user
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\User;
|
namespace App\Http\Controllers\User;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\User\UserTransfer;
|
||||||
use App\Http\Requests\User\UserUpdate;
|
use App\Http\Requests\User\UserUpdate;
|
||||||
use App\Http\Requests\User\UserChangePassword;
|
use App\Http\Requests\User\UserChangePassword;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -162,15 +163,12 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transfer(Request $request)
|
public function transfer(UserTransfer $request)
|
||||||
{
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
abort(500, __('user.user.transfer.user_not_exist'));
|
abort(500, __('user.user.transfer.user_not_exist'));
|
||||||
}
|
}
|
||||||
if ($request->input('transfer_amount') <= 0) {
|
|
||||||
abort(500, __('user.user.transfer.params_wrong'));
|
|
||||||
}
|
|
||||||
if ($request->input('transfer_amount') > $user->commission_balance) {
|
if ($request->input('transfer_amount') > $user->commission_balance) {
|
||||||
abort(500, __('user.user.transfer.insufficient_commission_balance'));
|
abort(500, __('user.user.transfer.insufficient_commission_balance'));
|
||||||
}
|
}
|
||||||
|
29
app/Http/Requests/User/UserTransfer.php
Normal file
29
app/Http/Requests/User/UserTransfer.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\User;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class UserTransfer extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'transfer_amount' => 'required|integer|min:1'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'transfer_amount.required' => '划转金额不能为空',
|
||||||
|
'transfer_amount.integer' => __('user.user.transfer.params_wrong'),
|
||||||
|
'transfer_amount.min' => __('user.user.transfer.params_wrong')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user