Compare commits
No commits in common. "ba69244e2de18bf7eb7c1e35b15451fe154de371" and "bbbf09f8abf877b28e90e94088382c3bcfdc0c27" have entirely different histories.
ba69244e2d
...
bbbf09f8ab
|
|
@ -23,65 +23,24 @@ class HomeController extends AdminController
|
||||||
{
|
{
|
||||||
$page = $this->basePage()->css($this->css())->body([
|
$page = $this->basePage()->css($this->css())->body([
|
||||||
Grid::make()->columns([
|
Grid::make()->columns([
|
||||||
$this->frameworkInfo()->md(8),
|
// $this->frameworkInfo()->md(5),
|
||||||
Flex::make()->items([
|
Flex::make()->items([
|
||||||
|
$this->pieChart(),
|
||||||
|
$this->cube(),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
Grid::make()->columns([
|
||||||
|
$this->lineChart()->md(8),
|
||||||
|
Flex::make()->className('h-full')->items([
|
||||||
$this->clock(),
|
$this->clock(),
|
||||||
$this->hitokoto(),
|
// $this->giteeWidget(),
|
||||||
])->direction('column'),
|
])->direction('column'),
|
||||||
]),
|
]),
|
||||||
// Grid::make()->columns([
|
|
||||||
// $this->lineChart()->md(8),
|
|
||||||
// Flex::make()->className('h-full')->items([
|
|
||||||
// $this->clock(),
|
|
||||||
// // $this->giteeWidget(),
|
|
||||||
// ])->direction('column'),
|
|
||||||
// ]),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->response()->success($page);
|
return $this->response()->success($page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 一言
|
|
||||||
*/
|
|
||||||
public function hitokoto()
|
|
||||||
{
|
|
||||||
return Card::make()
|
|
||||||
->className('h-full clear-card-mb')
|
|
||||||
->body(
|
|
||||||
Custom::make()->html(<<<HTML
|
|
||||||
<div class="h-full flex flex-col mt-5 py-8 px-7">
|
|
||||||
<div>『</div>
|
|
||||||
<div class="flex flex-1 items-center w-full justify-center" id="hitokoto">
|
|
||||||
<a class="text-dark" href="#" id="hitokoto_text" target="_blank"></a>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-end">』</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-end mt-3">
|
|
||||||
——
|
|
||||||
<span id="hitokoto_from_who"></span>
|
|
||||||
<span>「</span>
|
|
||||||
<span id="hitokoto_from"></span>
|
|
||||||
<span>」</span>
|
|
||||||
</div>
|
|
||||||
HTML
|
|
||||||
|
|
||||||
)->onMount(<<<JS
|
|
||||||
fetch('https://v1.hitokoto.cn?c=i')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
const hitokoto = document.querySelector('#hitokoto_text')
|
|
||||||
hitokoto.href = `https://hitokoto.cn/?uuid=\${data.uuid}`
|
|
||||||
hitokoto.innerText = data.hitokoto
|
|
||||||
document.querySelector('#hitokoto_from_who').innerText = data.from_who
|
|
||||||
document.querySelector('#hitokoto_from').innerText = data.from
|
|
||||||
})
|
|
||||||
.catch(console.error)
|
|
||||||
JS
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gitee widget
|
* gitee widget
|
||||||
*/
|
*/
|
||||||
|
|
@ -164,25 +123,25 @@ JS
|
||||||
Image::make()->src(url(config('admin.logo'))),
|
Image::make()->src(url(config('admin.logo'))),
|
||||||
Wrapper::make()->className('text-3xl mt-9')->body(config('admin.name')),
|
Wrapper::make()->className('text-3xl mt-9')->body(config('admin.name')),
|
||||||
Flex::make()->className('w-64 mt-5')->justify('space-around')->items([
|
Flex::make()->className('w-64 mt-5')->justify('space-around')->items([
|
||||||
// Action::make()
|
Action::make()
|
||||||
// ->level('link')
|
->level('link')
|
||||||
// ->label('Gitee')
|
->label('Gitee')
|
||||||
// ->blank(true)
|
->blank(true)
|
||||||
// ->actionType('url')
|
->actionType('url')
|
||||||
// ->blank(true)
|
->blank(true)
|
||||||
// ->link('https://gitee.com/slowlyo/owl-admin'),
|
->link('https://gitee.com/slowlyo/owl-admin'),
|
||||||
// Action::make()
|
Action::make()
|
||||||
// ->level('link')
|
->level('link')
|
||||||
// ->label('OwlAdmin 文档')
|
->label('OwlAdmin 文档')
|
||||||
// ->blank(true)
|
->blank(true)
|
||||||
// ->actionType('url')
|
->actionType('url')
|
||||||
// ->link('https://slowlyo.gitee.io/owl-admin-doc/'),
|
->link('https://slowlyo.gitee.io/owl-admin-doc/'),
|
||||||
// Action::make()
|
Action::make()
|
||||||
// ->level('link')
|
->level('link')
|
||||||
// ->label('Amis 文档')
|
->label('Amis 文档')
|
||||||
// ->blank(true)
|
->blank(true)
|
||||||
// ->actionType('url')
|
->actionType('url')
|
||||||
// ->link('https://aisuda.bce.baidu.com/amis/zh-CN/docs/index'),
|
->link('https://aisuda.bce.baidu.com/amis/zh-CN/docs/index'),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class BizException extends Exception
|
|
||||||
{
|
|
||||||
public function __construct(string $message, int $code = 400)
|
|
||||||
{
|
|
||||||
parent::__construct($message, $code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用于响应的 HTTP 状态代码
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $status = 200;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置用于响应的 HTTP 状态代码
|
|
||||||
*
|
|
||||||
* @param int $status
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function status(int $status)
|
|
||||||
{
|
|
||||||
$this->status = $status;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 报告异常
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function report()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,30 +2,34 @@
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Illuminate\Auth\AuthenticationException;
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* A list of exception types with their corresponding custom log levels.
|
||||||
|
*
|
||||||
|
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
|
||||||
|
*/
|
||||||
|
protected $levels = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of the exception types that are not reported.
|
* A list of the exception types that are not reported.
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var array<int, class-string<\Throwable>>
|
||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
//
|
//
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
* A list of the inputs that are never flashed to the session on validation exceptions.
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $dontFlash = [
|
protected $dontFlash = [
|
||||||
'current_password',
|
'current_password',
|
||||||
|
|
@ -33,28 +37,6 @@ class Handler extends ExceptionHandler
|
||||||
'password_confirmation',
|
'password_confirmation',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the default context variables for logging.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function context()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
return array_merge(parent::context(), [
|
|
||||||
'url' => request()->url(),
|
|
||||||
'params' => request()->except($this->dontFlash),
|
|
||||||
'accept' => request()->header('accept'),
|
|
||||||
'client_app' => request()->header('client-app'),
|
|
||||||
'client_version' => request()->header('client-version'),
|
|
||||||
'client_platform' => request()->header('client-platform'),
|
|
||||||
'client_os' => request()->header('client-os'),
|
|
||||||
]);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the exception handling callbacks for the application.
|
* Register the exception handling callbacks for the application.
|
||||||
*
|
*
|
||||||
|
|
@ -62,98 +44,17 @@ class Handler extends ExceptionHandler
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->map(ModelNotFoundException::class, function ($e) {
|
// Laravel9.x 无法捕获 ModelNotFoundException, 在父类 prepareException 方法中被转换为 Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||||
$resource = __($key = 'models.'.$e->getModel());
|
$this->renderable(function (\Illuminate\Database\Eloquent\ModelNotFoundException $e, Request $request) {
|
||||||
|
|
||||||
if ($key === $resource) {
|
|
||||||
$resource = str_ireplace(['App\\Models\\Admin\\', 'App\\Models\\'], '', $e->getModel());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HttpException(404, __(':resource not found', ['resource' => $resource]), $e);
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->renderable(function (BizException $e, $request) {
|
|
||||||
if ($this->shouldReturnJson($request, $e)) {
|
|
||||||
return response()->json($this->convertExceptionToArray($e), $e->status);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! config('app.debug')) {
|
|
||||||
$e = new HttpException($e->status, $e->getMessage(), $e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->prepareResponse($request, $e);
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->renderable(function (ThrottleRequestsException $e, Request $request) {
|
|
||||||
if ($request->acceptsJson()) {
|
if ($request->acceptsJson()) {
|
||||||
return response()->json(['code' => 429, 'message' => $e->getMessage()]);
|
return response()->json(['status' => 404, 'msg' => '资源不存在', 'data' => null], 200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$this->renderable(function (\Illuminate\Validation\ValidationException $e, Request $request) {
|
||||||
|
if ($request->acceptsJson()) {
|
||||||
|
$errors = $e->validator->errors();
|
||||||
|
return response()->json(['status' => 422, 'msg' => $errors->first(), 'data' => null, 'errors' => $errors], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->prepareResponse($request, $e);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function unauthenticated($request, AuthenticationException $exception)
|
|
||||||
{
|
|
||||||
return $this->shouldReturnJson($request, $exception)
|
|
||||||
? response()->json([
|
|
||||||
'code' => 401,
|
|
||||||
'message' => $exception->getMessage(),
|
|
||||||
], 401)
|
|
||||||
: redirect()->guest($exception->redirectTo() ?? route('login'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function invalidJson($request, ValidationException $exception)
|
|
||||||
{
|
|
||||||
return response()->json([
|
|
||||||
'code' => 422,
|
|
||||||
'message' => $exception->getMessage(),
|
|
||||||
'errors' => $exception->errors(),
|
|
||||||
], 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function convertExceptionToArray(Throwable $e)
|
|
||||||
{
|
|
||||||
$data = [
|
|
||||||
'code' => 500,
|
|
||||||
'message' => config('app.debug') ? $e->getMessage() : '服务器繁忙,请稍后再试',
|
|
||||||
];
|
|
||||||
if ($this->isBizException($e)) {
|
|
||||||
$data = [
|
|
||||||
'code' => $e->getCode(),
|
|
||||||
'message' => $e->getMessage(),
|
|
||||||
'data' => null,
|
|
||||||
];
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
} elseif ($this->isHttpException($e)) {
|
|
||||||
$data = [
|
|
||||||
'code' => $e->getStatusCode(),
|
|
||||||
'message' => $e->getMessage(),
|
|
||||||
'data' => null,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return array_merge(parent::convertExceptionToArray($e), $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认给定的异常是否是自定义业务异常
|
|
||||||
*
|
|
||||||
* @param Throwable $e
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function isBizException(Throwable $e): bool
|
|
||||||
{
|
|
||||||
return $e instanceof BizException;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,10 @@ class MonitorModeFilter extends ModelFilter
|
||||||
}
|
}
|
||||||
return $q;
|
return $q;
|
||||||
});
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
return $this->whereRaw("FIND_IN_SET('".$groupTags."',group_tags)");
|
return $this->whereRaw("FIND_IN_SET('".$groupTags."',group_tags)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
|
|
||||||
class AuthController extends Controller
|
|
||||||
{
|
|
||||||
public function login(Request $request)
|
|
||||||
{
|
|
||||||
$request->validate([
|
|
||||||
'username' => 'required',
|
|
||||||
'password' => 'required',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$user = AdminUser::where(['username' => $request->input('username')])->first();
|
|
||||||
if (! $user) {
|
|
||||||
return $this->error('用户名或密码错误');
|
|
||||||
}
|
|
||||||
if (! Hash::check($request->input('password'), $user->password)) {
|
|
||||||
return $this->error('用户名或密码错误');
|
|
||||||
}
|
|
||||||
|
|
||||||
// if ($user->is_enable !== 1) {
|
|
||||||
// return $this->error('用户状态异常请联系管理员');
|
|
||||||
// }
|
|
||||||
|
|
||||||
return $this->attemptUser($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function attemptUser(AdminUser $user, $name = 'api')
|
|
||||||
{
|
|
||||||
$token = $user->createToken($name)->plainTextToken;
|
|
||||||
|
|
||||||
return $this->json(['token' => $token]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\{Device, MonitorDevice, RegionMonitor};
|
|
||||||
use DB;
|
|
||||||
|
|
||||||
class DeviceController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 统计某个基地下所有设备状态数量
|
|
||||||
*/
|
|
||||||
public function typeStateNum(Request $request)
|
|
||||||
{
|
|
||||||
$regionId = $request->input('region_id', 0);
|
|
||||||
|
|
||||||
$query = Device::query();
|
|
||||||
|
|
||||||
if($regionId){
|
|
||||||
$monitorIds = RegionMonitor::where('region_id', $regionId)->pluck('id')->toArray();
|
|
||||||
|
|
||||||
if(count($monitorIds) > 0){
|
|
||||||
$deviceIds = MonitorDevice::whereIn('monitor_id', $monitorIds)->pluck('id')->toArray();
|
|
||||||
$query->whereIn('id', $deviceIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$query->groupBy('type')->groupBy('state');
|
|
||||||
|
|
||||||
$list = $query->select(DB::raw('type, state, count(1) as num '))->get();
|
|
||||||
$resData = [];
|
|
||||||
foreach ($list as $item) {
|
|
||||||
$resData[$item->type][$item->state] = $item->num;
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化数据;
|
|
||||||
$data = [];
|
|
||||||
foreach (Device::typeMap() as $typeKey => $typeName) {
|
|
||||||
foreach (Device::stateMap() as $statusKey => $statusName) {
|
|
||||||
$data[$typeKey][$statusKey] = $resData[$typeKey][$statusKey] ?? 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->json($data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
|
|
||||||
class UserController extends Controller
|
|
||||||
{
|
|
||||||
public function logout()
|
|
||||||
{
|
|
||||||
$user = auth()->user();
|
|
||||||
// $user->tokens()->delete();
|
|
||||||
$user->currentAccessToken()->delete();
|
|
||||||
|
|
||||||
return $this->success('退出成功');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -24,8 +24,6 @@ class RegionResource extends JsonResource
|
||||||
'category_id' => $this->category_id,
|
'category_id' => $this->category_id,
|
||||||
'category' => RegionCategoryResource::make($this->whenLoaded('category')),
|
'category' => RegionCategoryResource::make($this->whenLoaded('category')),
|
||||||
'current_plant' => RegionPlantResource::make($this->whenLoaded('currentPlant')),
|
'current_plant' => RegionPlantResource::make($this->whenLoaded('currentPlant')),
|
||||||
'position_x'=> $this->position_x,
|
|
||||||
'position_y'=> $this->position_y,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,15 +55,6 @@ class Device extends Model
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function stateMap(){
|
|
||||||
return [
|
|
||||||
self::STATE_DISABLED => '禁用',
|
|
||||||
self::STATE_ONLINE => '在线',
|
|
||||||
self::STATE_OFFLINE => '离线',
|
|
||||||
self::STATE_FAULT => '故障',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function modes(){
|
public function modes(){
|
||||||
return $this->belongsToMany(MonitorMode::class, MonitorDevice::class, 'device_id', 'monitor_id')->withPivot('fields');
|
return $this->belongsToMany(MonitorMode::class, MonitorDevice::class, 'device_id', 'monitor_id')->withPivot('fields');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ class Region extends Model
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name', 'cover', 'director', 'area', 'description', 'category_id',
|
'name', 'cover', 'director', 'area', 'description', 'category_id',
|
||||||
'sort', 'is_recommend','is_enable',
|
'sort', 'is_recommend','is_enable'
|
||||||
'position_x', 'position_y'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,6 @@ return [
|
||||||
'driver' => 'session',
|
'driver' => 'session',
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
],
|
],
|
||||||
'api' => [
|
|
||||||
'driver' => 'sanctum',
|
|
||||||
'provider' => 'users',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('regions', function (Blueprint $table) {
|
|
||||||
//
|
|
||||||
$table->decimal('position_x')->nullable()->comment('x轴位置');
|
|
||||||
$table->decimal('position_y')->nullable()->comment('y轴位置');
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::table('regions', function (Blueprint $table) {
|
|
||||||
//
|
|
||||||
$table->dropColumn(['position_x', 'position_y']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Http\Controllers\Api;
|
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Http\Controllers\Api\{BannerController, AdminNoticeController, ArticleController, RegionController};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
@ -29,16 +30,3 @@ Route::get('region', [RegionController::class, 'index']);
|
||||||
Route::get('region/{id}', [RegionController::class, 'show']);
|
Route::get('region/{id}', [RegionController::class, 'show']);
|
||||||
Route::get('region/{id}/plants', [RegionController::class, 'plants']);
|
Route::get('region/{id}/plants', [RegionController::class, 'plants']);
|
||||||
Route::get('region/{id}/harvests', [RegionController::class, 'harvests']);
|
Route::get('region/{id}/harvests', [RegionController::class, 'harvests']);
|
||||||
|
|
||||||
|
|
||||||
//大屏接口
|
|
||||||
Route::post('auth/login', [AuthController::class, 'login']);
|
|
||||||
|
|
||||||
Route::group(['middleware' => 'auth:sanctum'], function () {
|
|
||||||
|
|
||||||
Route::get('devices-num', [DeviceController::class, 'typeStateNum'])->name('device.type_state_num');
|
|
||||||
|
|
||||||
Route::prefix('users')->group(function () {
|
|
||||||
Route::delete('logout', [UserController::class, 'logout']);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loading…
Reference in New Issue