feat(model): 添加字段忽略日志记录功能

- 在 StoreBranchProduct、WarehouseProduct 和 WarehouseProductStorege 模型中添加 $ignoreLogFields 属性
- 设置需要忽略日志记录的字段列表,以保护敏感信息和减少不必要的日志数据
This commit is contained in:
mkm 2025-01-04 12:40:13 +08:00
parent 1504af0892
commit 24cd3ef828
3 changed files with 61 additions and 3 deletions

View File

@ -21,7 +21,34 @@ class StoreBranchProduct extends BaseModel
use SoftDelete;
protected $name = 'store_branch_product';
protected $deleteTime = 'delete_time';
public $ignoreLogFields = [
'top_cate_id',
'two_cate_id',
'cate_id',
'store_name',
'image',
'price',
'vip_price',
'cost',
'purchase',
'total_price',
'store_info',
'keyword',
'bar_code',
'rose',
'status',
'product_type',
'unit',
'batch',
'store_batch',
'sort',
'label_id',
'is_lack',
'manufacturer_information',
'status',
'create_time',
'update_time',
];
public function unitName()

View File

@ -18,7 +18,34 @@ class WarehouseProduct extends BaseModel
use SoftDelete;
protected $name = 'warehouse_product';
protected $deleteTime = 'delete_time';
public $ignoreLogFields = [
'price',
'total_price',
'status',
'pay_type',
'is_pay',
'vip_price',
'cost',
'purchase',
'total_price',
'mark',
'after_nums',
'before_nums',
'batch',
'enter_admin_id',
'admin_id',
'financial_pm',
'expiration_date',
'manufacture',
'code',
'oid',
'unit',
'store_id',
'supplier_id',
'warehouse_id',
'create_time',
'update_time',
];
public static function onBeforeWrite($data)
{
try {

View File

@ -18,7 +18,11 @@ class WarehouseProductStorege extends BaseModel
use SoftDelete;
protected $name = 'warehouse_product_storege';
protected $deleteTime = 'delete_time';
public $ignoreLogFields = [
'price',
'total_price',
'update_time',
];
public static function onBeforeWrite($data)
{
try {