diff --git a/app/common/model/store_finance_flow/StoreFinanceFlow.php b/app/common/model/store_finance_flow/StoreFinanceFlow.php index 38f79b90c..c1e701280 100644 --- a/app/common/model/store_finance_flow/StoreFinanceFlow.php +++ b/app/common/model/store_finance_flow/StoreFinanceFlow.php @@ -36,10 +36,22 @@ class StoreFinanceFlow extends BaseModel { return $this->hasOne(SystemStoreStaff::class, 'id', 'staff_id')->bind(['staff_name']); } - + public static function onBeforeWrite($data) + { + try { + $where = $data->getWhere(); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(),$where),'store_finance_flow','更新前'); + } + } + } catch (Throwable $e) { + Log::error('store_finance_flow:' . $e->getMessage()); + } + } public static function onAfterWrite($data){ try{ - channelLog($data->getOrigin(),'store_finance_flow','更新前'); channelLog($data->toArray(),'store_finance_flow','更新后'); }catch(Throwable $e){ Log::error('store_finance_flow:'.$e->getMessage()); diff --git a/app/common/model/system_store/SystemStore.php b/app/common/model/system_store/SystemStore.php index ff209e545..320d93f30 100644 --- a/app/common/model/system_store/SystemStore.php +++ b/app/common/model/system_store/SystemStore.php @@ -19,9 +19,23 @@ class SystemStore extends BaseModel protected $name = 'system_store'; protected $deleteTime = 'delete_time'; + public static function onBeforeWrite($data) + { + try { + $where = $data->getWhere(); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(),$where),'system_store','更新前'); + } + } + } catch (Throwable $e) { + Log::error('system_store:' . $e->getMessage()); + } + } + public static function onAfterWrite($data){ try{ - channelLog($data->getOrigin(),'system_store','更新前'); channelLog($data->toArray(),'system_store','更新后'); }catch(Throwable $e){ Log::error('system_store:'.$e->getMessage());