From efc72861620cf5ea47f9638544f42efb7b5a7fcc Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Mon, 2 Sep 2024 15:31:07 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=88=96=E4=BF=AE?=
 =?UTF-8?q?=E6=94=B9API=EF=BC=9B=20fix:=20=E4=BF=AE=E5=A4=8D=E9=94=99?=
 =?UTF-8?q?=E8=AF=AF=EF=BC=9B=20refactor:=20=E9=87=8D=E5=86=99/=E9=87=8D?=
 =?UTF-8?q?=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E4=BD=86=E6=9C=AA=E6=94=B9?=
 =?UTF-8?q?=E5=8F=98API=E8=A1=8C=E4=B8=BA=EF=BC=9B=20style:=20=E6=B7=BB?=
 =?UTF-8?q?=E5=8A=A0=E7=A9=BA=E6=A0=BC=E3=80=81=E6=A0=BC=E5=BC=8F=E5=8C=96?=
 =?UTF-8?q?=E3=80=81=E7=BC=BA=E5=A4=B1=E7=9A=84=E5=88=86=E5=8F=B7=E7=AD=89?=
 =?UTF-8?q?=EF=BC=9B=20test:=20=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1?=
 =?UTF-8?q?=E7=9A=84=E6=B5=8B=E8=AF=95=E6=88=96=E4=BF=AE=E6=AD=A3=E7=8E=B0?=
 =?UTF-8?q?=E6=9C=89=E7=9A=84=E6=B5=8B=E8=AF=95=EF=BC=9B=20docs:=20?=
 =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3=E5=A6=82readme=EF=BC=9B=20?=
 =?UTF-8?q?build:=20=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96=E3=80=81=E9=A1=B9?=
 =?UTF-8?q?=E7=9B=AE=E7=89=88=E6=9C=AC=EF=BC=9B=20ops:=20=E5=BD=B1?=
 =?UTF-8?q?=E5=93=8D=E6=93=8D=E4=BD=9C=E7=BB=84=E4=BB=B6=E5=A6=82=E5=9F=BA?=
 =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=E3=80=81=E9=83=A8=E7=BD=B2=E3=80=81?=
 =?UTF-8?q?=E5=A4=87=E4=BB=BD=E3=80=81=E6=81=A2=E5=A4=8D=EF=BC=9B=20chore:?=
 =?UTF-8?q?=20=E4=BF=AE=E6=94=B9.gitignore=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

请根据以上信息生成规范的用中文conventional commit message,谨慎选择最能说明更改的Commit type,请控制你的输出在一行内,你的回复中应该仅有一条commit message。
Your reply format:
---
 .../StoreBranchProductLogic.php               |  24 +--
 .../logic/store_order/StoreOrderLogic.php     |   1 -
 .../logic/store_product/StoreProductLogic.php |   2 +-
 .../WarehouseProductLogic.php                 |  31 ++--
 app/api/lists/product/ProductLists.php        |  11 ++
 .../StoreBranchProduct.php                    |  12 +-
 .../store_finance_flow/StoreFinanceFlow.php   |  11 +-
 .../StoreFinanceFlowProduct.php               |  12 +-
 app/common/model/store_order/StoreOrder.php   |  11 +-
 .../StoreOrderCartInfo.php                    |  11 ++
 .../model/store_product/StoreProduct.php      |  11 +-
 app/common/model/system_store/SystemStore.php |  12 +-
 app/common/model/user/User.php                |   9 +
 .../warehouse_product/WarehouseProduct.php    |  12 +-
 .../WarehouseProductStorege.php               |  14 +-
 config/log.php                                | 154 +++++++++++++++++-
 16 files changed, 280 insertions(+), 58 deletions(-)

diff --git a/app/admin/logic/store_branch_product/StoreBranchProductLogic.php b/app/admin/logic/store_branch_product/StoreBranchProductLogic.php
index 0b19ba485..d3bf75c31 100644
--- a/app/admin/logic/store_branch_product/StoreBranchProductLogic.php
+++ b/app/admin/logic/store_branch_product/StoreBranchProductLogic.php
@@ -87,32 +87,16 @@ class StoreBranchProductLogic extends BaseLogic
                 $stock = bcadd($find['stock'], $params['nums'], 2);
                 $branchStock = bcadd($storeBranchProduct['stock'], $params['nums'], 2);
 
-                onBeforeUpdate($storeBranchProduct,'branch_product');
-                StoreBranchProduct::where('id', $params['id'])->update(['stock' => $branchStock, 'total_price' => bcmul($branchStock, $find['purchase'], 2)]);
-                $storeBranchProduct['stock']=$branchStock;
-                $storeBranchProduct['total_price']=bcmul($branchStock, $find['purchase'], 2);
-                onAfterUpdate($storeBranchProduct,'branch_product');
+                StoreBranchProduct::update(['stock' => $branchStock, 'total_price' => bcmul($branchStock, $find['purchase'], 2)],['id'=> $params['id']]);
+                StoreProduct::update(['stock' => $stock, 'total_price' => bcmul($stock, $find['purchase'], 2)],['id'=> $params['product_id']]);
 
-                onBeforeUpdate($find,'product');
-                StoreProduct::where('id', $params['product_id'])->update(['stock' => $stock, 'total_price' => bcmul($stock, $find['purchase'], 2)]);
-                $find['stock']=$stock;
-                $find['total_price']=bcmul($stock, $find['purchase'], 2);
-                onAfterUpdate($find,'product');
             } else {
                 $branchStock = bcsub($storeBranchProduct['stock'], $params['nums'], 2);
                 $stock = bcsub($find['stock'], $params['nums'], 2);
 
-                onBeforeUpdate($storeBranchProduct,'branch_product');
-                StoreBranchProduct::where('id', $params['id'])->update(['stock' => $branchStock, 'total_price' => bcmul($branchStock, $find['purchase'], 2)]);
-                $storeBranchProduct['stock']=$branchStock;
-                $storeBranchProduct['total_price']=bcmul($branchStock, $find['purchase'], 2);
-                onAfterUpdate($storeBranchProduct,'branch_product');
+                StoreBranchProduct::where('id', $params['id'])->update(['stock' => $branchStock, 'total_price' => bcmul($branchStock, $find['purchase'], 2)],['id'=>$params['id']]);
+                StoreProduct::where('id', $params['product_id'])->update(['stock' => $stock, 'total_price' => bcmul($stock, $find['purchase'], 2)],['id'=>$params['product_id']]);
 
-                onBeforeUpdate($find,'product');
-                StoreProduct::where('id', $params['product_id'])->update(['stock' => $stock, 'total_price' => bcmul($stock, $find['purchase'], 2)]);
-                $find['stock']=$stock;
-                $find['total_price']=bcmul($stock, $find['purchase'], 2);
-                onAfterUpdate($find,'product');
             }
             Db::commit();
             return true;
diff --git a/app/admin/logic/store_order/StoreOrderLogic.php b/app/admin/logic/store_order/StoreOrderLogic.php
index 16b6776a8..ec66af92d 100644
--- a/app/admin/logic/store_order/StoreOrderLogic.php
+++ b/app/admin/logic/store_order/StoreOrderLogic.php
@@ -46,7 +46,6 @@ class StoreOrderLogic extends BaseLogic
             $v['uid'] = $params['user_id'];
             $v['store_id'] = $params['store_id'];
             $v['cart_num'] = $v['stock'];
-            StoreBranchProduct::where('id', $v['id'])->update(['price' => $v['price'], 'vip_price' => $v['price'], 'cost' => $v['price'], 'purchase' => $v['price']]);
             unset($v['id']);
             $res = CartLogic::add($v);
             $cartId[] = $res['id'];
diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php
index d8f28f88f..49f45c5b1 100644
--- a/app/admin/logic/store_product/StoreProductLogic.php
+++ b/app/admin/logic/store_product/StoreProductLogic.php
@@ -217,7 +217,7 @@ class StoreProductLogic extends BaseLogic
                 'is_show' => $params['is_show'] ?? 0,
             ];
 
-            StoreProduct::where('id', $params['id'])->update($data);
+            StoreProduct::update($data,['id'=>$params['id']]);
 
             // $dealCate = self::dealChangeCate($params['cate_id']);
             //修改
diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php
index 2134c5133..20c547c90 100644
--- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php
+++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php
@@ -42,7 +42,7 @@ class WarehouseProductLogic extends BaseLogic
             $storege = WarehouseProductStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find();
             if ($storege) {
                 if ($params['financial_pm'] == 0) {
-                    $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty()->toArray();
+                    $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty();
                     if (!$storeProduct) {
                         throw new BusinessException('商品不存在');
                     }
@@ -52,17 +52,12 @@ class WarehouseProductLogic extends BaseLogic
                     // if ($after_nums < 0) {
                     //     throw new BusinessException('库存不足,warehouse_id:'.$params['warehouse_id'].'product_id:'.$params['product_id']);
                     // }
-                    onBeforeUpdate($storege->toArray(),'product_storege');
-                    WarehouseProductStorege::where('id', $storege['id'])->update(['nums'=>$after_nums, 'total_price' => $total_price]);
-                    $storege=$storege->toArray();
-                    $storege['nums']=$after_nums;
-                    $storege['total_price']=$total_price;
-                    onAfterUpdate($storege,'product_storege');
+                    WarehouseProductStorege::update(['nums'=>$after_nums, 'total_price' => $total_price],['id'=> $storege['id']]);
 
                     //门店加库存
                     $storeBranchProduct = StoreBranchProduct::where('product_id', $params['product_id'])->where('store_id', $params['store_id'])->find();
                     if (!$storeBranchProduct) {
-                        $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty()->toArray();
+                        $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty();
                         if (!$storeProduct) {
                             throw new BusinessException('商品不存在');
                         }
@@ -74,34 +69,32 @@ class WarehouseProductLogic extends BaseLogic
                 } else {
                     $after_nums = $storege['nums'] + $params['nums'];
                     if ($type == 1) {
-                        $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty()->toArray();
+                        $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty();
                         if (!$storeProduct) {
                             throw new BusinessException('商品不存在');
                         }
                         $total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
-                        onBeforeUpdate($storege->toArray(),'product_storege');
-                        WarehouseProductStorege::where('id', $storege['id'])->update(['nums' => $after_nums, 'total_price' => $total_price]);
-                        $storege=$storege->toArray();
-                        $storege['nums']=$after_nums;
-                        $storege['total_price']=$total_price;
-                        onAfterUpdate($storege,'product_storege');
+                        WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price],['id'=>$storege['id']]);
                     }
                 }
                 $before_nums = $storege['nums'];
             } else {
                 $after_nums = $params['nums'];
-                $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty()->toArray();
+                $storeProduct = StoreProduct::where('id', $params['product_id'])->findOrEmpty();
                 if (!$storeProduct) {
                     throw new BusinessException('商品不存在');
                 }
                 $total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
-                $storege=WarehouseProductStorege::create([
+                $data=[
                     'warehouse_id' => $params['warehouse_id'],
                     'product_id' => $params['product_id'],
                     'nums' => $params['nums'],
                     'total_price'=>$total_price
-                ]);
-                onAfterUpdate($storege->toArray(),'product_storege');
+                ];
+                if($params['financial_pm']==0){
+                    $data['nums']=-$params['nums'];
+                }
+                $storege=WarehouseProductStorege::create($data);
             }
             $batch_count =  WarehouseProduct::where(['product_id' => $params['product_id'], 'warehouse_id' => $params['warehouse_id'], 'financial_pm' => $params['financial_pm'], 'store_id' => $params['store_id']])->count();
             $data = [
diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index ac126989f..3c2bd5d0e 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -69,6 +69,17 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
      */
     public function lists(): array
     {
+        $store_name=$this->request->get('store_name');
+        if($store_name && $store_name!=''){
+            if (preg_match('/^1234-/',$store_name)) {
+                foreach($this->searchWhere as $k=>$v){
+                    if($v[0]=='store_name|bar_code'){
+                        unset($this->searchWhere[$k]);
+                        $this->searchWhere[$k]=['bar_code','=',$store_name];
+                    }
+                }
+            }
+        }
         $order = $this->request->get('order', '');
         $field = $this->request->get('field', '');
         if (empty($order) || empty($field)) {
diff --git a/app/common/model/store_branch_product/StoreBranchProduct.php b/app/common/model/store_branch_product/StoreBranchProduct.php
index c74b0bcd5..ae0ad6b83 100644
--- a/app/common/model/store_branch_product/StoreBranchProduct.php
+++ b/app/common/model/store_branch_product/StoreBranchProduct.php
@@ -7,8 +7,9 @@ use app\common\model\BaseModel;
 use app\common\model\store_category\StoreCategory;
 use app\common\model\store_product\StoreProduct;
 use app\common\model\store_product_unit\StoreProductUnit;
+use Illuminate\Support\Facades\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 门店商品属性值辅助表模型
@@ -40,4 +41,13 @@ class StoreBranchProduct extends BaseModel
     {
         return $this->hasOne(StoreProduct::class,'id','product_id');
     }
+
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'branch_product','更新前');
+            channelLog($data->toArray(),'branch_product','更新后');
+        }catch(Throwable $e){
+            Log::error('branch_product:'.$e->getMessage());
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/common/model/store_finance_flow/StoreFinanceFlow.php b/app/common/model/store_finance_flow/StoreFinanceFlow.php
index c3d449622..38f79b90c 100644
--- a/app/common/model/store_finance_flow/StoreFinanceFlow.php
+++ b/app/common/model/store_finance_flow/StoreFinanceFlow.php
@@ -7,8 +7,9 @@ use app\common\model\BaseModel;
 use app\common\model\system_store\SystemStore;
 use app\common\model\system_store\SystemStoreStaff;
 use app\common\model\user\User;
+use Illuminate\Support\Facades\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 门店流水模型
@@ -36,4 +37,12 @@ class StoreFinanceFlow extends BaseModel
         return $this->hasOne(SystemStoreStaff::class, 'id', 'staff_id')->bind(['staff_name']);
     }
 
+    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/store_finance_flow_product/StoreFinanceFlowProduct.php b/app/common/model/store_finance_flow_product/StoreFinanceFlowProduct.php
index f371f35ba..bea36cb01 100644
--- a/app/common/model/store_finance_flow_product/StoreFinanceFlowProduct.php
+++ b/app/common/model/store_finance_flow_product/StoreFinanceFlowProduct.php
@@ -4,8 +4,9 @@ namespace app\common\model\store_finance_flow_product;
 
 
 use app\common\model\BaseModel;
+use Illuminate\Support\Facades\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 财务流水商品明细
@@ -17,4 +18,13 @@ class StoreFinanceFlowProduct extends BaseModel
     use SoftDelete;
     protected $name = 'store_finance_flow_product';
     protected $deleteTime = 'delete_time';
+
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'store_finance_flow_product','更新前');
+            channelLog($data->toArray(),'store_finance_flow_product','更新后');
+        }catch(Throwable $e){
+            Log::error('store_finance_flow_product:'.$e->getMessage());
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/common/model/store_order/StoreOrder.php b/app/common/model/store_order/StoreOrder.php
index a6646512b..815958362 100644
--- a/app/common/model/store_order/StoreOrder.php
+++ b/app/common/model/store_order/StoreOrder.php
@@ -11,7 +11,7 @@ use app\common\model\system_store\SystemStoreStaff;
 use app\common\model\user\User;
 use support\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 订单列表模型
@@ -100,4 +100,13 @@ class StoreOrder extends BaseModel
         })->field("FROM_UNIXTIME(create_time,'$timeType') as days,$str as num")
             ->group('days')->select()->toArray();
     }
+
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'store_order','更新前');
+            channelLog($data->toArray(),'store_order','更新后');
+        }catch(Throwable $e){
+            Log::error('store_order:'.$e->getMessage());
+        }
+    }
 }
diff --git a/app/common/model/store_order_cart_info/StoreOrderCartInfo.php b/app/common/model/store_order_cart_info/StoreOrderCartInfo.php
index 2939ba149..93b2b3518 100644
--- a/app/common/model/store_order_cart_info/StoreOrderCartInfo.php
+++ b/app/common/model/store_order_cart_info/StoreOrderCartInfo.php
@@ -4,7 +4,9 @@ namespace app\common\model\store_order_cart_info;
 
 use app\common\model\BaseModel;
 use app\common\model\store_branch_product\StoreBranchProduct;
+use Illuminate\Support\Facades\Log;
 use think\model\concern\SoftDelete;
+use Throwable;
 
 class StoreOrderCartInfo extends BaseModel
 {
@@ -18,4 +20,13 @@ class StoreOrderCartInfo extends BaseModel
     {
         return $this->hasOne(StoreBranchProduct::class,'id','product_id')->bind(['store_name','image','unit','price']);
     }
+
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'store_order_cart_info','更新前');
+            channelLog($data->toArray(),'store_order_cart_info','更新后');
+        }catch(Throwable $e){
+            Log::error('store_order_cart_info:'.$e->getMessage());
+        }
+    }
 }
diff --git a/app/common/model/store_product/StoreProduct.php b/app/common/model/store_product/StoreProduct.php
index 7f8b6fbb5..ddcfe97e9 100644
--- a/app/common/model/store_product/StoreProduct.php
+++ b/app/common/model/store_product/StoreProduct.php
@@ -8,7 +8,7 @@ use app\common\model\store_category\StoreCategory;
 use app\common\model\store_product_unit\StoreProductUnit;
 use support\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 商品列表模型
@@ -33,4 +33,13 @@ class StoreProduct extends BaseModel
         return $this->hasOne(StoreCategory::class,'id','cate_id')->bind(['class_name'=>'name']);
 
     }
+
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'product','更新前');
+            channelLog($data->toArray(),'product','更新后');
+        }catch(Throwable $e){
+            Log::error('product:'.$e->getMessage());
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/common/model/system_store/SystemStore.php b/app/common/model/system_store/SystemStore.php
index ac1c4345b..ff209e545 100644
--- a/app/common/model/system_store/SystemStore.php
+++ b/app/common/model/system_store/SystemStore.php
@@ -4,8 +4,9 @@ namespace app\common\model\system_store;
 
 
 use app\common\model\BaseModel;
+use Illuminate\Support\Facades\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 门店列表模型
@@ -18,5 +19,12 @@ class SystemStore extends BaseModel
     protected $name = 'system_store';
     protected $deleteTime = 'delete_time';
 
-    
+    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());
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php
index affc1f583..704b7ed2a 100644
--- a/app/common/model/user/User.php
+++ b/app/common/model/user/User.php
@@ -11,6 +11,7 @@ use app\common\model\user_ship\UserShip;
 use app\common\service\FileService;
 use support\Log;
 use think\model\concern\SoftDelete;
+use Throwable;
 
 /**
  * 用户模型
@@ -196,4 +197,12 @@ class User extends BaseModel
         })->field("FROM_UNIXTIME($create_time,'$timeType') as days,count(id) as num")->group('days')->select()->toArray();
     }
 
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'user','更新前');
+            channelLog($data->toArray(),'user','更新后');
+        }catch(Throwable $e){
+            Log::error('user:'.$e->getMessage());
+        }
+    }
 }
diff --git a/app/common/model/warehouse_product/WarehouseProduct.php b/app/common/model/warehouse_product/WarehouseProduct.php
index 5f8abf079..24e61c73e 100644
--- a/app/common/model/warehouse_product/WarehouseProduct.php
+++ b/app/common/model/warehouse_product/WarehouseProduct.php
@@ -4,8 +4,9 @@ namespace app\common\model\warehouse_product;
 
 
 use app\common\model\BaseModel;
+use Illuminate\Support\Facades\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 商品仓储信息模型
@@ -18,5 +19,12 @@ class WarehouseProduct extends BaseModel
     protected $name = 'warehouse_product';
     protected $deleteTime = 'delete_time';
 
-    
+    public static function onAfterWrite($data){
+        try{
+            channelLog($data->getOrigin(),'warehouse_product','更新前');
+            channelLog($data->toArray(),'warehouse_product','更新后');
+        }catch(Throwable $e){
+            Log::error('warehouse_product:'.$e->getMessage());
+        }
+    }
 }
\ No newline at end of file
diff --git a/app/common/model/warehouse_product_storege/WarehouseProductStorege.php b/app/common/model/warehouse_product_storege/WarehouseProductStorege.php
index fd8cefcd0..9d86d6924 100644
--- a/app/common/model/warehouse_product_storege/WarehouseProductStorege.php
+++ b/app/common/model/warehouse_product_storege/WarehouseProductStorege.php
@@ -6,7 +6,7 @@ namespace app\common\model\warehouse_product_storege;
 use app\common\model\BaseModel;
 use support\Log;
 use think\model\concern\SoftDelete;
-
+use Throwable;
 
 /**
  * 仓库商品存储
@@ -18,5 +18,13 @@ class WarehouseProductStorege extends BaseModel
     use SoftDelete;
     protected $name = 'warehouse_product_storege';
     protected $deleteTime = 'delete_time';
-
-}
\ No newline at end of file
+    public static function onAfterWrite($data)
+    {
+        try {
+            channelLog($data->getOrigin(), 'warehouse_product_storege', '更新前');
+            channelLog($data->toArray(), 'warehouse_product_storege', '更新后');
+        } catch (Throwable $e) {
+            Log::error('warehouse_product_storege:' . $e->getMessage());
+        }
+    }
+}
diff --git a/config/log.php b/config/log.php
index 38c5ecc21..1b75ae61d 100644
--- a/config/log.php
+++ b/config/log.php
@@ -53,7 +53,7 @@ return [
                 'class' => Monolog\Handler\RotatingFileHandler::class,
                 // handler类的构造函数参数
                 'constructor' => [
-                    runtime_path() . '/product/'.date('Ym').'/.log',
+                    runtime_path() . '/product/' . date('Ym') . '/.log',
                     2048,
                     Monolog\Logger::DEBUG,
                     true,
@@ -77,7 +77,7 @@ return [
                 'class' => Monolog\Handler\RotatingFileHandler::class,
                 // handler类的构造函数参数
                 'constructor' => [
-                    runtime_path() . '/branch_product/'.date('Ym').'/.log',
+                    runtime_path() . '/branch_product/' . date('Ym') . '/.log',
                     2048,
                     Monolog\Logger::DEBUG,
                     true,
@@ -101,7 +101,7 @@ return [
                 'class' => Monolog\Handler\RotatingFileHandler::class,
                 // handler类的构造函数参数
                 'constructor' => [
-                    runtime_path() . '/product_storege/'.date('Ym').'/.log',
+                    runtime_path() . '/product_storege/' . date('Ym') . '/.log',
                     2048,
                     Monolog\Logger::DEBUG,
                     true,
@@ -125,7 +125,7 @@ return [
                 'class' => Monolog\Handler\RotatingFileHandler::class,
                 // handler类的构造函数参数
                 'constructor' => [
-                    runtime_path() . '/user/'.date('Ym').'/.log',
+                    runtime_path() . '/user/' . date('Ym') . '/.log',
                     2048,
                     Monolog\Logger::DEBUG,
                     true,
@@ -149,7 +149,151 @@ return [
                 'class' => Monolog\Handler\RotatingFileHandler::class,
                 // handler类的构造函数参数
                 'constructor' => [
-                    runtime_path() . '/system_store/'.date('Ym').'/.log',
+                    runtime_path() . '/system_store/' . date('Ym') . '/.log',
+                    2048,
+                    Monolog\Logger::DEBUG,
+                    true,
+                    0755
+                ],
+                // 格式相关
+                'formatter' => [
+                    // 格式化处理类的名字
+                    'class' => Monolog\Formatter\LineFormatter::class,
+                    // 格式化处理类的构造函数参数
+                    'constructor' => [null, 'Y-m-d H:i:s', true],
+                ],
+            ]
+        ],
+    ],
+    'store_finance_flow' => [
+        // 处理默认通道的handler,可以设置多个
+        'handlers' => [
+            [
+                // handler类的名字
+                'class' => Monolog\Handler\RotatingFileHandler::class,
+                // handler类的构造函数参数
+                'constructor' => [
+                    runtime_path() . '/store_finance_flow/' . date('Ym') . '/.log',
+                    2048,
+                    Monolog\Logger::DEBUG,
+                    true,
+                    0755
+                ],
+                // 格式相关
+                'formatter' => [
+                    // 格式化处理类的名字
+                    'class' => Monolog\Formatter\LineFormatter::class,
+                    // 格式化处理类的构造函数参数
+                    'constructor' => [null, 'Y-m-d H:i:s', true],
+                ],
+            ]
+        ],
+    ],
+    'store_finance_flow_product' => [
+        // 处理默认通道的handler,可以设置多个
+        'handlers' => [
+            [
+                // handler类的名字
+                'class' => Monolog\Handler\RotatingFileHandler::class,
+                // handler类的构造函数参数
+                'constructor' => [
+                    runtime_path() . '/store_finance_flow_product/' . date('Ym') . '/.log',
+                    2048,
+                    Monolog\Logger::DEBUG,
+                    true,
+                    0755
+                ],
+                // 格式相关
+                'formatter' => [
+                    // 格式化处理类的名字
+                    'class' => Monolog\Formatter\LineFormatter::class,
+                    // 格式化处理类的构造函数参数
+                    'constructor' => [null, 'Y-m-d H:i:s', true],
+                ],
+            ]
+        ],
+    ],
+    'store_order' => [
+        // 处理默认通道的handler,可以设置多个
+        'handlers' => [
+            [
+                // handler类的名字
+                'class' => Monolog\Handler\RotatingFileHandler::class,
+                // handler类的构造函数参数
+                'constructor' => [
+                    runtime_path() . '/store_order/' . date('Ym') . '/.log',
+                    2048,
+                    Monolog\Logger::DEBUG,
+                    true,
+                    0755
+                ],
+                // 格式相关
+                'formatter' => [
+                    // 格式化处理类的名字
+                    'class' => Monolog\Formatter\LineFormatter::class,
+                    // 格式化处理类的构造函数参数
+                    'constructor' => [null, 'Y-m-d H:i:s', true],
+                ],
+            ]
+        ],
+    ],
+    'store_order_cart_info' => [
+        // 处理默认通道的handler,可以设置多个
+        'handlers' => [
+            [
+                // handler类的名字
+                'class' => Monolog\Handler\RotatingFileHandler::class,
+                // handler类的构造函数参数
+                'constructor' => [
+                    runtime_path() . '/store_order_cart_info/' . date('Ym') . '/.log',
+                    2048,
+                    Monolog\Logger::DEBUG,
+                    true,
+                    0755
+                ],
+                // 格式相关
+                'formatter' => [
+                    // 格式化处理类的名字
+                    'class' => Monolog\Formatter\LineFormatter::class,
+                    // 格式化处理类的构造函数参数
+                    'constructor' => [null, 'Y-m-d H:i:s', true],
+                ],
+            ]
+        ],
+    ],
+    'warehouse_product' => [
+        // 处理默认通道的handler,可以设置多个
+        'handlers' => [
+            [
+                // handler类的名字
+                'class' => Monolog\Handler\RotatingFileHandler::class,
+                // handler类的构造函数参数
+                'constructor' => [
+                    runtime_path() . '/warehouse_product/' . date('Ym') . '/.log',
+                    2048,
+                    Monolog\Logger::DEBUG,
+                    true,
+                    0755
+                ],
+                // 格式相关
+                'formatter' => [
+                    // 格式化处理类的名字
+                    'class' => Monolog\Formatter\LineFormatter::class,
+                    // 格式化处理类的构造函数参数
+                    'constructor' => [null, 'Y-m-d H:i:s', true],
+                ],
+            ]
+        ],
+    ],
+    'warehouse_product_storege' => [
+        // 处理默认通道的handler,可以设置多个
+        'handlers' => [
+            [
+                // handler类的名字
+                'class' => Monolog\Handler\RotatingFileHandler::class,
+                // handler类的构造函数参数
+                'constructor' => [
+                    runtime_path() . '/warehouse_product_storege/' . date('Ym') . '/.log',
                     2048,
                     Monolog\Logger::DEBUG,
                     true,