|
|
@@ -1116,29 +1116,32 @@ class StoreOrderRepository extends BaseRepository
|
|
|
$range_type = 'energy_saving_oil';
|
|
|
$integral_type = 'spread_oil_integral';
|
|
|
// 发放分红积分
|
|
|
- $number2 = systemConfig('award_integral_energy_saving_oil', 1);
|
|
|
+ $number2 = systemConfig('award_integral_ordinary', 6);
|
|
|
} elseif ($type == 0) {
|
|
|
$mark = '普通';
|
|
|
$range_type = 'ordinary';
|
|
|
$integral_type = 'ordinary_integral';
|
|
|
- $number2 = systemConfig('award_integral_ordinary', 1);
|
|
|
+ $number2 = systemConfig('award_integral_ordinary', 6);
|
|
|
} elseif ($type == 6) {
|
|
|
$mark = '礼包';
|
|
|
$range_type = 'award_gift_pack';
|
|
|
$integral_type = 'spread_pack_integral';
|
|
|
$number2 = systemConfig('award_integral_gift_pack', 1);
|
|
|
}
|
|
|
+ $number2 = bcmul($number2,0.01,2);
|
|
|
if ($type == 5 || $type == 0) { //节能油商品和普通商品
|
|
|
- $number = systemConfig('award_energy_saving_oil', 1); //获得份额的基准线
|
|
|
- if ($order['pay_price'] >= $number) {
|
|
|
+// $number = systemConfig('award_energy_saving_oil', 1); //获得份额的基准线
|
|
|
+// if ($order['pay_price'] >= $number) {
|
|
|
// $count = app()->make(User::class)->spread_order($order['uid']); //获取推荐下级订单数
|
|
|
$count = $user['spread_pay_count'];
|
|
|
+ $multiple = systemConfig('award_ordinary', 3); //获得份额的倍数
|
|
|
@file_put_contents('quanju.txt', $count . "-下级订单数量\r\n", 8);
|
|
|
if ($count > 0) {
|
|
|
- $order_award_range = bcmul($order['pay_price'], 3, 2);
|
|
|
+ $order_award_range = bcmul($order['pay_price'], $multiple, 2);
|
|
|
} else {
|
|
|
+ $multiple = bcsub($multiple, 1, 0);
|
|
|
$order_award_range = bcmul($order['pay_price'], 1, 2);
|
|
|
- $unclaimed_range = bcmul($order['pay_price'], 2, 2);
|
|
|
+ $unclaimed_range = bcmul($order['pay_price'], $multiple, 2);
|
|
|
$unclaimed_range_after = bcadd($user['unclaimed_range'], $unclaimed_range, 2);
|
|
|
// 发放冻结份额
|
|
|
$make->incBill($order['uid'], 'award_unclaimed_range', 'unclaimed_range', [
|
|
|
@@ -1163,12 +1166,13 @@ class StoreOrderRepository extends BaseRepository
|
|
|
'mark' => $user['nickname'] . '成功消费' . $mark . '商品' . floatval($order['pay_price']) . '元,奖励分红额度' . $order_award_range,
|
|
|
]);
|
|
|
User::where('uid', $order['uid'])->update(['award_range' => $after]);
|
|
|
- }
|
|
|
+// }
|
|
|
} elseif ($type == 6) { //礼包商品
|
|
|
- $number = systemConfig('award_energy_saving_oil', 1);
|
|
|
+// $number = systemConfig('award_energy_saving_oil', 1);
|
|
|
@file_put_contents('quanju2.txt', $order['pay_price'] . "-支付金额\r\n", 8);
|
|
|
- if ($order['pay_price'] >= $number) {
|
|
|
- $order_award_range = bcmul($order['pay_price'], 3, 2);
|
|
|
+// if ($order['pay_price'] >= $number) {
|
|
|
+ $multiple = systemConfig('award_gift_pack', 3); //获得份额的倍数
|
|
|
+ $order_award_range = bcmul($order['pay_price'], $multiple, 2);
|
|
|
$after = bcadd($award_range, $order_award_range, 2);
|
|
|
$res = $make->incBill($order['uid'], 'award_range', 'award_gift_pack', [
|
|
|
'number' => $order_award_range,
|
|
|
@@ -1180,14 +1184,15 @@ class StoreOrderRepository extends BaseRepository
|
|
|
]);
|
|
|
User::where('uid', $order['uid'])->update(['award_range' => $after]);
|
|
|
@file_put_contents('quanju2.txt', $res . "-结果\r\n", 8);
|
|
|
- }
|
|
|
+// }
|
|
|
// 礼包购买数
|
|
|
$this->pack_count($order['uid']);
|
|
|
}
|
|
|
|
|
|
$award_integral = $user['award_integral'];
|
|
|
- if ($order['pay_price'] >= $number2) {
|
|
|
- $order_award_range = bcmul($order['pay_price'], 0.2, 2);
|
|
|
+// if ($order['pay_price'] >= $number2) {
|
|
|
+
|
|
|
+ $order_award_range = bcmul($order['pay_price'], $number2, 2);
|
|
|
$order_award_range = bcdiv($order_award_range, $price['price'], 2); //20%的业绩除以积分价格得到分红积分
|
|
|
$after2 = bcadd($award_integral, $order_award_range, 2);
|
|
|
$make->incBill($order['uid'], 'award_integral', $integral_type, [
|
|
|
@@ -1199,7 +1204,7 @@ class StoreOrderRepository extends BaseRepository
|
|
|
'mark' => $user['nickname'] . '成功消费' . $mark . '商品' . floatval($order['pay_price']) . '元,奖励分红积分' . $order_award_range . '(积分价格:' . $price['price'] . ')',
|
|
|
]);
|
|
|
User::where('uid', $order['uid'])->update(['award_integral' => $after2]);
|
|
|
- }
|
|
|
+// }
|
|
|
// 解冻冻结奖金
|
|
|
$UserRepository = app()->make(UserRepository::class);
|
|
|
$UserRepository->extractBrokerage($order['uid']);
|
|
|
@@ -1249,22 +1254,22 @@ class StoreOrderRepository extends BaseRepository
|
|
|
$oil = app()->make(OilLevel::class);
|
|
|
$oil->checkLevel($order['uid']);
|
|
|
|
|
|
- $ratio = systemConfig('energy_saving_oil_ratio', 10);
|
|
|
- @file_put_contents('quanju2.txt', $ratio . "-奖池比例12\r\n", 8);
|
|
|
- $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
|
|
|
- @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额12\r\n", 8);
|
|
|
- $awardLake->addOrderLakes(1, $jackpot, $order['order_id']);
|
|
|
- @file_put_contents('quanju2.txt', "-路径检查3\r\n", 8);
|
|
|
+// $ratio = systemConfig('energy_saving_oil_ratio', 10);
|
|
|
+// @file_put_contents('quanju2.txt', $ratio . "-奖池比例12\r\n", 8);
|
|
|
+// $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
|
|
|
+// @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额12\r\n", 8);
|
|
|
+// $awardLake->addOrderLakes(1, $jackpot, $order['order_id']);
|
|
|
+// @file_put_contents('quanju2.txt', "-路径检查3\r\n", 8);
|
|
|
} elseif ($type == 6) {
|
|
|
$gift = app()->make(GiftLevel::class);
|
|
|
$gift->checkLevel($order['uid']);
|
|
|
|
|
|
- $ratio = systemConfig('gift_pack_ratio', 10);
|
|
|
- @file_put_contents('quanju2.txt', $ratio . "-奖池比例\r\n", 8);
|
|
|
- $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
|
|
|
- @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额\r\n", 8);
|
|
|
- $awardLake->addOrderLakes(2, $jackpot, $order['order_id']);
|
|
|
- @file_put_contents('quanju2.txt', "-路径检查4\r\n", 8);
|
|
|
+// $ratio = systemConfig('gift_pack_ratio', 10);
|
|
|
+// @file_put_contents('quanju2.txt', $ratio . "-奖池比例\r\n", 8);
|
|
|
+// $jackpot = bcmul($order['pay_price'], bcmul($ratio, 0.01, 2), 2);
|
|
|
+// @file_put_contents('quanju2.txt', $jackpot . "-奖池分到的金额\r\n", 8);
|
|
|
+// $awardLake->addOrderLakes(2, $jackpot, $order['order_id']);
|
|
|
+// @file_put_contents('quanju2.txt', "-路径检查4\r\n", 8);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -1451,11 +1456,13 @@ class StoreOrderRepository extends BaseRepository
|
|
|
$field = 'oil_level';
|
|
|
$product_type = 1;
|
|
|
$title = '节能油团队奖励';
|
|
|
+ $performance_ratio = systemConfig('energy_saving_oil_ratio',10);
|
|
|
} else {
|
|
|
$model = new GiftLevel();
|
|
|
$field = 'gift_level';
|
|
|
$product_type = 2;
|
|
|
$title = '礼包团队奖励';
|
|
|
+ $performance_ratio = systemConfig('gift_pack_ratio',10);
|
|
|
}
|
|
|
// case 1:
|
|
|
// $model = new OilLevel();
|
|
|
@@ -1469,9 +1476,9 @@ class StoreOrderRepository extends BaseRepository
|
|
|
// $name = '礼包';
|
|
|
// $title = '礼包积分分红';
|
|
|
// break;
|
|
|
-
|
|
|
+ $performance_ratio = bcmul($performance_ratio,0.01,2);
|
|
|
$level = $model->where('award_ratio', '>', 0)->select();
|
|
|
- $price = bcmul($order['pay_price'], 0.1, 2); //分红金额
|
|
|
+ $price = bcmul($order['pay_price'], $performance_ratio, 2); //分红金额
|
|
|
$integral_price = app()->make(AwardIntegralPriceRepository::class)->awardIntegralPrice(); //分红积分价格
|
|
|
foreach ($level as $k => $v) { //遍历等级
|
|
|
$all_performance = 0; //总业绩
|