hefei 1 год назад
Родитель
Сommit
15a4a9115c

+ 8 - 0
app/common/repositories/merchant/order/OrderMerchantRepository.php

@@ -634,6 +634,14 @@ class OrderMerchantRepository extends BaseRepository
634 634
                     $this->feidacang_fenyong($user, $order_data, 0);
635 635
                 }
636 636
                 $this->feidacang_fenyong_mer($user, $order_data, 0);
637
+                // 增加商户分润
638
+                $mer_fanyongbili = merchantConfig($order['mer_id'], 'base_commission');
639
+                if ($mer_fanyongbili == 0) {
640
+                    $mer_fanyongbili = 5;
641
+                }
642
+                $commission = bcmul($order['pay_price'], bcdiv($mer_fanyongbili, '100', 2), 2);
643
+                $orderRepository = app()->make(StoreOrderRepository::class);
644
+                $orderRepository->con_log_fenrun($merchant['uid'],$commission,$order['order_id'],10,'扫码下单产生分润值',1);
637 645
                 $user = $userRepository->getOne($where);
638 646
                 $this->doBind($user, $order, $flag);//锁客
639 647
                 Db::name("log")->insert(['data' => '绑定用户完成']);//日志记录

+ 21 - 0
app/common/repositories/store/order/StoreOrderRepository.php

@@ -9407,6 +9407,26 @@ class StoreOrderRepository extends BaseRepository
9407 9407
         Db::name("user_pv_log")->insert($pv_data);//添加pv记录
9408 9408
     }
9409 9409
 
9410
+    // 分润记录
9411
+    public function con_log_fenrun($uid, $num, $order_id, $order_type, $mark, $status = -1)
9412
+    {
9413
+        // 添加分润记录
9414
+        $data = [
9415
+            "uid" => $uid,
9416
+            "number" => $num,
9417
+            "addtime" => time(),
9418
+            "status" => $status,
9419
+            "order_type" => $order_type,
9420
+            "order_id" => $order_id,
9421
+            "mark" => $mark,
9422
+        ];
9423
+        // 当状态为1时是实时结算
9424
+        if($status == 1) {
9425
+            $data['settlement_time'] = date('Y-m-d H:i:s');
9426
+        }
9427
+        Db::name("user_pv_log")->insert($data);//添加pv记录
9428
+    }
9429
+
9410 9430
     //添加贡献值日志
9411 9431
     public function con_log($uid, $num, $order_id, $order_type, $mark, $status = -1)
9412 9432
     {
@@ -9933,6 +9953,7 @@ class StoreOrderRepository extends BaseRepository
9933 9953
                 }
9934 9954
                 // 积分
9935 9955
                 $this->score_log($user_data['uid'], $pv, $store_order_data['order_id'], 12, "购买商贸区商品赠送积分");
9956
+                $this->con_log_fenrun($merchantInfo['uid'],$concession_pri,$store_order_data['order_id'],0,'商贸区下单产生分润值');
9936 9957
 
9937 9958
                 if ($user_data['spread_uid'] != 0) {
9938 9959
                     //查询下单用户上级