|
@@ -994,8 +994,9 @@ class StoreOrder extends BaseModel
|
|
|
}
|
|
}
|
|
|
} elseif ($parentLevel < $level_info['grade']) { //如果上上级等级大于上级,就获取自己等级返利的佣金
|
|
} elseif ($parentLevel < $level_info['grade']) { //如果上上级等级大于上级,就获取自己等级返利的佣金
|
|
|
@file_put_contents('quanju.txt', "-如果上上级等级大于上级,就获取自己等级返利的佣金\r\n", 8);
|
|
@file_put_contents('quanju.txt', "-如果上上级等级大于上级,就获取自己等级返利的佣金\r\n", 8);
|
|
|
- @file_put_contents('quanju.txt', "-如果上级高太多级,就把中间等级的奖励也都发了\r\n", 8);
|
|
|
|
|
$bc = bcsub($level_info['grade'],$parentLevel,2);
|
|
$bc = bcsub($level_info['grade'],$parentLevel,2);
|
|
|
|
|
+ @file_put_contents('quanju.txt', $bc."-如果上级高太多级,就把中间等级的奖励也都发了\r\n", 8);
|
|
|
|
|
+
|
|
|
// StoreProductLevel::where('product_id',$)
|
|
// StoreProductLevel::where('product_id',$)
|
|
|
$shopping_cart = $order['cart_id'];
|
|
$shopping_cart = $order['cart_id'];
|
|
|
// 先不考虑什么商品返现比例了
|
|
// 先不考虑什么商品返现比例了
|
|
@@ -1008,13 +1009,16 @@ class StoreOrder extends BaseModel
|
|
|
$level_ids = SystemUserLevel::where('grade', '>', $parentLevel)
|
|
$level_ids = SystemUserLevel::where('grade', '>', $parentLevel)
|
|
|
->where('grade', '<=', $level_info['grade'])
|
|
->where('grade', '<=', $level_info['grade'])
|
|
|
->column('id');
|
|
->column('id');
|
|
|
-
|
|
|
|
|
|
|
+ @file_put_contents('quanju.txt', json_encode($level_ids)."-中间等级的id\r\n", 8);
|
|
|
|
|
+
|
|
|
// 使用数据库max函数直接获取最高返现比例,性能更优
|
|
// 使用数据库max函数直接获取最高返现比例,性能更优
|
|
|
if (!empty($level_ids)) {
|
|
if (!empty($level_ids)) {
|
|
|
$product_radio = StoreProductLevel::where('product_id', $product_info['product_id'])
|
|
$product_radio = StoreProductLevel::where('product_id', $product_info['product_id'])
|
|
|
->where('level_id', 'in', $level_ids)
|
|
->where('level_id', 'in', $level_ids)
|
|
|
->where('type', 1)
|
|
->where('type', 1)
|
|
|
->sum('rebate_ratio');
|
|
->sum('rebate_ratio');
|
|
|
|
|
+ @file_put_contents('quanju.txt', $product_radio."-总和比例\r\n", 8);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
$product = StoreProductLevel::where('product_id', $product_info['product_id'])
|
|
$product = StoreProductLevel::where('product_id', $product_info['product_id'])
|