Selaa lähdekoodia

线下扫码已绑定用户增加用户推荐人贡献值和积分

hefei 1 vuosi sitten
vanhempi
commit
055d16c749

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

@@ -1434,7 +1434,43 @@ class OrderMerchantRepository extends BaseRepository
1434
         } else {
1434
         } else {
1435
             Db::name('log')->insert(['data' => '订单号:' . $order['order_sn'] . '付款额度较低或 商家、平台设置的返佣比例较低,佣金低于0.01无法入库 特此记录!']);
1435
             Db::name('log')->insert(['data' => '订单号:' . $order['order_sn'] . '付款额度较低或 商家、平台设置的返佣比例较低,佣金低于0.01无法入库 特此记录!']);
1436
         }
1436
         }
1437
+        // 推荐人获得贡献值
1438
+        if($pv >= 0.01){
1439
+            $gongxian_data = [
1440
+                "uid"           =>$top_data["spread_uid"],
1441
+                "number"  =>    $pv,
1442
+                "addtime"       =>time(),
1443
+                "status"        =>1,
1444
+                "order_type"    =>1,
1445
+                "order_id"      =>$order_id,
1446
+                "mark"          =>"推广扫码消费获得赠送贡献值",
1447
+                "desc"          =>'',
1448
+                "surplus"       =>$pv,
1449
+                "type"          =>1,
1450
+                'settlement_time' => date('Y-m-d H:i:s')
1451
+            ];
1452
+            Db::name("user_sign_gongxian")->insert($gongxian_data);//添加记录
1453
+            Db::name('user')->where('uid', $top_data["spread_uid"])->inc('contribute',$pv)->update();
1454
+        }
1437
 
1455
 
1456
+        //推荐人获得积分
1457
+        $jifen = bcmul($pv, $yonghu_tuijian, 2);
1458
+        if($jifen >= 0.01){
1459
+            $spread_data['uid'] = $top_data["spread_uid"];
1460
+            $spread_data['continuity_day'] = 0;
1461
+            $spread_data['reward_socre'] = $jifen;
1462
+            $spread_data['signin_time'] = 0;
1463
+            $spread_data['addtime'] = time();
1464
+            $spread_data['status'] = 1;
1465
+            $spread_data['mark'] = "推广扫码消费获得赠送积分";
1466
+            $spread_data['source_type'] = 3;
1467
+            $spread_data['order_id'] = $order_id;
1468
+            $spread_data['pm'] = 1;
1469
+            $spread_data['order_type'] = $order_id;
1470
+            $spread_data['settlement_time'] = date('Y-m-d H:i:s');
1471
+            Db::name('user_sign_score')->insertGetId($spread_data);
1472
+            Db::name('user')->where('uid', $top_data["spread_uid"])->inc('score',$jifen)->update();
1473
+        }
1438
         //用户推荐人获得复购金佣金百分之10
1474
         //用户推荐人获得复购金佣金百分之10
1439
         $tuijian_fugou = bcmul($tuijian_yongjin, $yonghu_fugou, 2);
1475
         $tuijian_fugou = bcmul($tuijian_yongjin, $yonghu_fugou, 2);
1440
         if ($tuijian_fugou >= 0.01) {
1476
         if ($tuijian_fugou >= 0.01) {