|
|
@@ -18,34 +18,34 @@ class LogService
|
|
|
|
|
|
static public function log($class, $method, $description, $id_user = null, $type = 'log')
|
|
|
{
|
|
|
- $passingMethods = config('logging.passing_methods');
|
|
|
- foreach ($passingMethods as $passingMethod) {
|
|
|
- if ($passingMethod == $method) return;
|
|
|
- }
|
|
|
- if (!$id_user) {
|
|
|
- $id_user = '';
|
|
|
- $user = auth()->user();
|
|
|
- if ($user) $id_user = $user['id'];
|
|
|
- }
|
|
|
- $log = new Log([
|
|
|
- 'class' => $class,
|
|
|
- 'method' => $method,
|
|
|
- 'description' => $description,
|
|
|
- 'id_user' => $id_user,
|
|
|
- 'ip' => request()->ip(),
|
|
|
- 'type' => $type,
|
|
|
- ]);
|
|
|
- try {
|
|
|
- Redis::LLEN('LOGS');
|
|
|
- } catch (Exception $e) {
|
|
|
- //redis出现异常直接保存到数据库中
|
|
|
- $log->save();
|
|
|
- return;
|
|
|
- }
|
|
|
- $date = date('Y-m-d H:i:s');
|
|
|
- $log['created_at'] = $date;
|
|
|
- $log['updated_at'] = $date;
|
|
|
- Redis::LPUSH('LOGS', $log);
|
|
|
+// $passingMethods = config('logging.passing_methods');
|
|
|
+// foreach ($passingMethods as $passingMethod) {
|
|
|
+// if ($passingMethod == $method) return;
|
|
|
+// }
|
|
|
+// if (!$id_user) {
|
|
|
+// $id_user = '';
|
|
|
+// $user = auth()->user();
|
|
|
+// if ($user) $id_user = $user['id'];
|
|
|
+// }
|
|
|
+// $log = new Log([
|
|
|
+// 'class' => $class,
|
|
|
+// 'method' => $method,
|
|
|
+// 'description' => $description,
|
|
|
+// 'id_user' => $id_user,
|
|
|
+// 'ip' => request()->ip(),
|
|
|
+// 'type' => $type,
|
|
|
+// ]);
|
|
|
+// try {
|
|
|
+// Redis::LLEN('LOGS');
|
|
|
+// } catch (Exception $e) {
|
|
|
+// //redis出现异常直接保存到数据库中
|
|
|
+// $log->save();
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// $date = date('Y-m-d H:i:s');
|
|
|
+// $log['created_at'] = $date;
|
|
|
+// $log['updated_at'] = $date;
|
|
|
+// Redis::LPUSH('LOGS', $log);
|
|
|
}
|
|
|
|
|
|
public static function syncRedisLogs()
|