|
|
@@ -317,8 +317,8 @@ class Notify
|
|
317
|
317
|
|
|
318
|
318
|
//推广佣金
|
|
319
|
319
|
$this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得拥金'.$yj_amount_90,$store_order_data['mer_id'],0);
|
|
320
|
|
- $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值");
|
|
321
|
|
- $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分");
|
|
|
320
|
+ $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送贡献值");
|
|
|
321
|
+ $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送积分");
|
|
322
|
322
|
|
|
323
|
323
|
|
|
324
|
324
|
|
|
|
@@ -675,35 +675,33 @@ class Notify
|
|
675
|
675
|
Db::name("test_log")->insert( $log_data);
|
|
676
|
676
|
}
|
|
677
|
677
|
|
|
678
|
|
- //$this->userupdates(userupdates);
|
|
679
|
678
|
|
|
680
|
679
|
}
|
|
681
|
680
|
|
|
682
|
|
-
|
|
683
|
|
- //会员专区,给用户升级判断
|
|
684
|
|
- $orderList = Db::name("store_order")->where("uid", $store_order_data['uid'])->where("mer_id", 496)->where("status", "in", [0, 1, 2, 3])->select();
|
|
685
|
|
- // 初始化总和变量
|
|
686
|
|
- $totalPayPrice = 0;
|
|
|
681
|
+ //会员专区,给用户升级判断
|
|
|
682
|
+ $orderList = Db::name("store_order")->where("uid", $store_order_data['uid'])->where("mer_id", 496)->where("status", "in", [0, 1, 2, 3])->select();
|
|
|
683
|
+ // 初始化总和变量
|
|
|
684
|
+ $totalPayPrice = 0;
|
|
687
|
685
|
|
|
688
|
|
- // 遍历查询结果
|
|
689
|
|
- foreach ($orderList as $order) {
|
|
690
|
|
- // 累加 pay_price
|
|
691
|
|
- $totalPayPrice += $order['pay_price'];
|
|
692
|
|
- }
|
|
|
686
|
+ // 遍历查询结果
|
|
|
687
|
+ foreach ($orderList as $order) {
|
|
|
688
|
+ // 累加 pay_price
|
|
|
689
|
+ $totalPayPrice += $order['pay_price'];
|
|
|
690
|
+ }
|
|
693
|
691
|
|
|
694
|
|
- $userdata = Db::name("user")->where("uid", $store_order_data['uid'])->find();
|
|
|
692
|
+ $userdata = Db::name("user")->where("uid", $store_order_data['uid'])->find();
|
|
695
|
693
|
|
|
696
|
|
- if ($totalPayPrice >= 1180 && $totalPayPrice < 11800) {
|
|
|
694
|
+ if ($totalPayPrice >= 1180 && $totalPayPrice < 11800) {
|
|
697
|
695
|
|
|
698
|
|
- if ($userdata['user_group'] <= 1) {
|
|
699
|
|
- Db::name("user")->where("uid", $store_order_data['uid'])->update(["user_group" => 2]);
|
|
700
|
|
- }
|
|
|
696
|
+ if ($userdata['user_group'] <= 1) {
|
|
|
697
|
+ Db::name("user")->where("uid", $store_order_data['uid'])->update(["user_group" => 2]);
|
|
|
698
|
+ }
|
|
701
|
699
|
|
|
702
|
|
- } else if ($totalPayPrice >= 11800) {
|
|
703
|
|
- if ($userdata['user_group'] <= 2) {
|
|
704
|
|
- Db::name("user")->where("uid", $store_order_data['uid'])->update(["user_group" => 3]);
|
|
705
|
|
- }
|
|
706
|
|
- }
|
|
|
700
|
+ } else if ($totalPayPrice >= 11800) {
|
|
|
701
|
+ if ($userdata['user_group'] <= 2) {
|
|
|
702
|
+ Db::name("user")->where("uid", $store_order_data['uid'])->update(["user_group" => 3]);
|
|
|
703
|
+ }
|
|
|
704
|
+ }
|
|
707
|
705
|
|
|
708
|
706
|
|
|
709
|
707
|
}
|
|
|
@@ -916,55 +914,6 @@ class Notify
|
|
916
|
914
|
}
|
|
917
|
915
|
|
|
918
|
916
|
/**
|
|
919
|
|
- * 获取当前用户业绩
|
|
920
|
|
- */
|
|
921
|
|
- public function userupdates($user_id) {
|
|
922
|
|
-
|
|
923
|
|
-
|
|
924
|
|
- $children = Db::name("user")
|
|
925
|
|
- ->where("spread_uid", $user_id)
|
|
926
|
|
- ->select(); // 获取子级的 uid 列表
|
|
927
|
|
-
|
|
928
|
|
- $total_pv = 0;
|
|
929
|
|
-
|
|
930
|
|
- foreach($children as $k=>$v){
|
|
931
|
|
- //$children_pv = Db::name("store_order")->where("uid", $v['uid'])->whereIn("status",[0,1,2,3])->select();
|
|
932
|
|
- $children_pv = Db::name("user_sign_gongxian")->where("uid", $v['uid'])->where("status",1)->select();
|
|
933
|
|
- foreach($children_pv as $k1=>$v1){
|
|
934
|
|
- $total_pv += $v1['number'];
|
|
935
|
|
- }
|
|
936
|
|
-
|
|
937
|
|
- }
|
|
938
|
|
-
|
|
939
|
|
- $userdatas = Db::name("user")->where("uid", $user_id)->find();
|
|
940
|
|
- // var_dump($userdatas['user_group']);
|
|
941
|
|
- //如果当前用户是普通消费者的情况下
|
|
942
|
|
- if($userdatas['user_group'] == 1){
|
|
943
|
|
- if($total_pv != 0){
|
|
944
|
|
-
|
|
945
|
|
- if($total_pv >= 1180 && $total_pv < 11800){
|
|
946
|
|
-
|
|
947
|
|
- Db::name("user")->where("uid", $user_id)->update(['user_group',2]);
|
|
948
|
|
- }
|
|
949
|
|
-
|
|
950
|
|
- }
|
|
951
|
|
- }
|
|
952
|
|
-
|
|
953
|
|
- //如果当前用户是业务员消费者的情况下
|
|
954
|
|
- if($userdatas['user_group'] <= 2){
|
|
955
|
|
- if($total_pv != 0){
|
|
956
|
|
-
|
|
957
|
|
- if(11800 <= $total_pv){
|
|
958
|
|
-
|
|
959
|
|
- Db::name("user")->where("uid", $user_id)->update(['user_group',3]);
|
|
960
|
|
- }
|
|
961
|
|
-
|
|
962
|
|
- }
|
|
963
|
|
- }
|
|
964
|
|
-
|
|
965
|
|
- }
|
|
966
|
|
-
|
|
967
|
|
- /**
|
|
968
|
917
|
* 会员升级
|
|
969
|
918
|
*/
|
|
970
|
919
|
public function member_update($orderInfo,$goods_of_info,$user_id)
|
|
|
@@ -1454,46 +1403,70 @@ class Notify
|
|
1454
|
1403
|
if( $con_data['user_group'] <= 2 ){
|
|
1455
|
1404
|
|
|
1456
|
1405
|
$spread_data = Db::name('user')->where("spread_uid",$uid)->select();
|
|
|
1406
|
+
|
|
|
1407
|
+ if (strpos($mark, "购买") !== false) {
|
|
|
1408
|
+ Db::name('user')->where("uid",$uid)->update(['contribute'=>$con_data['contribute'] + $num]);
|
|
|
1409
|
+ }
|
|
|
1410
|
+
|
|
|
1411
|
+ if (strpos($mark, "推广") !== false) {
|
|
|
1412
|
+ Db::name('user')->where("uid",$uid)->update(['per_contribute'=>$con_data['per_contribute'] + $num]);
|
|
|
1413
|
+ }
|
|
1457
|
1414
|
|
|
1458
|
|
- if(count($spread_data) > 0){
|
|
1459
|
|
- $all_ids = [];
|
|
1460
|
|
- foreach($spread_data as $k=>$v){
|
|
1461
|
|
- $all_ids[] = $v['uid'];
|
|
1462
|
|
- }
|
|
|
1415
|
+ //if(count($spread_data) > 0){
|
|
|
1416
|
+ // $all_ids = [];
|
|
|
1417
|
+ // foreach($spread_data as $k=>$v){
|
|
|
1418
|
+ // $all_ids[] = $v['uid'];
|
|
|
1419
|
+ // }
|
|
1463
|
1420
|
|
|
1464
|
|
- // 查询当前用户及其子级的所有订单
|
|
1465
|
|
- $orders = Db::name("store_order")
|
|
1466
|
|
- ->whereIn('status', [0, 1, 2, 3])
|
|
1467
|
|
- ->whereIn("uid", $all_ids)
|
|
1468
|
|
- ->whereIn("total_price", [1180, 11800, 10620, 2360, 9440])
|
|
1469
|
|
- ->select();
|
|
|
1421
|
+ // // 查询当前用户及其子级的所有订单
|
|
|
1422
|
+ // $orders = Db::name("store_order")
|
|
|
1423
|
+ // ->whereIn('status', [0, 1, 2, 3])
|
|
|
1424
|
+ // ->whereIn("uid", $all_ids)
|
|
|
1425
|
+ // ->whereIn("total_price", [1180, 11800, 10620, 2360, 9440])
|
|
|
1426
|
+ // ->select();
|
|
1470
|
1427
|
|
|
1471
|
|
- // 计算总业绩
|
|
1472
|
|
- $totalPv = 0;
|
|
1473
|
|
- foreach ($orders as $order) {
|
|
1474
|
|
- switch ($order['total_price']) {
|
|
1475
|
|
- case 1180:
|
|
1476
|
|
- $totalPv += 700;
|
|
1477
|
|
- break;
|
|
1478
|
|
- case 11800:
|
|
1479
|
|
- $totalPv += 7000;
|
|
1480
|
|
- break;
|
|
1481
|
|
- case 10620:
|
|
1482
|
|
- $totalPv += 6300;
|
|
1483
|
|
- break;
|
|
1484
|
|
- case 2360:
|
|
1485
|
|
- $totalPv += 1400;
|
|
1486
|
|
- break;
|
|
1487
|
|
- case 9440:
|
|
1488
|
|
- $totalPv += 5600;
|
|
1489
|
|
- break;
|
|
1490
|
|
- }
|
|
1491
|
|
- }
|
|
1492
|
|
- $con_data_gongxian = Db::name('user')->where("uid",$uid)->update(['contribute'=>$con_data['contribute'] + $num , "per_contribute" => $totalPv]);
|
|
|
1428
|
+ // // 计算总业绩
|
|
|
1429
|
+ // $totalPv = 0;
|
|
|
1430
|
+ // foreach ($orders as $order) {
|
|
|
1431
|
+ // switch ($order['total_price']) {
|
|
|
1432
|
+ // case 1180:
|
|
|
1433
|
+ // $totalPv += 700;
|
|
|
1434
|
+ // break;
|
|
|
1435
|
+ // case 11800:
|
|
|
1436
|
+ // $totalPv += 7000;
|
|
|
1437
|
+ // break;
|
|
|
1438
|
+ // case 10620:
|
|
|
1439
|
+ // $totalPv += 6300;
|
|
|
1440
|
+ // break;
|
|
|
1441
|
+ // case 2360:
|
|
|
1442
|
+ // $totalPv += 1400;
|
|
|
1443
|
+ // break;
|
|
|
1444
|
+ // case 9440:
|
|
|
1445
|
+ // $totalPv += 5600;
|
|
|
1446
|
+ // break;
|
|
|
1447
|
+ // }
|
|
|
1448
|
+ // }
|
|
1493
|
1449
|
|
|
1494
|
|
- }
|
|
|
1450
|
+
|
|
|
1451
|
+
|
|
|
1452
|
+
|
|
|
1453
|
+ // }
|
|
|
1454
|
+
|
|
1495
|
1455
|
}else{
|
|
1496
|
|
- $con_data_gongxian = Db::name('user')->where("uid",$uid)->update(['contribute'=>$con_data['contribute'] + $num]);
|
|
|
1456
|
+
|
|
|
1457
|
+ // 检查是否包含“推广”
|
|
|
1458
|
+ // if (strpos($mark, "推广") !== false) {
|
|
|
1459
|
+ // echo "字符串1包含'推广'\n";
|
|
|
1460
|
+ // }
|
|
|
1461
|
+
|
|
|
1462
|
+ // 检查是否包含“购买”
|
|
|
1463
|
+ if (strpos($mark, "购买") !== false) {
|
|
|
1464
|
+ Db::name('user')->where("uid",$uid)->update(['contribute'=>$con_data['contribute'] + $num]);
|
|
|
1465
|
+ }
|
|
|
1466
|
+
|
|
|
1467
|
+
|
|
|
1468
|
+
|
|
|
1469
|
+
|
|
1497
|
1470
|
}
|
|
1498
|
1471
|
|
|
1499
|
1472
|
}
|