feat: log operate

This commit is contained in:
JaguarJack 2023-01-02 18:36:22 +08:00
parent d8b4c7d37d
commit 54e595595d
3 changed files with 9 additions and 7 deletions

View File

@ -33,6 +33,8 @@ class LogLogin extends Model
{ {
return static::when($email, function ($query) use ($email){ return static::when($email, function ($query) use ($email){
$query->where('account', $email); $query->where('account', $email);
})->paginate(request()->get('limit', 10)); })
->orderByDesc('id')
->paginate(request()->get('limit', 10));
} }
} }

View File

@ -69,7 +69,7 @@ class LogOperate extends Model
'creator_id' => $user->id, 'creator_id' => $user->id,
'http_method' => $request->method(), 'http_method' => $request->method(),
'http_code' => $response->getStatusCode(), 'http_code' => $response->getStatusCode(),
'start_at' => $requestStartAt, 'start_at' => intval($requestStartAt/1000),
'time_taken' => $timeTaken, 'time_taken' => $timeTaken,
'ip' => $request->ip(), 'ip' => $request->ip(),
'params' => \json_encode($params, JSON_UNESCAPED_UNICODE), 'params' => \json_encode($params, JSON_UNESCAPED_UNICODE),

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="pl-2 pr-2 bg-white dark:bg-regal-dark rounded-lg mt-4 pb-6"> <div class="pl-2 pr-2 bg-white dark:bg-regal-dark rounded-lg mt-4 pb-6">
<el-table :data="tableData" class="mt-3" v-loading="loading"> <el-table :data="tableData" class="mt-3" v-loading="loading">
<el-table-column prop="account" label="账户" width="150px" /> <el-table-column prop="account" label="账户" />
<el-table-column prop="browser" label="浏览器" width="100px" /> <el-table-column prop="browser" label="浏览器" />
<el-table-column prop="platform" label="平台" width="100px" /> <el-table-column prop="platform" label="平台" />
<el-table-column prop="login_ip" label="IP" width="120px" /> <el-table-column prop="login_ip" label="IP" />
<el-table-column prop="status" label="状态" width="100px"> <el-table-column prop="status" label="状态">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="scope.row.status === 1">成功</el-tag> <el-tag type="success" v-if="scope.row.status === 1">成功</el-tag>
<el-tag type="danger" v-else>失败</el-tag> <el-tag type="danger" v-else>失败</el-tag>