feat: #10000 日志用户优化

This commit is contained in:
赵世界 2022-08-22 19:03:04 +08:00
parent d1dc9adf0d
commit 53c895ec4b
2 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ class Log extends Model
public function add($targetId = 0, $targetField = '') 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_id'] = $targetId;
$this->attributes['target_field'] = $targetField; $this->attributes['target_field'] = $targetField;

View File

@ -148,7 +148,7 @@ abstract class BusinessClient
$log->target_type = $this->getShop()->plat_id . '--' . $this->getShop()->name; $log->target_type = $this->getShop()->plat_id . '--' . $this->getShop()->name;
$log->target_id = $this->getShop()->id; $log->target_id = $this->getShop()->id;
$log->target_field = $params['type']; $log->target_field = $params['type'];
$log->user_id = Auth::id(); $log->user_id = Auth::id() ?? 1;
if ($size < 64000) { if ($size < 64000) {
$log->message = json_encode($res, 256); $log->message = json_encode($res, 256);
} }