Merge pull request #401 from v2board/dev

1.5.0
This commit is contained in:
tokumeikoi 2021-02-17 17:20:51 +09:00 committed by GitHub
commit f8a851d464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 31 deletions

View File

@ -18,6 +18,9 @@ class OrderController extends Controller
{
public function alipayNotify(Request $request)
{
if (!(int)config('v2board.alipay_enable')) {
die('fail');
}
// Log::info('alipayNotifyData: ' . json_encode($_POST));
$gateway = Omnipay::create('Alipay_AopF2F');
$gateway->setSignType('RSA2'); //RSA/RSA2
@ -57,6 +60,9 @@ class OrderController extends Controller
{
// 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'));
try {
$event = \Stripe\Webhook::constructEvent(
@ -99,6 +105,9 @@ class OrderController extends Controller
public function bitpayXNotify(Request $request)
{
if (!(int)config('v2board.bitpayx_enable')) {
die('fail');
}
$inputString = file_get_contents('php://input', 'r');
// Log::info('bitpayXNotifyData: ' . $inputString);
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
@ -132,6 +141,9 @@ class OrderController extends Controller
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'));
if (!$mgate->verify($request->input())) {
abort(500, 'fail');
@ -144,6 +156,9 @@ class OrderController extends Controller
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'));
if (!$epay->verify($request->input())) {
abort(500, 'fail');

View File

@ -17,8 +17,13 @@ class UserController extends Controller
if (empty($request->input('id'))) {
abort(500, '参数错误');
}
$user = User::where('is_admin', 0)
->where('id', $request->input('id'))
->where('is_staff', 0)
->first();
if (!$user) abort(500, '用户不存在');
return response([
'data' => User::find($request->input('id'))
'data' => $user
]);
}

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Http\Requests\User\UserTransfer;
use App\Http\Requests\User\UserUpdate;
use App\Http\Requests\User\UserChangePassword;
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'));
if (!$user) {
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) {
abort(500, __('user.user.transfer.insufficient_commission_balance'));
}

View 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')
];
}
}

View File

@ -236,5 +236,5 @@ return [
| The only modification by laravel config
|
*/
'version' => '1.4.3.1612347430'
'version' => '1.5.0'
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,29 +9,6 @@ mode: rule
log-level: info
external-controller: 127.0.0.1:9090
dns:
enable: true
# listen: 0.0.0.0:53
ipv6: false
default-nameserver:
- 223.5.5.5
- 119.29.29.29
enhanced-mode: redir-host
fake-ip-range: 198.18.0.1/16
use-hosts: true
nameserver:
- https://doh.pub/dns-query
fallback:
- tls://1.0.0.1:853
- https://cloudflare-dns.com/dns-query
- https://dns.google/dns-query
fallback-filter:
geoip: true
ipcidr:
- 240.0.0.0/4
- 0.0.0.0/32
proxies:
proxy-groups: