feat: 修改产品佣金计算逻辑

This commit is contained in:
mkm 2024-07-27 18:00:44 +08:00
parent 9117e3eb89
commit 8e2e9c0fa8

View File

@ -6,6 +6,7 @@ use app\common\model\distribution\Distribution;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
/**
* 产品佣金计算
@ -19,7 +20,7 @@ class CommissionProductLogic extends BaseLogic
*/
function calculate_product_flow($find, $order, $village_uid = 0, $brigade_uid = 0, $user_ship = 0)
{
$product = StoreBranchProduct::where('store_id', $order['store_id'])->where('product_id', $find['product_id'])->find();
$product = StoreProduct::where('id', $find['product_id'])->find();
if ($product && $product['rose'] > 0) {
if(in_array($user_ship,[4, 6, 7])){
$this->b($find, $order,$product);
@ -120,6 +121,7 @@ class CommissionProductLogic extends BaseLogic
$number = bcsub($total, $commission, 2);
if ($product['rose'] <= 4) {
//门店
d(2);
$data = [
'store_id' => $order['store_id'],
'product_id' => $find['product_id'],
@ -130,6 +132,8 @@ class CommissionProductLogic extends BaseLogic
];
StoreFinanceFlowProduct::create($data);
} else {
d(3);
//门店
$data[] = [
'store_id' => $order['store_id'],
@ -150,5 +154,6 @@ class CommissionProductLogic extends BaseLogic
];
(new StoreFinanceFlowProduct())->saveAll($data);
}
d(221);
}
}