|
|
@@ -1306,16 +1306,16 @@ class StoreOrderRepository extends BaseRepository
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-// 上级推荐奖励的分红积分
|
|
|
+// 上级推荐奖励的分红积分 不用积分了 直接加到佣金里
|
|
|
public function getSpreadIntegral($order, $type, $user, $product_id)
|
|
|
{
|
|
|
- $price = app()->make(AwardIntegralPriceRepository::class)->awardIntegralPrice(); //分红积分价格
|
|
|
- @file_put_contents('quanju.txt', json_encode($price) . "-积分金额3\r\n", 8);
|
|
|
+// $price = app()->make(AwardIntegralPriceRepository::class)->awardIntegralPrice(); //分红积分价格
|
|
|
+// @file_put_contents('quanju.txt', json_encode($price) . "-积分金额3\r\n", 8);
|
|
|
// $spread_uid = User::where('uid', $order['uid'])->value('spread_uid');
|
|
|
$order_award_range = 0;
|
|
|
if ($user['spread_uid'] > 0) {
|
|
|
$make = app()->make(UserBillRepository::class);
|
|
|
- $award_range = User::where('uid', $user['spread_uid'])->value('award_range');
|
|
|
+// $award_range = User::where('uid', $user['spread_uid'])->value('award_range');
|
|
|
// if ($award_range<=0){ //上级没有分红额度就转到冻结资金里
|
|
|
//
|
|
|
//
|
|
|
@@ -1323,35 +1323,37 @@ class StoreOrderRepository extends BaseRepository
|
|
|
$after = 0;
|
|
|
switch ($type) {
|
|
|
case 0: //普通商品
|
|
|
- $award_integral = User::where('uid', $user['spread_uid'])->value('award_integral');
|
|
|
+// $award_integral = User::where('uid', $user['spread_uid'])->value('award_integral');
|
|
|
+ $award_integral = User::where('uid', $user['spread_uid'])->value('brokerage_price');
|
|
|
$order_award_range = bcmul($order['pay_price'], 0.06, 2);
|
|
|
if ($order_award_range > 0) {
|
|
|
- $order_award_range = bcdiv($order_award_range, $price['price'], 2); //业绩除以积分价格得到分红积分
|
|
|
+// $order_award_range = bcdiv($order_award_range, $price['price'], 2); //业绩除以积分价格得到分红积分
|
|
|
$after = bcadd($award_integral, $order_award_range, 2);
|
|
|
- $make->incBill($user['spread_uid'], 'award_integral', 'ordinary_integral', [
|
|
|
+ $make->incBill($user['spread_uid'], 'brokerage', 'ordinary_brokerage', [
|
|
|
'number' => $order_award_range,
|
|
|
- 'title' => '团队普通商品分红积分',
|
|
|
+ 'title' => '团队普通商品分红奖金',
|
|
|
'balance' => $after,
|
|
|
'status' => 1,
|
|
|
'link_id' => $order['order_id'],
|
|
|
- 'mark' => $user['nickname'] . '成功消费普通商品' . floatval($order['pay_price']) . '元,奖励上级分红积分' . $order_award_range . '(积分价格:' . $price['price'] . ')',
|
|
|
+ 'mark' => $user['nickname'] . '成功消费普通商品' . floatval($order['pay_price']) . '元,奖励上级分红奖金' . $order_award_range,
|
|
|
]);
|
|
|
}
|
|
|
@file_put_contents('quanju.txt', "-村上春树78\r\n", 8);
|
|
|
break;
|
|
|
case 5: //节能油商品
|
|
|
- $award_integral = User::where('uid', $user['spread_uid'])->value('award_integral');
|
|
|
+// $award_integral = User::where('uid', $user['spread_uid'])->value('award_integral');
|
|
|
+ $award_integral = User::where('uid', $user['spread_uid'])->value('brokerage_price');
|
|
|
$order_award_range = bcmul($order['pay_price'], 0.06, 2);
|
|
|
if ($order_award_range > 0) {
|
|
|
- $order_award_range = bcdiv($order_award_range, $price['price'], 2); //业绩除以积分价格得到分红积分
|
|
|
+// $order_award_range = bcdiv($order_award_range, $price['price'], 2); //业绩除以积分价格得到分红积分
|
|
|
$after = bcadd($award_integral, $order_award_range, 2);
|
|
|
- $make->incBill($user['spread_uid'], 'award_integral', 'spread_oil_integral', [
|
|
|
+ $make->incBill($user['spread_uid'], 'brokerage', 'spread_oil_brokerage', [
|
|
|
'number' => $order_award_range,
|
|
|
- 'title' => '团队节能油订单分红积分',
|
|
|
+ 'title' => '团队节能油订单分红奖金',
|
|
|
'balance' => $after,
|
|
|
'status' => 1,
|
|
|
'link_id' => $order['order_id'],
|
|
|
- 'mark' => $user['nickname'] . '成功消费节能油商品' . floatval($order['pay_price']) . '元,奖励分红积分' . $order_award_range . '(积分价格:' . $price['price'] . ')',
|
|
|
+ 'mark' => $user['nickname'] . '成功消费节能油商品' . floatval($order['pay_price']) . '元,奖励上级分红奖金' . $order_award_range,
|
|
|
]);
|
|
|
}
|
|
|
@file_put_contents('quanju.txt', "-村上春树5\r\n", 8);
|
|
|
@@ -1363,7 +1365,8 @@ class StoreOrderRepository extends BaseRepository
|
|
|
// @file_put_contents('quanju.txt', $pack_count. "-礼包数加一\r\n", 8);
|
|
|
$remainder = bcmod($pack_count, 3); //取余
|
|
|
@file_put_contents('quanju.txt', $remainder . "-取余\r\n", 8);
|
|
|
- $award_integral = User::where('uid', $user['spread_uid'])->value('award_integral');
|
|
|
+// $award_integral = User::where('uid', $user['spread_uid'])->value('award_integral');
|
|
|
+ $award_integral = User::where('uid', $user['spread_uid'])->value('brokerage_price');
|
|
|
switch ($remainder) {
|
|
|
case 1:
|
|
|
$order_award_range = bcmul($order['pay_price'], 0.2, 2);
|
|
|
@@ -1376,26 +1379,27 @@ class StoreOrderRepository extends BaseRepository
|
|
|
break;
|
|
|
}
|
|
|
if ($order_award_range > 0) {
|
|
|
- $order_award_range = bcdiv($order_award_range, $price['price'], 2); //业绩除以积分价格得到分红积分
|
|
|
+// $order_award_range = bcdiv($order_award_range, $price['price'], 2); //业绩除以积分价格得到分红积分
|
|
|
$after = bcadd($award_integral, $order_award_range, 2);
|
|
|
- $make->incBill($user['spread_uid'], 'award_integral', 'spread_oil_integral', [
|
|
|
+ $make->incBill($user['spread_uid'], 'brokerage', 'spread_oil_brokerage', [
|
|
|
'number' => $order_award_range,
|
|
|
- 'title' => '团队礼包订单分红积分',
|
|
|
+ 'title' => '团队礼包订单分红奖金',
|
|
|
'balance' => $after,
|
|
|
'status' => 1,
|
|
|
'link_id' => $order['order_id'],
|
|
|
- 'mark' => $user['nickname'] . '成功消费礼包商品' . floatval($order['pay_price']) . '元,奖励分红积分' . $order_award_range . '(积分价格:' . $price['price'] . ')',
|
|
|
+ 'mark' => $user['nickname'] . '成功消费礼包商品' . floatval($order['pay_price']) . '元,奖励上级分红奖金' . $order_award_range,
|
|
|
]);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
if ($after > 0) {
|
|
|
- User::where('uid', $user['spread_uid'])->update(['award_integral' => $after]);
|
|
|
- }
|
|
|
- if ($order_award_range > 0) {//检查上级积分是否达到提现条件
|
|
|
- $UserRepository = app()->make(UserRepository::class);
|
|
|
- $UserRepository->checkAward($user['spread_uid']);
|
|
|
+// User::where('uid', $user['spread_uid'])->update(['award_integral' => $after]);
|
|
|
+ User::where('uid', $user['spread_uid'])->update(['brokerage_price' => $after]);
|
|
|
}
|
|
|
+// if ($order_award_range > 0) {//检查上级积分是否达到提现条件
|
|
|
+// $UserRepository = app()->make(UserRepository::class);
|
|
|
+// $UserRepository->checkAward($user['spread_uid']);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
// $spread= User::where('uid', $user['spread_uid'])->find();
|