diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
deleted file mode 100644
index 4334d5029..000000000
--- a/app/common/logic/CommissionLogic.php
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-
-namespace app\common\logic;
-
-use app\common\enum\OrderEnum;
-use app\common\model\system_store\SystemStore;
-use app\common\model\user\User;
-use app\common\model\user\UserAddress;
-
-class CommissionLogic extends BaseLogic
-{
-    /**
-     * 走村长分润
-     */
-    public static function setVillage($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
-    {
-        $user_1 = self::user($order, 0.05, $transaction_id, $village_uid, 14); //村长
-        $user_2 = self::user($order, 0.03, $transaction_id, 0, 12); //会员、厨师
-        $user_3 = self::user($order, 0.01, $transaction_id, $brigade_uid, 15); //队长
-
-        $platform = self::platform($order, 0.02, $transaction_id); //平台
-        $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.02, $transaction_id, 16); //损耗
-
-        $moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
-        self::suppliter($order, $moeny, $transaction_id);
-    }
-    /**
-     * 走队长分润
-     */
-    public static function setBrigade($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
-    {
-        $user_1 = self::user($order, 0.05, $transaction_id, $brigade_uid, 15); //队长
-        $user_2 = self::user($order, 0.03, $transaction_id, 0, 12); ////会员、厨师
-        $user_3 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
-
-        $platform = self::platform($order, 0.02, $transaction_id); //平台
-        $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.02, $transaction_id, 16); //损耗
-
-        $moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
-        self::suppliter($order, $moeny, $transaction_id);
-    }
-    /**
-     * 走厨师分润
-     */
-    public static function setCook($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
-    {
-        if($order['spread_uid']<=0){
-            $uid=$order['uid'];
-        }else{
-            $uid=$order['spread_uid'];
-        }
-        $user_1 = self::user($order, 0.07, $transaction_id, $uid, 12); //会员、厨师
-        $user_2 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
-        $user_3 = self::user($order, 0.01, $transaction_id, $brigade_uid, 15); //队长
-        $platform = self::platform($order, 0.02, $transaction_id); //平台
-        $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.02, $transaction_id, 16); //损耗
-        $moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
-        self::suppliter($order, $moeny, $transaction_id);
-    }
-
-    /**
-     * 走线下分润
-     */
-    public static function setStore($order, $transaction_id = 0)
-    {
-        $platform = self::platform($order, 0.02, $transaction_id); //平台
-        $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.01, $transaction_id, 16); //损耗
-        $moeny = bcadd(bcadd($platform, $store, 2), $attrition, 2);
-        self::suppliter($order, $moeny, $transaction_id);
-    }
-
-
-    /**
-     * 平台分润
-     */
-    public static function platform($order, $platformRate, $transaction_id)
-    {
-        $financeLogic = new StoreFinanceFlowLogic();
-        $financeLogic->order = $order;
-        $financeLogic->user['uid'] = $order['uid'];
-        $pay_price = $order['pay_price'];
-        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
-            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
-        }
-        $fees = bcdiv(bcmul($pay_price, $platformRate, 2), 1, 2);
-        if ($fees > 0) {
-            $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
-            $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
-            $financeLogic->save();
-        }
-        return $fees;
-    }
-    /**
-     * 供应链订单获得
-     */
-    public static function suppliter($order, $platformRate, $transaction_id)
-    {
-        $financeLogic = new StoreFinanceFlowLogic();
-        $financeLogic->order = $order;
-        $financeLogic->user['uid'] = $order['uid'];
-        $pay_price = $order['pay_price'];
-        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
-            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
-        }
-        $fees = bcsub($pay_price, $platformRate, 2);
-        if ($fees > 0) {
-            $financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-            $financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-            $financeLogic->save();
-        }
-    }
-    /**
-     * 门店分润
-     */
-    public static function store($order, $platformRate, $transaction_id, $uid)
-    {
-        $financeLogic = new StoreFinanceFlowLogic();
-        $financeLogic->user['uid'] = $order['uid'];
-        $financeLogic->other_arr['vip_uid'] = $uid;
-        $financeLogic->order = $order;
-        $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //用户订单支付
-
-        //缴纳齐全了就加商户没有就加到平台
-        $money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
-        $deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
-        $pay_price = $order['pay_price'];
-        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
-            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
-        }
-        $store_profit = bcmul($pay_price, $platformRate, 2);
-        if ($deposit > 0) {
-            if ($deposit > $store_profit) {
-                if ($store_profit > 0) {
-                    $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-                    $financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
-                }
-            } else {
-                $money = bcsub($store_profit, $deposit, 2);
-                if ($deposit > 0) {
-                    $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-                }
-                if ($money) {
-                    $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
-                }
-            }
-        } else {
-            if ($store_profit > 0) {
-                $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
-            }
-        }
-        $financeLogic->save();
-        return $store_profit;
-    }
-
-    /**
-     * 分给用户
-     */
-    public static function user($order, $userRate, $transaction_id, $uid = 0, $enum = 0)
-    {
-        $financeLogic = new StoreFinanceFlowLogic();
-        $pay_price = $order['pay_price'];
-        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
-            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
-        }
-        $fees = bcmul($pay_price, $userRate, 2);
-        if ($fees > 0) {
-            //记录用户余额收入
-            // if ($uid) {
-                // if(in_array($enum,[14,15])&&$userRate==0.05){
-                //     $purchase_funds=User::where('id', $uid)->value('purchase_funds');
-                //     if($purchase_funds>0){
-                //         $fees_two = bcmul($purchase_funds, $userRate, 2);
-                //         if($fees_two<$fees){
-                //             $fees=$fees_two;
-                //         }
-                //     }
-                // }
-                // if($enum==12&&$userRate==0.07){
-                //     $purchase_funds=User::where('id', $uid)->value('purchase_funds');
-                //     if($purchase_funds>0){
-                //         $fees_two = bcmul($purchase_funds, $userRate, 2);
-                //         if($fees_two<$fees){
-                //             $fees=$fees_two;
-                //         }
-                //     }
-                // }
-            //     $GiveUser = User::where('id', $order['uid'])->find();
-            //     $capitalFlowDao = new CapitalFlowLogic($GiveUser);
-            //     $capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
-            // }
-            $financeLogic->user['uid'] = $order['uid'];
-            $financeLogic->other_arr['vip_uid'] = $uid;
-            $financeLogic->order = $order;
-            $financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-            $financeLogic->out($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-            $financeLogic->save();
-        }
-        return $fees;
-    }
-
-    /**
-     * 损耗金
-     */
-    public static function attrition($order, $userRate, $transaction_id, $enum)
-    {
-        $financeLogic = new StoreFinanceFlowLogic();
-        $financeLogic->order = $order;
-        $financeLogic->user['uid'] = $order['uid'];
-        $pay_price = $order['pay_price'];
-        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
-            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
-        }
-        $fees = bcmul($pay_price, $userRate, 2);
-        if ($fees > 0) {
-            $financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-            $financeLogic->out($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
-            $financeLogic->save();
-        }
-        return $fees;
-    }
-}
diff --git a/app/common/logic/CommissionProductLogic.php b/app/common/logic/CommissionProductLogic.php
index 68d2e52cb..895013475 100644
--- a/app/common/logic/CommissionProductLogic.php
+++ b/app/common/logic/CommissionProductLogic.php
@@ -25,26 +25,33 @@ class CommissionProductLogic extends BaseLogic
     {
         $product = StoreProduct::where('id', $find['product_id'])->find();
         if ($product) {
+            //活动商品
             if ($product['product_type'] == 4) {
-                $this->c($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
+                $this->c($find, $order, $product);
                 return true;
             } else {
+                //种养殖用户判断
                 if ($user_ship == 5) {
                     $top_cate_id = $product['top_cate_id'];
                     if ($top_cate_id == 15189) {
                         $this->b($find, $order, $product, $user_ship);
                         return true;
+                    }else{
+                        $this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
+                        return true;
                     }
-                } elseif ($user_ship == 0) {
+                } elseif ($user_ship == 0||$user_ship == 4) {
+                    //普通用户利润全部给门店
                     $this->b($find, $order, $product, $user_ship);
                     return true;
                 } else {
+                    //会员用户入口
                     $this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
+                    return true;
                 }
             }
-
-            return true;
         }
+        return false;
     }
 
     /**
@@ -54,21 +61,19 @@ class CommissionProductLogic extends BaseLogic
     {
         $total_price = bcmul($product['price'], $find['cart_num'], 2);
         $purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
-        $price = $product['purchase'];
+        $price = $product['price'];
 
-        $brigade_number = bcmul($purchase_price, 0.02, 2); //队长
-        $village_number = bcmul($brigade_number, 0.1, 2); //村长
-        $platform_number = bcmul($purchase_price, 0.02, 2); //平台
-        $attrition_number = bcmul($purchase_price, 0.01, 2); //损耗
+        $platform_number = 0; //平台
+        $attrition_number = 0; //损耗
+        $store_number = 0; //门店
+        $number1 = 0; //其他
 
-        $number1 = bcadd($brigade_number, $village_number, 2);
-        $number2 = bcadd($number1, $platform_number, 2);
 
+        if ($product['rose'] >= 6) {
+            $platform_number = bcmul($total_price, 0.02, 2); //平台
+        }
         //零售-供货价
         $number3 = bcsub($total_price, $purchase_price, 2);
-
-        $number4 = bcadd($attrition_number, $number2, 2);
-
         //会员
         $uid = 0;
         if ($order['spread_uid'] > 0) {
@@ -78,139 +83,66 @@ class CommissionProductLogic extends BaseLogic
             $uid = $order['uid'];
         }
         $user = User::where('id', $uid)->find();
-        $delete_time=null;
-        $nickname='会员';
+
         if ($user) {
-            $moeny = bcsub($user['total_recharge_amount'], $user['purchase_funds'], 2);
-            if ($moeny < $user['first_purchase_funds']) {
-                $delete_time=1;
-                $nickname='首充没用完,会员不分配';
+            if ($user['user_ship'] == 2) {
+                $village_number = bcmul($total_price, 0.04, 2); //村长利润
+                $data[] =$this->village('零售村长', $order, $find, $village_uid, $price, $total_price, $village_number,0.04);
+                $number1 = bcadd($number1, $village_number, 2);
+                if ($product['rose'] >= 12) {
+                    $attrition_number = bcmul($total_price, 0.02, 2); //损耗
+                    $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
+                }
+            } elseif ($user['user_ship'] == 3) {
+                $brigade_number = bcmul($total_price, 0.04, 2); //队长利润
+                $data[] = $this->brigade('零售队长', $order, $find, $brigade_uid, $price, $total_price, $brigade_number,0.04);
+                $number1 = bcadd($number1, $brigade_number, 2);
+                if ($product['rose'] >= 12 && $village_uid>0) {
+                    $village_number = bcmul($total_price, 0.01, 2); //村长利润
+                    $data[] =$this->village('零售村长', $order, $find, $village_uid, $price, $total_price, $village_number,0.01);
+                    $number1 = bcadd($number1, $village_number, 2);
+                }
+                if ($product['rose'] >= 15) {
+                    $attrition_number = bcmul($total_price, 0.02, 2); //损耗
+                    $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
+                }
+            } elseif ($user['user_ship'] == 1) {
+                $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);
+                if ($product['rose'] >= 12 && $village_uid>0) {
+                    $village_number = bcmul($total_price, 0.01, 2); //村长利润
+                    $data[] =$this->village('零售村长', $order, $find, $village_uid, $price, $total_price, $village_number,0.01);
+                    $number1 = bcadd($number1, $village_number, 2);
+                }
+                if ($product['rose'] >= 14 && $brigade_uid>0) {
+                    $brigade_number = bcmul($total_price, 0.01, 2); //队长利润
+                    $data[] =$this->village('零售队长', $order, $find, $village_uid, $price, $total_price, $brigade_number,0.01);
+                    $number1 = bcadd($number1, $brigade_number, 2);
+                }
+                if ($product['rose'] >= 15) {
+                    $attrition_number = bcmul($total_price, 0.02, 2); //损耗
+                    $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
+                }
             }
         }
-        if (in_array($user_ship, [2, 3])) {
-            $vip_number = bcmul($purchase_price, 0.05, 2); //会员利润
-            $data[] = [
-                'nickname' => $nickname,
-                'store_id' => $order['store_id'],
-                'product_id' => $find['product_id'],
-                'price' => $price,
-                'other_uid' => $uid,
-                'total_price' =>  $purchase_price,
-                'cart_num' =>  $find['cart_num'],
-                'rate' =>  0.05,
-                'number' =>  $vip_number,
-                'oid' => $order['id'],
-                'type' => 0,
-                'status' => 1,
-                'delete_time'=>$delete_time
-            ];
-            $number4 = bcadd($number4, $vip_number, 2);
-        } else {
-            $vip_number = bcmul($purchase_price, 0.07, 2); //会员利润
-            $data[] = [
-                'nickname' => $nickname,
-                'store_id' => $order['store_id'],
-                'product_id' => $find['product_id'],
-                'other_uid' => $uid,
-                'price' => $price,
-                'total_price' =>  $purchase_price,
-                'cart_num' =>  $find['cart_num'],
-                'rate' =>  0.07,
-                'number' =>  $vip_number,
-                'oid' => $order['id'],
-                'type' => 0,
-                'status' => 1,
-                'delete_time'=>$delete_time
-            ];
-            $number4 = bcadd($number4, $vip_number, 2);
-        }
         //门店利润
         if ($number3 <= 0) {
             $store_number = 0;
         } else {
-            $store_number = bcsub($number3, $number4, 2);
+            $number2 = bcadd($platform_number, $attrition_number, 2);
+            $store_number = bcsub($number3, bcadd($number1, $number2,2), 2);
         }
-
-        //队长
-        $data[] = [
-            'nickname' => '零售队长',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $purchase_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $brigade_number,
-            'oid' => $order['id'],
-            'type' => 4,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-        //村长
-        $data[] = [
-            'nickname' => '零售村长',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $brigade_number,
-            'cart_num' =>  0,
-            'rate' =>  0.01,
-            'number' => $village_number,
-            'oid' => $order['id'],
-            'type' => 3,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
         //门店
-        $data[] = [
-            'nickname' => '零售门店',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0,
-            'number' =>  $store_number,
-            'oid' => $order['id'],
-            'type' => 1,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
+        $rate=0;
+        if($store_number>0){
+            $rate=bcdiv($store_number,$total_price,2);
+        }
+        $data[] =$this->store('零售门店', $order, $find, $price, $total_price,$store_number,$rate);
         //平台
-        $data[] = [
-            'nickname' => '零售平台',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $purchase_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $platform_number,
-            'oid' => $order['id'],
-            'type' => 2,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-
-        $data[] = [
-            'nickname' => '零售消耗',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $purchase_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.01,
-            'number' =>  $attrition_number,
-            'oid' => $order['id'],
-            'type' => 6,
-            'status' => 1,
-        ];
-
+        if ($product['rose'] >= 6) {
+            $data[] = $this->platform('零售平台', $order, $find, $price, $total_price,$platform_number);
+        }
 
         (new StoreFinanceFlowProduct())->saveAll($data);
     }
@@ -220,200 +152,209 @@ class CommissionProductLogic extends BaseLogic
      */
     public function b($find, $order, $product, $user_ship)
     {
-        $total_price = bcmul($product['price'], $find['cart_num'], 2);
+        $total_price = bcmul($product['cost'], $find['cart_num'], 2);
         $purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
-        $price = $product['purchase'];
-
-        $brigade_number = bcmul($purchase_price, 0.02, 2); //队长
-        $village_number = bcmul($brigade_number, 0.1, 2); //村长
-        $platform_number = bcmul($purchase_price, 0.02, 2); //平台
-        $attrition_number = bcmul($purchase_price, 0.01, 2); //损耗
-
-        $number1 = bcadd($brigade_number, $village_number, 2);
-        $number2 = bcadd($number1, $platform_number, 2);
+        $price = $product['cost'];
 
+        $platform_number = 0;
+        $attrition_number = 0;
+        if ($product['rose'] >= 6) {
+            $platform_number = bcmul($total_price, 0.02, 2); //平台
+        }
+        if ($product['rose'] >= 10) {
+            $attrition_number = bcmul($total_price, 0.02, 2); //损耗
+        }
         //零售-供货价
         $number3 = bcsub($total_price, $purchase_price, 2);
 
-        $number4 = bcadd($attrition_number, $number2, 2);
 
         //门店利润
         if ($number3 <= 0) {
             $store_number = 0;
         } else {
-            $store_number = bcsub($number3, $number4, 2);
+            $store_number = bcsub($number3, bcadd($platform_number, $attrition_number, 2), 2);
         }
-
-        //队长
-        $data[] = [
-            'nickname' => '商户价队长预留',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $purchase_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $brigade_number,
-            'oid' => $order['id'],
-            'type' => 4,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-        //村长
-        $data[] = [
-            'nickname' => '商户价村长预留',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $brigade_number,
-            'cart_num' =>  0,
-            'rate' =>  0.01,
-            'number' => $village_number,
-            'oid' => $order['id'],
-            'type' => 3,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
         //门店
-        $data[] = [
-            'nickname' => '商户价门店',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0,
-            'number' =>  $store_number,
-            'oid' => $order['id'],
-            'type' => 1,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
+        $rate=0;
+        if($store_number>0){
+            $rate=bcdiv($store_number,$total_price,2);
+        }
+        $data[] =$this->store('商户价门店',$order,$find,$price,$total_price,$store_number,$rate);
         //平台
-        $data[] = [
-            'nickname' => '商户价平台',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $purchase_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $platform_number,
-            'oid' => $order['id'],
-            'type' => 2,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-
-        $data[] = [
-            'nickname' => '商户价消耗',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $purchase_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.01,
-            'number' =>  $attrition_number,
-            'oid' => $order['id'],
-            'type' => 6,
-            'status' => 1,
-        ];
+        if ($product['rose'] >= 6) {
+            $data[] =$this->platform('商户价平台',$order,$find,$price,$total_price,$platform_number);
+        }
+        if ($product['rose'] >= 10) {
+            $data[] = $this->attrition('商户价损耗',$order,$find,$price,$total_price,$attrition_number);
+        }
         (new StoreFinanceFlowProduct())->saveAll($data);
     }
 
     //活动商品结算
-    public function c($find, $order, $village_uid, $brigade_uid, $user_ship, $product)
+    public function c($find, $order,$product)
     {
-        // $rose = bcdiv($product['rose'], 100, 2);
         $total_price = bcmul($product['price'], $find['cart_num'], 2);
         $purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
-        $price = $product['price'];
-        $brigade_number = bcmul($total_price, 0.02, 2); //队长
-        $village_number = bcmul($brigade_number, 0.1, 2); //村长
-        $platform_number = bcmul($total_price, 0.02, 2); //平台
-
-        $number1 = bcadd($brigade_number, $village_number, 2);
-        $number2 = bcadd($number1, $platform_number, 2);
+        $price = $product['purchase'];
 
+        $platform_number = 0;
+        $attrition_number = 0;
+        if ($product['rose'] >= 6) {
+            $platform_number = bcmul($total_price, 0.02, 2); //平台
+        }
         //零售-供货价
         $number3 = bcsub($total_price, $purchase_price, 2);
 
+
         //门店利润
         if ($number3 <= 0) {
             $store_number = 0;
         } else {
-            $store_number = bcsub($number3, $number2, 2);
+            $store_number = bcsub($number3, bcadd($platform_number, $attrition_number, 2), 2);
         }
+        //门店
+        $rate=0;
+        if($store_number>0){
+            $rate=bcdiv($store_number,$total_price,2);
+        }
+        $data[] =$this->store('商户价门店',$order,$find,$price,$total_price,$store_number,$rate,1);
+        //平台
+        if ($product['rose'] >= 6) {
+            $data[] =$this->platform('商户价平台',$order,$find,$price,$total_price,$platform_number,1);
+        }
+        (new StoreFinanceFlowProduct())->saveAll($data);
+    }
 
-        //队长
-        $data[] = [
-            'nickname' => '活动队长',
+    /**
+     * 村长
+     */
+    public function village($name, $order, $find, $other_uid, $price, $total_price, $number, $rate = 0.01, $is_activity = 0)
+    {
+        $data = [
+            'nickname' => $name,
             'store_id' => $order['store_id'],
             'product_id' => $find['product_id'],
-            'other_uid' => $brigade_uid,
+            'other_uid' => $other_uid,
+            'price' => $price,
+            'total_price' =>  $total_price,
+            'cart_num' =>  0,
+            'rate' =>  $rate,
+            'number' => $number,
+            'oid' => $order['id'],
+            'type' => 3,
+            'status' => 1,
+            'is_activity' => $is_activity,
+        ];
+        return $data;
+    }
+    /**
+     * 队长
+     */
+    public function brigade($name, $order, $find, $other_uid, $price, $total_price, $number, $rate = 0.01, $is_activity = 0)
+    {
+        $data = [
+            'nickname' => $name,
+            'store_id' => $order['store_id'],
+            'product_id' => $find['product_id'],
+            'other_uid' => $other_uid,
+            'price' => $price,
+            'total_price' =>  $total_price,
+            'cart_num' =>  $find['cart_num'],
+            'rate' =>  $rate,
+            'number' => $number,
+            'oid' => $order['id'],
+            'type' => 4,
+            'status' => 1,
+            'is_activity' => $is_activity,
+        ];
+        return $data;
+    }
+    /**
+     * 平台
+     */
+    public function platform($name, $order, $find, $price, $total_price, $number, $is_activity = 0)
+    {
+        $data = [
+            'nickname' => $name,
+            'store_id' => $order['store_id'],
+            'product_id' => $find['product_id'],
+            'other_uid' => 0,
             'price' => $price,
             'total_price' =>  $total_price,
             'cart_num' =>  $find['cart_num'],
             'rate' =>  0.02,
-            'number' => $brigade_number,
-            'oid' => $order['id'],
-            'type' => 4,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-        //村长
-        $data[] = [
-            'nickname' => '活动村长',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => $village_uid,
-            'price' => $price,
-            'total_price' =>  $brigade_number,
-            'cart_num' =>  0,
-            'rate' =>  0.01,
-            'number' => $village_number,
-            'oid' => $order['id'],
-            'type' => 3,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-        //门店
-        $data[] = [
-            'nickname' => '活动门店',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $store_number,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0,
-            'number' =>  $store_number,
-            'oid' => $order['id'],
-            'type' => 1,
-            'status' => 1,
-            'is_activity' => 1,
-        ];
-        //平台
-        $data[] = [
-            'nickname' => '活动平台',
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $platform_number,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $platform_number,
+            'number' => $number,
             'oid' => $order['id'],
             'type' => 2,
             'status' => 1,
-            'is_activity' => 1,
+            'is_activity' => $is_activity,
         ];
-        (new StoreFinanceFlowProduct())->saveAll($data);
+        return $data;
+    }
+    /**
+     * 门店
+     */
+    public function store($name, $order, $find, $price, $total_price, $number,$rate = 0.05, $is_activity = 0)
+    {
+        $data = [
+            'nickname' => $name,
+            'store_id' => $order['store_id'],
+            'product_id' => $find['product_id'],
+            'other_uid' => 0,
+            'price' => $price,
+            'total_price' =>  $total_price,
+            'cart_num' =>  $find['cart_num'],
+            'rate' => $rate,
+            'number' => $number,
+            'oid' => $order['id'],
+            'type' => 1,
+            'status' => 1,
+            'is_activity' => $is_activity,
+        ];
+        return $data;
+    }
+    /**
+     * 损耗
+     */
+    public function attrition($name, $order, $find, $price, $total_price, $number, $is_activity = 0)
+    {
+        $data = [
+            'nickname' => $name,
+            'store_id' => $order['store_id'],
+            'product_id' => $find['product_id'],
+            'other_uid' => 0,
+            'price' => $price,
+            'total_price' =>  $total_price,
+            'cart_num' =>  $find['cart_num'],
+            'rate' =>  0.02,
+            'number' => $number,
+            'oid' => $order['id'],
+            'type' => 6,
+            'status' => 1,
+            'is_activity' => $is_activity,
+        ];
+        return $data;
+    }
+
+    /**
+     * 会员
+     */
+    public function vip_user($name, $order, $find, $other_uid,$price, $total_price, $number,$rate = 0.06, $is_activity = 0){
+        $data = [
+            'nickname' => $name,
+            'store_id' => $order['store_id'],
+            'product_id' => $find['product_id'],
+            'other_uid' => $other_uid,
+            'price' => $price,
+            'total_price' =>  $total_price,
+            'cart_num' =>  $find['cart_num'],
+            'rate' =>  $rate,
+            'number' =>  $number,
+            'oid' => $order['id'],
+            'type' => 0,
+            'status' => 1,
+            'is_activity' => $is_activity,
+        ];
+        return $data;
     }
 }
diff --git a/app/common/logic/CommissionProductLogic22.php b/app/common/logic/CommissionProductLogic22.php
deleted file mode 100644
index 46a95dca2..000000000
--- a/app/common/logic/CommissionProductLogic22.php
+++ /dev/null
@@ -1,359 +0,0 @@
-<?php
-
-namespace app\common\logic;
-
-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;
-use app\common\model\user\User;
-use PDO;
-use support\Log;
-
-/**
- * 产品佣金计算
- * 
- */
-class CommissionProductLogic22 extends BaseLogic
-{
-
-    /**
-     * 根据毛利率计算
-     */
-    function calculate_product_flow($find, $order, $village_uid = 0, $brigade_uid = 0, $user_ship = 0, $spread_user_ship = 0)
-    {
-        $product = StoreProduct::where('id', $find['product_id'])->find();
-        if ($product) {
-            //活动商品
-            if ($product['product_type'] == 4) {
-                $this->c($find, $order, $product);
-                return true;
-            } else {
-                //种养殖用户判断
-                if ($user_ship == 5) {
-                    $top_cate_id = $product['top_cate_id'];
-                    if ($top_cate_id == 15189) {
-                        $this->b($find, $order, $product, $user_ship);
-                        return true;
-                    }else{
-                        $this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
-                        return true;
-                    }
-                } elseif ($user_ship == 0||$user_ship == 4) {
-                    //普通用户利润全部给门店
-                    $this->b($find, $order, $product, $user_ship);
-                    return true;
-                } else {
-                    //会员用户入口
-                    $this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $product);
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 零售价结算
-     */
-    public function a($find, $order, $village_uid, $brigade_uid, $user_ship, $product)
-    {
-        $total_price = bcmul($product['price'], $find['cart_num'], 2);
-        $purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
-        $price = $product['price'];
-
-        $platform_number = 0; //平台
-        $attrition_number = 0; //损耗
-        $store_number = 0; //门店
-        $number1 = 0; //其他
-
-
-        if ($product['rose'] >= 6) {
-            $platform_number = bcmul($total_price, 0.02, 2); //平台
-        }
-        //零售-供货价
-        $number3 = bcsub($total_price, $purchase_price, 2);
-        //会员
-        $uid = 0;
-        if ($order['spread_uid'] > 0) {
-            $uid = $order['spread_uid'];
-        }
-        if ($order['uid'] > 0) {
-            $uid = $order['uid'];
-        }
-        $user = User::where('id', $uid)->find();
-
-        if ($user) {
-            if ($user['user_ship'] == 2) {
-                $village_number = bcmul($total_price, 0.04, 2); //村长利润
-                $data[] =$this->village('零售村长', $order, $find, $village_uid, $price, $total_price, $village_number,0.04);
-                $number1 = bcadd($number1, $village_number, 2);
-                if ($product['rose'] >= 12) {
-                    $attrition_number = bcmul($total_price, 0.02, 2); //损耗
-                    $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
-                }
-            } elseif ($user['user_ship'] == 3) {
-                $brigade_number = bcmul($total_price, 0.04, 2); //队长利润
-                $data[] = $this->brigade('零售队长', $order, $find, $brigade_uid, $price, $total_price, $brigade_number,0.04);
-                $number1 = bcadd($number1, $brigade_number, 2);
-                if ($product['rose'] >= 12 && $village_uid>0) {
-                    $village_number = bcmul($total_price, 0.01, 2); //村长利润
-                    $data[] =$this->village('零售村长', $order, $find, $village_uid, $price, $total_price, $village_number,0.01);
-                    $number1 = bcadd($number1, $village_number, 2);
-                }
-                if ($product['rose'] >= 15) {
-                    $attrition_number = bcmul($total_price, 0.02, 2); //损耗
-                    $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
-                }
-            } elseif ($user['user_ship'] == 1) {
-                $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);
-                if ($product['rose'] >= 12 && $village_uid>0) {
-                    $village_number = bcmul($total_price, 0.01, 2); //村长利润
-                    $data[] =$this->village('零售村长', $order, $find, $village_uid, $price, $total_price, $village_number,0.01);
-                    $number1 = bcadd($number1, $village_number, 2);
-                }
-                if ($product['rose'] >= 14 && $brigade_uid>0) {
-                    $brigade_number = bcmul($total_price, 0.01, 2); //队长利润
-                    $data[] =$this->village('零售队长', $order, $find, $village_uid, $price, $total_price, $brigade_number,0.01);
-                    $number1 = bcadd($number1, $brigade_number, 2);
-                }
-                if ($product['rose'] >= 15) {
-                    $attrition_number = bcmul($total_price, 0.02, 2); //损耗
-                    $data[] =$this->attrition('零售损耗', $order, $find, $price, $total_price,$attrition_number);
-                }
-            }
-        }
-        //门店利润
-        if ($number3 <= 0) {
-            $store_number = 0;
-        } else {
-            $number2 = bcadd($platform_number, $attrition_number, 2);
-            $store_number = bcsub($number3, bcadd($number1, $number2,2), 2);
-        }
-        //门店
-        $rate=0;
-        if($store_number>0){
-            $rate=bcdiv($store_number,$total_price,2);
-        }
-        $data[] =$this->store('零售门店', $order, $find, $price, $total_price,$store_number,$rate);
-        //平台
-        if ($product['rose'] >= 6) {
-            $data[] = $this->platform('零售平台', $order, $find, $price, $total_price,$platform_number);
-        }
-
-        (new StoreFinanceFlowProduct())->saveAll($data);
-    }
-
-    /**
-     * 商户价结算
-     */
-    public function b($find, $order, $product, $user_ship)
-    {
-        $total_price = bcmul($product['cost'], $find['cart_num'], 2);
-        $purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
-        $price = $product['cost'];
-
-        $platform_number = 0;
-        $attrition_number = 0;
-        if ($product['rose'] >= 6) {
-            $platform_number = bcmul($total_price, 0.02, 2); //平台
-        }
-        if ($product['rose'] >= 10) {
-            $attrition_number = bcmul($total_price, 0.02, 2); //损耗
-        }
-        //零售-供货价
-        $number3 = bcsub($total_price, $purchase_price, 2);
-
-
-        //门店利润
-        if ($number3 <= 0) {
-            $store_number = 0;
-        } else {
-            $store_number = bcsub($number3, bcadd($platform_number, $attrition_number, 2), 2);
-        }
-        //门店
-        $rate=0;
-        if($store_number>0){
-            $rate=bcdiv($store_number,$total_price,2);
-        }
-        $data[] =$this->store('商户价门店',$order,$find,$price,$total_price,$store_number,$rate);
-        //平台
-        if ($product['rose'] >= 6) {
-            $data[] =$this->platform('商户价平台',$order,$find,$price,$total_price,$platform_number);
-        }
-        if ($product['rose'] >= 12) {
-            $data[] = $this->attrition('商户价损耗',$order,$find,$price,$total_price,$attrition_number);
-        }
-        (new StoreFinanceFlowProduct())->saveAll($data);
-    }
-
-    //活动商品结算
-    public function c($find, $order,$product)
-    {
-        $total_price = bcmul($product['price'], $find['cart_num'], 2);
-        $purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
-        $price = $product['purchase'];
-
-        $platform_number = 0;
-        $attrition_number = 0;
-        if ($product['rose'] >= 6) {
-            $platform_number = bcmul($total_price, 0.02, 2); //平台
-        }
-        //零售-供货价
-        $number3 = bcsub($total_price, $purchase_price, 2);
-
-
-        //门店利润
-        if ($number3 <= 0) {
-            $store_number = 0;
-        } else {
-            $store_number = bcsub($number3, bcadd($platform_number, $attrition_number, 2), 2);
-        }
-        //门店
-        $rate=0;
-        if($store_number>0){
-            $rate=bcdiv($store_number,$total_price,2);
-        }
-        $data[] =$this->store('商户价门店',$order,$find,$price,$total_price,$store_number,$rate,1);
-        //平台
-        if ($product['rose'] >= 6) {
-            $data[] =$this->platform('商户价平台',$order,$find,$price,$total_price,$platform_number,1);
-        }
-        (new StoreFinanceFlowProduct())->saveAll($data);
-    }
-
-    /**
-     * 村长
-     */
-    public function village($name, $order, $find, $other_uid, $price, $total_price, $number, $rate = 0.01, $is_activity = 0)
-    {
-        $data = [
-            'nickname' => $name,
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => $other_uid,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  0,
-            'rate' =>  $rate,
-            'number' => $number,
-            'oid' => $order['id'],
-            'type' => 3,
-            'status' => 1,
-            'is_activity' => $is_activity,
-        ];
-        return $data;
-    }
-    /**
-     * 队长
-     */
-    public function brigade($name, $order, $find, $other_uid, $price, $total_price, $number, $rate = 0.01, $is_activity = 0)
-    {
-        $data = [
-            'nickname' => $name,
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => $other_uid,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  $rate,
-            'number' => $number,
-            'oid' => $order['id'],
-            'type' => 4,
-            'status' => 1,
-            'is_activity' => $is_activity,
-        ];
-        return $data;
-    }
-    /**
-     * 平台
-     */
-    public function platform($name, $order, $find, $price, $total_price, $number, $is_activity = 0)
-    {
-        $data = [
-            'nickname' => $name,
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $number,
-            'oid' => $order['id'],
-            'type' => 2,
-            'status' => 1,
-            'is_activity' => $is_activity,
-        ];
-        return $data;
-    }
-    /**
-     * 门店
-     */
-    public function store($name, $order, $find, $price, $total_price, $number,$rate = 0.05, $is_activity = 0)
-    {
-        $data = [
-            'nickname' => $name,
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' => $rate,
-            'number' => $number,
-            'oid' => $order['id'],
-            'type' => 1,
-            'status' => 1,
-            'is_activity' => $is_activity,
-        ];
-        return $data;
-    }
-    /**
-     * 损耗
-     */
-    public function attrition($name, $order, $find, $price, $total_price, $number, $is_activity = 0)
-    {
-        $data = [
-            'nickname' => $name,
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => 0,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  0.02,
-            'number' => $number,
-            'oid' => $order['id'],
-            'type' => 6,
-            'status' => 1,
-            'is_activity' => $is_activity,
-        ];
-        return $data;
-    }
-
-    /**
-     * 会员
-     */
-    public function vip_user($name, $order, $find, $other_uid,$price, $total_price, $number,$rate = 0.06, $is_activity = 0){
-        $data = [
-            'nickname' => $name,
-            'store_id' => $order['store_id'],
-            'product_id' => $find['product_id'],
-            'other_uid' => $other_uid,
-            'price' => $price,
-            'total_price' =>  $total_price,
-            'cart_num' =>  $find['cart_num'],
-            'rate' =>  $rate,
-            'number' =>  $number,
-            'oid' => $order['id'],
-            'type' => 0,
-            'status' => $is_activity,
-        ];
-        return $data;
-    }
-}
diff --git a/app/common/logic/DemoPayNotifyLogic.php b/app/common/logic/DemoPayNotifyLogic.php
index 6f0e903bd..e5025e496 100644
--- a/app/common/logic/DemoPayNotifyLogic.php
+++ b/app/common/logic/DemoPayNotifyLogic.php
@@ -602,80 +602,6 @@ class DemoPayNotifyLogic extends BaseLogic
             return false;
         }
 
-        //如果是会员需要返回会员金额
-        // if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
-        //     $order['dealVipAmount']= self::dealVipAmount($order,  $order['pay_type']);
-        // }
-        if ($order['spread_uid'] > 0 || $user_ship > 0) {
-            if ($order['spread_uid'] > 0 && $user_ship == 0) {
-                $user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
-                if ($user_ship == 2) {
-                    $village_uid = $order['spread_uid'];
-                    $address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
-                    if ($address) {
-                        $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
-                        if ($arr2) {
-                            $brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
-                        }
-                    }
-                } elseif ($user_ship == 3) {
-                    $brigade_uid = $order['spread_uid'];
-                    $address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
-                    if ($address) {
-                        $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
-                        if ($arr1) {
-                            $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
-                        }
-                    }
-                }else{
-                    $address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
-                    if ($address) {
-                        $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
-                        if ($arr1) {
-                            $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
-                        }
-                        $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
-                        if ($arr2) {
-                            $brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
-                        }
-                    }
-                }
-            } else {
-                //查询用户对应的村长和队长
-                $address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
-                if ($address) {
-                    $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
-                    if ($arr1) {
-                        $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
-                    }
-                    $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
-                    if ($arr2) {
-                        $brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
-                    }
-                }
-            }
-            switch ($user_ship) {
-                case 1: // 厨师
-                //case 4: // 商户
-                //case 5: // 种养殖
-                // case 6: // 酒店
-                // case 7: // 食堂
-                case 8: // 一条龙
-                    CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
-                    break;
-                case 2: // 村长
-                    CommissionLogic::setVillage($order, $village_uid, $brigade_uid, $transaction_id);
-                    break;
-                case 3: // 队长
-                    CommissionLogic::setBrigade($order, $village_uid, $brigade_uid, $transaction_id);
-                    break;
-                default:
-                    CommissionLogic::setStore($order, $transaction_id);
-                    break;
-            }
-        } else {
-            CommissionLogic::setStore($order, $transaction_id);
-        }
     }
 
     /**
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 0092c9410..8ec7775a8 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -600,7 +600,17 @@ class PayNotifyLogic extends BaseLogic
             foreach ($arr as $k => $v) {
                 $branchProduct = StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id', $v['store_id'])->find();
                 $storeProduct = StoreProduct::where('id', $v['product_id'])->find();
-
+                if ($storeProduct) {
+                    $stock = bcsub($storeProduct['stock'], $v['cart_num'], 2);
+                    StoreProduct::update([
+                        'stock' => $stock,
+                        'total_price' => bcmul($stock, $storeProduct['purchase'], 2),
+                        'sales' => bcadd($storeProduct['sales'], $v['cart_num'], 2)
+                    ], ['id' => $v['product_id']]);
+                    if($storeProduct['product_type']==5){
+                         continue;
+                    }
+                }
                 if ($branchProduct) {
                     $stock = bcsub($branchProduct['stock'], $v['cart_num'], 2);
                     StoreBranchProduct::update([
@@ -615,14 +625,6 @@ class PayNotifyLogic extends BaseLogic
                         'sales' => $v['cart_num']
                     ], ['product_id' => $v['product_id'],'store_id'=>$v['store_id']]);
                 }
-                if ($storeProduct) {
-                    $stock = bcsub($storeProduct['stock'], $v['cart_num'], 2);
-                    StoreProduct::update([
-                        'stock' => $stock,
-                        'total_price' => bcmul($stock, $storeProduct['purchase'], 2),
-                        'sales' => bcadd($storeProduct['sales'], $v['cart_num'], 2)
-                    ], ['id' => $v['product_id']]);
-                }
             }
         } catch (\Throwable $e) {
             Log::error('订单库存更新失败:' . $e->getMessage());