Files
swiftadmin/app/common/model/system/SystemLog.php

34 lines
735 B
PHP
Raw Normal View History

2022-08-19 19:48:37 +08:00
<?php
2023-04-25 20:11:49 +08:00
2022-08-19 19:48:37 +08:00
namespace app\common\model\system;
use think\Model;
use app\common\library\ParseData;
/**
* @mixin \think\Model
*/
class SystemLog extends Model
{
// 定义时间戳字段名
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
// 写入日志
public static function write($logs = null)
{
if (!empty($logs) && is_array($logs)) {
try {
self::create($logs);
}
catch (\Throwable $th) {
if (preg_match('/\'(.*?)\'/',$th->getMessage(),$matches)) {
$logs[$matches[1]] = '0'; // 字节太长
self::write($logs);
}
}
}
}
}