mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update: performance optimization
This commit is contained in:
parent
2f153acd51
commit
f874da19f0
@ -14,7 +14,7 @@ DB_USERNAME=root
|
|||||||
DB_PASSWORD=123456
|
DB_PASSWORD=123456
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=redis
|
CACHE_DRIVER=file
|
||||||
QUEUE_CONNECTION=redis
|
QUEUE_CONNECTION=redis
|
||||||
SESSION_DRIVER=redis
|
SESSION_DRIVER=redis
|
||||||
SESSION_LIFETIME=120
|
SESSION_LIFETIME=120
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Admin\Server;
|
namespace App\Http\Controllers\Admin\Server;
|
||||||
|
|
||||||
use App\Models\ServerHysteria;
|
|
||||||
use App\Models\ServerVmess;
|
|
||||||
use App\Models\ServerShadowsocks;
|
|
||||||
use App\Models\ServerTrojan;
|
|
||||||
use App\Services\ServerService;
|
use App\Services\ServerService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
@ -24,33 +20,20 @@ class ManageController extends Controller
|
|||||||
public function sort(Request $request)
|
public function sort(Request $request)
|
||||||
{
|
{
|
||||||
ini_set('post_max_size', '1m');
|
ini_set('post_max_size', '1m');
|
||||||
|
$params = $request->only(
|
||||||
|
'shadowsocks',
|
||||||
|
'vmess',
|
||||||
|
'trojan',
|
||||||
|
'hysteria'
|
||||||
|
) ?? [];
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
foreach ($request->input('sorts') ?? [] as $k => $v) {
|
foreach ($params as $k => $v) {
|
||||||
switch ($v['key']) {
|
$model = 'App\\Models\\Server' . ucfirst($k);
|
||||||
case 'shadowsocks':
|
foreach($v as $id => $sort) {
|
||||||
if (!ServerShadowsocks::find($v['value'])->update(['sort' => $v['sort']])) {
|
if (!$model::find($id)->update(['sort' => $sort])) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
abort(500, '保存失败');
|
abort(500, '保存失败');
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case 'vmess':
|
|
||||||
if (!ServerVmess::find($v['value'])->update(['sort' => $v['sort']])) {
|
|
||||||
DB::rollBack();
|
|
||||||
abort(500, '保存失败');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'trojan':
|
|
||||||
if (!ServerTrojan::find($v['value'])->update(['sort' => $v['sort']])) {
|
|
||||||
DB::rollBack();
|
|
||||||
abort(500, '保存失败');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'hysteria':
|
|
||||||
if (!ServerHysteria::find($v['value'])->update(['sort' => $v['sort']])) {
|
|
||||||
DB::rollBack();
|
|
||||||
abort(500, '保存失败');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
@ -184,7 +184,8 @@ return [
|
|||||||
'minProcesses' => 1,
|
'minProcesses' => 1,
|
||||||
'maxProcesses' => (int)ceil($parser->getRam()['total'] / 1024 / 1024 / 1024 * 6),
|
'maxProcesses' => (int)ceil($parser->getRam()['total'] / 1024 / 1024 / 1024 * 6),
|
||||||
'tries' => 1,
|
'tries' => 1,
|
||||||
'nice' => 0,
|
'balanceCooldown' => 3,
|
||||||
|
'balanceMaxShift' => 1000,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user