update
This commit is contained in:
parent
2ab18b35c6
commit
59729277bb
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Host;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HostController extends Controller
|
||||
@ -12,13 +13,11 @@ class HostController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
public function index(Host $host)
|
||||
{
|
||||
//
|
||||
$hosts = $host->paginate(100);
|
||||
|
||||
// $price = 0.01;
|
||||
// // 一个月多少个 5 分钟
|
||||
// $month = 60 * 24 * 30 / 5;
|
||||
return view('admin.hosts.index', compact('hosts'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,8 +33,7 @@ public function create()
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
@ -46,11 +44,10 @@ public function store(Request $request)
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @param \App\Models\Host $host
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(Host $host)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -58,11 +55,10 @@ public function show($id)
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @param \App\Models\Host $host
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(Host $host)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -70,12 +66,11 @@ public function edit($id)
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Host $host
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, Host $host)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -83,11 +78,10 @@ public function update(Request $request, $id)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @param \App\Models\Host $host
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(Host $host)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Module;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ModuleController extends Controller
|
||||
@ -12,9 +13,11 @@ class ModuleController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
public function index(Module $module)
|
||||
{
|
||||
//
|
||||
$modules = $module->paginate(100);
|
||||
|
||||
return view('admin.modules.index', compact('modules'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,10 +44,10 @@ public function store(Request $request)
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\Module $module
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(Module $module)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -52,10 +55,10 @@ public function show($id)
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\Module $module
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(Module $module)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -64,10 +67,10 @@ public function edit($id)
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \App\Models\Module $module
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, Module $module)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -75,10 +78,10 @@ public function update(Request $request, $id)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\Module $module
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(Module $module)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\WorkOrder\Reply;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ReplyController extends Controller
|
||||
@ -41,10 +42,10 @@ public function store(Request $request)
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\Reply $reply
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(Reply $reply)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -52,10 +53,10 @@ public function show($id)
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\Reply $reply
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(Reply $reply)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -64,10 +65,10 @@ public function edit($id)
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\Reply $reply
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, Reply $reply)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -75,10 +76,10 @@ public function update(Request $request, $id)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\Reply $reply
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(Reply $reply)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\WorkOrder\WorkOrder;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class WorkOrderController extends Controller
|
||||
@ -41,10 +42,10 @@ public function store(Request $request)
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\WorkOrder $workOrder
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(WorkOrder $workOrder)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -52,10 +53,10 @@ public function show($id)
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\WorkOrder $workOrder
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(WorkOrder $workOrder)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -64,10 +65,10 @@ public function edit($id)
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\WorkOrder $workOrder
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, WorkOrder $workOrder)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -75,10 +76,10 @@ public function update(Request $request, $id)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \App\Models\WorkOrder\WorkOrder $workOrder
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(WorkOrder $workOrder)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
34
app/View/Components/BasicCard.php
Normal file
34
app/View/Components/BasicCard.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class BasicCard extends Component
|
||||
{
|
||||
|
||||
public $title;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($title)
|
||||
{
|
||||
//
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.basic-card', [
|
||||
'title' => $this->title,
|
||||
]);
|
||||
}
|
||||
}
|
100
resources/views/admin/commands.blade.php
Normal file
100
resources/views/admin/commands.blade.php
Normal file
@ -0,0 +1,100 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', '命令速查表')
|
||||
|
||||
@section('content')
|
||||
<h3>命令速查表</h3>
|
||||
|
||||
<h5>系统维护</h5>
|
||||
<x-basic-card title="启动 莱云">
|
||||
启动全部
|
||||
<code>supervistorctl start all</code>
|
||||
<br/>
|
||||
启动 Web 节点
|
||||
<code>supervistorctl start lae-web</code>
|
||||
或者
|
||||
<code>art octane:start</code>
|
||||
<br/>
|
||||
启动 队列
|
||||
<code>supervistorctl start lae-queue</code>
|
||||
<br/>
|
||||
启动 计划任务
|
||||
<code>supervistorctl start lae-schedule</code>
|
||||
</x-basic-card>
|
||||
|
||||
<x-basic-card title="停止 莱云">
|
||||
停止全部
|
||||
<code>supervistorctl stop all</code>
|
||||
<br/>
|
||||
停止 Web 节点
|
||||
<code>supervistorctl stop lae-web</code>
|
||||
或者
|
||||
<code>art octane:stop</code>
|
||||
<br/>
|
||||
停止 队列
|
||||
<code>supervistorctl stop lae-queue</code>
|
||||
<br/>
|
||||
停止 计划任务
|
||||
<code>supervistorctl stop lae-schedule</code>
|
||||
</x-basic-card>
|
||||
|
||||
<x-basic-card title="重启 莱云">
|
||||
重启全部
|
||||
<code>supervistorctl restart all</code>
|
||||
<br/>
|
||||
重启 Web 节点
|
||||
<code>supervistorctl restart lae-web</code>
|
||||
或者
|
||||
<code>art octane:restart</code>
|
||||
*重载<code>art octane:reload</code>
|
||||
<br/>
|
||||
重启 队列
|
||||
<code>supervistorctl restart lae-queue</code>
|
||||
<br/>
|
||||
重启 计划任务
|
||||
<code>supervistorctl restart lae-schedule</code>
|
||||
</x-basic-card>
|
||||
|
||||
<x-basic-card title="基本维护">
|
||||
启动维护模式
|
||||
<code>art down</code>
|
||||
<br/>
|
||||
关闭维护模式
|
||||
<code>art up</code>
|
||||
|
||||
</x-basic-card>
|
||||
|
||||
|
||||
<x-basic-card title="升级">
|
||||
<p class="text-danger">*如果是大更新,需要启动维护模式。</p>
|
||||
首先,拉取最新代码
|
||||
<code>sudo -u www git pull</code>
|
||||
<br/>
|
||||
然后,安装依赖
|
||||
<code>composer install --no-dev</code>
|
||||
<br />
|
||||
接着,升级数据库(只需要在一台节点上执行)
|
||||
<code>art migrate</code>
|
||||
<br />
|
||||
最后,清除缓存
|
||||
<code>art optimize</code>
|
||||
<br />
|
||||
|
||||
如果是非 Web 节点,需要重启全部或者对应服务,比如 队列,计划任务
|
||||
<code>supervisorctl restart all</code>
|
||||
|
||||
<br />
|
||||
如果是 Web 节点,需要简单重启即可
|
||||
<code>supervisorctl restart lae-web</code>
|
||||
|
||||
</x-basic-card>
|
||||
|
||||
|
||||
|
||||
|
||||
<h5 class="mt-3">用户相关</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
@endsection
|
55
resources/views/admin/hosts/index.blade.php
Normal file
55
resources/views/admin/hosts/index.blade.php
Normal file
@ -0,0 +1,55 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', '主机')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="overflow-auto">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>模块</th>
|
||||
<th>名称</th>
|
||||
<th>创建时间</th>
|
||||
<th>更新时间</th>
|
||||
<th>操作</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($hosts as $host)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('admin.hosts.show', $host) }}">
|
||||
{{ $host->id }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="module_name" module="{{ $host->module_id }}">{{ $host->module_id }}</span>
|
||||
</td>
|
||||
<td>
|
||||
{{ $host->name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $host->created_at }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $host->updated_at }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.hosts.edit', $host) }}" class="btn btn-primary btn-sm">编辑</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{-- 分页 --}}
|
||||
{{ $hosts->links() }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@endsection
|
42
resources/views/admin/modules/index.blade.php
Normal file
42
resources/views/admin/modules/index.blade.php
Normal file
@ -0,0 +1,42 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', '模块')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="overflow-auto">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>名称</th>
|
||||
<th>操作</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($modules as $module)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('admin.modules.show', $module) }}">
|
||||
{{ $module->id }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $module->name }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.modules.edit', $module) }}" class="btn btn-primary btn-sm">编辑</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{-- 分页 --}}
|
||||
{{ $modules->links() }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@endsection
|
@ -6,6 +6,10 @@
|
||||
<h3>{{ $user->name }}</h3>
|
||||
<a href="{{ route('admin.users.show', $user) }}">切换到 {{ $user->name }}</a>
|
||||
|
||||
@if ($user->banned_at)
|
||||
<p class="text-danger">已被封禁,原因: {{ $user->banned_reason }}</p>
|
||||
@endif
|
||||
|
||||
|
||||
<p>余额: {{ $user->balance }} 元, {{ $drops }} Drops</p>
|
||||
|
||||
@ -21,6 +25,7 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>模块</th>
|
||||
<th>名称</th>
|
||||
<th>价格 / 5 分钟</th>
|
||||
<th>操作</th>
|
||||
@ -31,7 +36,12 @@
|
||||
|
||||
@foreach($hosts as $host)
|
||||
<tr>
|
||||
<td>{{ $host->id }}</td>
|
||||
<td>
|
||||
{{ $host->id }}
|
||||
</td>
|
||||
<td>
|
||||
<span class="module_name" module="{{ $host->module_id }}">{{ $host->module_id }}</span>
|
||||
</td>
|
||||
<td>{{ $host->name }}</td>
|
||||
<td>
|
||||
<span>{{ $host->price }} Drops</span>
|
||||
@ -53,6 +63,7 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>模块</th>
|
||||
<th>标题</th>
|
||||
<th>状态</th>
|
||||
<th>操作</th>
|
||||
@ -61,6 +72,8 @@
|
||||
@foreach($workOrders as $workOrder)
|
||||
<tr>
|
||||
<td>{{ $workOrder->id }}</td>
|
||||
<td><span class="module_name" module="{{ $workOrder->module_id }}">{{ $workOrder->module_id }}</span>
|
||||
</td>
|
||||
<td>{{ $workOrder->title }}</td>
|
||||
<td>
|
||||
<x-work-order-status :status="$workOrder->status"/>
|
||||
@ -161,6 +174,4 @@
|
||||
<button type="submit" class="btn btn-primary mt-3">提交</button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
|
@ -74,9 +74,4 @@
|
||||
</div>
|
||||
|
||||
{{ $transactions->links() }}
|
||||
|
||||
|
||||
<x-module-script />
|
||||
|
||||
|
||||
@endsection
|
||||
|
10
resources/views/components/basic-card.blade.php
Normal file
10
resources/views/components/basic-card.blade.php
Normal file
@ -0,0 +1,10 @@
|
||||
<div class="mt-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">{{ $title }}</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -46,6 +46,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('admin.work-orders.index') }}">工单</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('admin.commands') }}">命令速查表</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Right Side Of Navbar -->
|
||||
@ -60,7 +63,8 @@
|
||||
@else
|
||||
@if (Auth::guard('web')->check())
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('index') }}">切换到 {{ Auth::guard('web')->user()->name }}</a>
|
||||
<a class="nav-link"
|
||||
href="{{ route('index') }}">切换到 {{ Auth::guard('web')->user()->name }}</a>
|
||||
</li>
|
||||
@endif
|
||||
<li class="nav-item dropdown">
|
||||
@ -97,6 +101,9 @@ class="d-none">
|
||||
@yield('content')
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<x-module-script/>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
||||
</li>
|
||||
@endif
|
||||
|
||||
<!-- Authentication Links -->
|
||||
<!-- Authentication Links -->
|
||||
@guest
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
|
||||
@ -99,6 +99,9 @@ class="d-none">
|
||||
@yield('content')
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<x-module-script/>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
@ -26,4 +26,6 @@
|
||||
Route::resource('hosts', HostController::class);
|
||||
Route::resource('work-orders', WorkOrderController::class);
|
||||
Route::resource('work-orders.replies', ReplyController::class);
|
||||
|
||||
Route::view('commands', 'admin.commands')->name('commands');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user