Explorar el Código

增三方è®订单增加pv记录,增加复购金

hefei hace 1 año
padre
commit
5f3a902a6c

+ 18 - 2
app/common/repositories/store/order/StoreOrderRepository.php

@@ -3803,8 +3803,9 @@ class StoreOrderRepository extends BaseRepository
3803 3803
             if ($sprerdUser["user_group"] == 7) {
3804 3804
                 $yongjinbili = 17;
3805 3805
             }
3806
-
3807
-            $tuiguanyongjin = round($pvfee * $yongjinbili / 100, 2);
3806
+            $yongjin = $pvfee * $yongjinbili / 100;
3807
+            // 佣金百分之90进入佣金池
3808
+            $tuiguanyongjin = round($yongjin * 0.9, 2);
3808 3809
 
3809 3810
 
3810 3811
             $tuiYongmark = "推荐消费获得佣金" . $tuiguanyongjin;
@@ -3819,6 +3820,21 @@ class StoreOrderRepository extends BaseRepository
3819 3820
                 Db::name('log')->insert(['data' => '订单号:' . $order_sn . '付款额度较低或 商家、平台设置的返佣比例较低,佣金低于0.01无法入库 特此记录!']);
3820 3821
             }
3821 3822
 
3823
+            if($yongjin >= 0.1){
3824
+                // 佣金百分之10进入复购金
3825
+                $orderThird = app()->make(UserThirdRepository::class);
3826
+                //复购金
3827
+                $orderThird->yuguFugou(
3828
+                    $yongjin,
3829
+                    $sprerdUser["uid"],
3830
+                    $order_sn,
3831
+                    $order["type_shop"]
3832
+                );
3833
+            } else {
3834
+                Db::name('log')->insert(['data' => '订单号:' . $order_sn . '付款额度较低或 商家、平台设置的返佣比例较低,复购金低于0.01无法入库 特此记录!']);
3835
+            }
3836
+
3837
+
3822 3838
         }
3823 3839
         //end存养老金
3824 3840
 

+ 12 - 0
app/common/repositories/user/UserThirdRepository.php

@@ -865,6 +865,18 @@ class UserThirdRepository extends BaseRepository
865 865
             Db::name("user_sign_gongxian")->insert($gongxian_data);//添加贡献记录
866 866
             log::info("===添加完积分和贡献值");
867 867
 
868
+            // 添加pv记录
869
+            $pv_data = [
870
+                "uid"           =>$user_id,
871
+                "pv"            =>$gongxian,
872
+                "addtime"       =>time(),
873
+                "status"        =>-1,
874
+                "order_type"    =>$type_shop,
875
+                "order_id"      =>$order_sn,
876
+                "mark"          =>"购买{$make}商品获得的PV",
877
+            ];
878
+            Db::name("user_pv_log")->insert($pv_data);//添加pv记录
879
+
868 880
             //判断是否是老用户  is_old=1是1.0的用户,1.0的用户要总pv*45%的红包
869 881
             if($user["is_old"]==1){
870 882
                 //添加红包