From 1ffd1193c1af86af1c22984c12e1c349c0960713 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 25 Jul 2024 17:33:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E6=AF=9B=E5=88=A9=E7=8E=87=E8=AE=A1=E7=AE=97=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=B5=81=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/CommissionProductLogic.php | 41 +++++++++++++------ .../model/distribution/Distribution.php | 22 ++++++++++ .../StoreFinanceFlowProduct.php | 20 +++++++++ 3 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 app/common/model/distribution/Distribution.php create mode 100644 app/common/model/store_finance_flow_product/StoreFinanceFlowProduct.php diff --git a/app/common/logic/CommissionProductLogic.php b/app/common/logic/CommissionProductLogic.php index eecff27f..d8a5db42 100644 --- a/app/common/logic/CommissionProductLogic.php +++ b/app/common/logic/CommissionProductLogic.php @@ -1,7 +1,9 @@ -field('price,cart_num,rose')->find(); - if($find && $find['rose']>0){ - $product= StoreBranchProduct::where('store_id',$store_id)->where('product_id',$product_id)->find(); - $price=bcmul($find['price'], $find['cart_num'], 2); - // $rose= bcdiv($find['rose'], 100, 2); + function calculate_product_flow($oid, $store_id, $product_id, $village_uid = 0, $brigade_uid = 0) + { + + $find = StoreOrderCartInfo::where($oid, $product_id)->field('price,cart_num,rose')->find(); + if ($find && $find['rose'] > 0) { + $product = StoreBranchProduct::where('store_id', $store_id)->where('product_id', $product_id)->find(); + if ($product) { + if ($product['rose'] >= 4 && $product['rose'] < 8) { + $rose = bcdiv($find['rose'], 100, 2); + $commission = bcmul($product['purchase'], $rose, 4); + StoreFinanceFlowProduct::create([ + 'store_id' => $store_id, + 'product_id' => $product_id, + 'number' => $commission, + 'oid' => $oid, + 'type' => 2, + 'status' => 1, + ]); + } elseif ($product['rose'] >= 8) { + + + } + } + $price = bcmul($find['price'], $find['cart_num'], 2); // $price=bcsub($price, $price - + // ) // bcsub($price, $find['rose'], 2); // return $price; } } - - -} \ No newline at end of file +} diff --git a/app/common/model/distribution/Distribution.php b/app/common/model/distribution/Distribution.php new file mode 100644 index 00000000..f63be4b9 --- /dev/null +++ b/app/common/model/distribution/Distribution.php @@ -0,0 +1,22 @@ +