From bb562f86ee34c57e34d9476996f6d2aaa2314eb0 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 28 Sep 2024 10:54:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E4=BA=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86=E6=9C=BA=E5=88=B6=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 2 +- app/common/logic/CommissionProductLogic.php | 5 +++-- .../store_branch_product/StoreBranchProduct.php | 8 ++++++-- app/common/model/store_order/StoreOrder.php | 12 ++++++++---- .../store_order_cart_info/StoreOrderCartInfo.php | 8 ++++++-- app/common/model/store_product/StoreProduct.php | 8 ++++++-- app/common/model/user/User.php | 8 ++++++-- .../model/warehouse_product/WarehouseProduct.php | 8 ++++++-- .../WarehouseProductStorege.php | 8 ++++++-- 9 files changed, 48 insertions(+), 19 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index c420d958..856c5b75 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -351,7 +351,7 @@ class OrderLogic extends BaseLogic Db::commit(); return $order; - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollback(); throw new BusinessException($e->getMessage()); } diff --git a/app/common/logic/CommissionProductLogic.php b/app/common/logic/CommissionProductLogic.php index ba685ae9..13584e2a 100644 --- a/app/common/logic/CommissionProductLogic.php +++ b/app/common/logic/CommissionProductLogic.php @@ -120,7 +120,9 @@ class CommissionProductLogic extends BaseLogic $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number); } } elseif ($user['user_ship'] == 1) { - if(bcsub($user['total_recharge_amount'],$user['purchase_funds'],2)>$user['first_purchase_funds']){ + if($order['pay_type']==18 && bcsub($user['total_recharge_amount'],$user['purchase_funds'],2)<$user['first_purchase_funds']){ + + }else{ $vip_number = bcmul($total_price, 0.06, 2); //会员利润 $data[] = $this->vip_user('零售会员', $order, $find, $uid, $price, $total_price, $vip_number,0.06); $number1 = bcadd($number1, $vip_number, 2); @@ -158,7 +160,6 @@ class CommissionProductLogic extends BaseLogic if ($rose >= 6) { $data[] = $this->platform('零售平台', $order, $find, $price, $total_price,$platform_number); } - (new StoreFinanceFlowProduct())->saveAll($data); } diff --git a/app/common/model/store_branch_product/StoreBranchProduct.php b/app/common/model/store_branch_product/StoreBranchProduct.php index e03539d9..494edb29 100644 --- a/app/common/model/store_branch_product/StoreBranchProduct.php +++ b/app/common/model/store_branch_product/StoreBranchProduct.php @@ -45,8 +45,12 @@ class StoreBranchProduct extends BaseModel { try { $where = $data->getWhere(); - $find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find, $where),'branch_product','更新前'); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(), $where),'branch_product','更新前'); + } + } } catch (Throwable $e) { Log::error('branch_product:' . $e->getMessage()); } diff --git a/app/common/model/store_order/StoreOrder.php b/app/common/model/store_order/StoreOrder.php index d87ac40f..e373c780 100644 --- a/app/common/model/store_order/StoreOrder.php +++ b/app/common/model/store_order/StoreOrder.php @@ -105,10 +105,14 @@ class StoreOrder extends BaseModel { try { $where = $data->getWhere(); - $find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find, $where),'store_order','更新前'); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(), $where),'store_order','更新前'); + } + } } catch (Throwable $e) { - Log::error('store_order:' . $e->getMessage()); + Log::error('store_order:更新前' . $e->getMessage()); } } @@ -116,7 +120,7 @@ class StoreOrder extends BaseModel try{ channelLog($data->toArray(),'store_order','更新后'); }catch(Throwable $e){ - Log::error('store_order:'.$e->getMessage()); + 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 677c9a71..a3c407b1 100644 --- a/app/common/model/store_order_cart_info/StoreOrderCartInfo.php +++ b/app/common/model/store_order_cart_info/StoreOrderCartInfo.php @@ -25,8 +25,12 @@ class StoreOrderCartInfo extends BaseModel { try { $where = $data->getWhere(); - $find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find, $where),'store_order_cart_info','更新前'); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(),$where),'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 8d95ef26..9dcaed53 100644 --- a/app/common/model/store_product/StoreProduct.php +++ b/app/common/model/store_product/StoreProduct.php @@ -37,8 +37,12 @@ class StoreProduct extends BaseModel { try { $where = $data->getWhere(); - $find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find, $where),'product','更新前'); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if ($find) { + channelLog(array_merge($find->toArray(), $where), 'product', '更新前'); + } + } } catch (Throwable $e) { Log::error('product:' . $e->getMessage()); } diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index 8d615a72..78c22669 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -200,8 +200,12 @@ class User extends BaseModel public static function onBeforeWrite($data){ try{ $where=$data->getWhere(); - $find=self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find,$where),'user','更新前'); + if($data){ + $find=self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(),$where),'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 7ca934e1..fb086e08 100644 --- a/app/common/model/warehouse_product/WarehouseProduct.php +++ b/app/common/model/warehouse_product/WarehouseProduct.php @@ -23,8 +23,12 @@ class WarehouseProduct extends BaseModel { try { $where = $data->getWhere(); - $find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find, $where),'warehouse_product','更新前'); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(), $where),'warehouse_product','更新前'); + } + } } catch (Throwable $e) { Log::error('warehouse_product:' . $e->getMessage()); } diff --git a/app/common/model/warehouse_product_storege/WarehouseProductStorege.php b/app/common/model/warehouse_product_storege/WarehouseProductStorege.php index e120dcf0..172b611f 100644 --- a/app/common/model/warehouse_product_storege/WarehouseProductStorege.php +++ b/app/common/model/warehouse_product_storege/WarehouseProductStorege.php @@ -23,8 +23,12 @@ class WarehouseProductStorege extends BaseModel { try { $where = $data->getWhere(); - $find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray(); - channelLog(array_merge($find, $where), 'warehouse_product_storege', '更新前'); + if($data){ + $find = self::where($where)->field(array_keys($data->toArray()))->find(); + if($find){ + channelLog(array_merge($find->toArray(), $where), 'warehouse_product_storege', '更新前'); + } + } } catch (Throwable $e) { Log::error('warehouse_product_storege:' . $e->getMessage()); }