diff --git a/app/Models/Log.php b/app/Models/Log.php index 13b3e46..fd99ae2 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -111,7 +111,7 @@ class Log extends Model public function add($targetId = 0, $targetField = '') { - $this->attributes['user_id'] = Auth::id(); + $this->attributes['user_id'] = Auth::id() ?? 1; $this->attributes['target_id'] = $targetId; $this->attributes['target_field'] = $targetField; diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index 8952c1f..0648b2c 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -148,7 +148,7 @@ abstract class BusinessClient $log->target_type = $this->getShop()->plat_id . '--' . $this->getShop()->name; $log->target_id = $this->getShop()->id; $log->target_field = $params['type']; - $log->user_id = Auth::id(); + $log->user_id = Auth::id() ?? 1; if ($size < 64000) { $log->message = json_encode($res, 256); }