|
|
@@ -869,9 +869,9 @@ class StoreOrder extends BaseModel
|
|
|
}
|
|
|
if ($user['level'] < 2) $user['level'] = 2;
|
|
|
|
|
|
- }else if ($product['price'] == 199 and $product['cate_id'] == 2){
|
|
|
+ }else if ($product['price'] >= 199 and $product['cate_id'] == 2){
|
|
|
if ($order['pay_type'] != 'yue'){
|
|
|
- if ($user['spread_uid']) self::superior($user['spread_uid'],$user['nickname']);
|
|
|
+ if ($user['spread_uid']) self::superior($user['spread_uid'],$user['nickname'], $product['price']);
|
|
|
}
|
|
|
if ($user['level'] < 1) $user['level'] = 1;
|
|
|
}else if ($product['cate_id'] == 4){
|
|
|
@@ -930,35 +930,64 @@ class StoreOrder extends BaseModel
|
|
|
* @throws DbException
|
|
|
* @throws ModelNotFoundException
|
|
|
*/
|
|
|
- public static function superior($uid,$nickname)
|
|
|
+ public static function superior($uid,$nickname,$prices)
|
|
|
{
|
|
|
$top1 = User::where('uid', $uid)->find(); // 一级上级
|
|
|
$price = 0;
|
|
|
- if ($top1['level'] == 1){
|
|
|
- $top1['brokerage_price'] += 20;
|
|
|
- $price = 20;
|
|
|
-
|
|
|
- }elseif ($top1['level'] == 2){
|
|
|
- $top1['brokerage_price'] += 50;
|
|
|
- $price = 50;
|
|
|
- }
|
|
|
- if ($price < 50){
|
|
|
- if ($top1['spread_uid']){
|
|
|
- $user = getParent($top1['uid']);
|
|
|
- if ($user){
|
|
|
- foreach ($user as $v){
|
|
|
- $top = User::where('uid', $v)->find();
|
|
|
- $top['brokerage_price'] += 30;
|
|
|
- $top->save();
|
|
|
- UserBill::income('佣金', $top['uid'], 'now_money', 'brokerage', 90, 0, $top['brokerage_price'], '用户'.$nickname.'购买礼包,间推399礼包奖励');
|
|
|
+ if ($prices >= 199 and $prices < 399){
|
|
|
+ if ($top1['level'] == 1){
|
|
|
+ $top1['brokerage_price'] += 20;
|
|
|
+ $price = 20;
|
|
|
+
|
|
|
+ }elseif ($top1['level'] == 2){
|
|
|
+ $top1['brokerage_price'] += 50;
|
|
|
+ $price = 50;
|
|
|
+ }
|
|
|
+ if ($price < 50){
|
|
|
+ if ($top1['spread_uid']){
|
|
|
+ $user = getParent($top1['uid']);
|
|
|
+ if ($user){
|
|
|
+ foreach ($user as $v){
|
|
|
+ $top = User::where('uid', $v)->find();
|
|
|
+ $top['brokerage_price'] += 30;
|
|
|
+ $top->save();
|
|
|
+ UserBill::income('佣金', $top['uid'], 'now_money', 'brokerage', 30, 0, $top['brokerage_price'], '用户'.$nickname.'购买礼包,间推'.$prices.'礼包奖励');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if ($price > 0){
|
|
|
+ $top1->save();
|
|
|
+ UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', $price, 0, $top1['brokerage_price'], '用户'.$nickname.'购买礼包,直推'.$prices.'礼包奖励');
|
|
|
+ }
|
|
|
+ }elseif ($prices >= 399){
|
|
|
+ if ($top1['level'] == 1){
|
|
|
+ $top1['brokerage_price'] += 20;
|
|
|
+ $price = 50;
|
|
|
+
|
|
|
+ }elseif ($top1['level'] == 2){
|
|
|
+ $top1['brokerage_price'] += 50;
|
|
|
+ $price = 200;
|
|
|
+ }
|
|
|
+ if ($price <= 50){
|
|
|
+ if ($top1['spread_uid']){
|
|
|
+ $user = getParent($top1['uid']);
|
|
|
+ if ($user){
|
|
|
+ foreach ($user as $v){
|
|
|
+ $top = User::where('uid', $v)->find();
|
|
|
+ $top['brokerage_price'] += 150;
|
|
|
+ $top->save();
|
|
|
+ UserBill::income('佣金', $top['uid'], 'now_money', 'brokerage', 150, 0, $top['brokerage_price'], '用户'.$nickname.'购买礼包,间推'.$prices.'礼包奖励');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($price > 0){
|
|
|
+ $top1->save();
|
|
|
+ UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', $price, 0, $top1['brokerage_price'], '用户'.$nickname.'购买礼包,直推'.$prices.'礼包奖励');
|
|
|
+ }
|
|
|
}
|
|
|
- if ($price > 0){
|
|
|
- $top1->save();
|
|
|
- UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', $price, 0, $top1['brokerage_price'], '用户'.$nickname.'购买礼包,直推399礼包奖励');
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|