Skip to content

Commit 507de38

Browse files
committed
add: 记录请求日志 log 表
1 parent e814cab commit 507de38

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class ApiExcelLogs extends Model
8+
{
9+
/**
10+
* 与模型关联的数据表
11+
*
12+
* @var string
13+
*/
14+
protected $table = 'api_excel_logs';
15+
16+
protected $fillable = ['api_excel_id', 'sort_index', 'param', 'result', 'created_at'];
17+
18+
/**
19+
* 该模型是否被自动维护时间戳
20+
*
21+
* @var bool
22+
*/
23+
public $timestamps = false;
24+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateApiExcelLogsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('api_excel_logs', function(Blueprint $table) {
17+
$table->increments('id');
18+
$table->unsignedInteger('api_excel_id')->default('0')->comment('关联 api_excel 表的 id');
19+
$table->unsignedInteger('sort_index')->default('0')->comment('本次查询的排序');
20+
$table->string('param')->default('')->comment('请求参数');
21+
$table->text('result');
22+
$table->timestamp('created_at')->nullable();
23+
$table->index('api_excel_id', 'index_api_excel_id');
24+
$table->index('sort_index', 'index_sort_index');
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*
31+
* @return void
32+
*/
33+
public function down()
34+
{
35+
Schema::dropIfExists('api_excel_logs');
36+
}
37+
}

0 commit comments

Comments
 (0)