|
|
@@ -924,22 +924,25 @@ class StoreOrder extends BaseModel
|
|
|
@file_put_contents('quanju.txt', json_encode($user_radio) . "-会员等级激励奖报错内容4\r\n", 8);
|
|
|
|
|
|
$rebate = bcmul($order['pay_price'], bcdiv($user_radio, 100, 2), 2); //用户返现金额
|
|
|
- $blance = bcadd($userInfo['brokerage_price'], $rebate, 2); //用户佣金
|
|
|
- @file_put_contents('quanju.txt', json_encode(['line' => $rebate, 'message' => $order['id'], 'file' => $blance]) . "-会员等级激励奖报错内容2\r\n", 8);
|
|
|
+ if ($rebate > 0){
|
|
|
+ $blance = bcadd($userInfo['brokerage_price'], $rebate, 2); //用户佣金
|
|
|
+ @file_put_contents('quanju.txt', json_encode(['line' => $rebate, 'message' => $order['id'], 'file' => $blance]) . "-会员等级激励奖报错内容2\r\n", 8);
|
|
|
|
|
|
// var_dump($rebate, $order['id'], $blance);
|
|
|
//die();
|
|
|
- if ($type == 1) {
|
|
|
- UserBill::income('会员返利', $uid, 'brokerage_price', 'level_money', $rebate, $order['id'], $blance, '会员返利佣金');
|
|
|
- if ($userInfo['spread_uid'] > 0) {
|
|
|
- self::userLevelReward($order, $userInfo['spread_uid'], 2);
|
|
|
+ if ($type == 1) {
|
|
|
+ UserBill::income('会员返利', $uid, 'brokerage_price', 'level_money', $rebate, $order['id'], $blance, '会员返利佣金');
|
|
|
+ if ($userInfo['spread_uid'] > 0) {
|
|
|
+ self::userLevelReward($order, $userInfo['spread_uid'], 2);
|
|
|
+ }
|
|
|
+ } elseif ($type == 2) { //下级推荐返利
|
|
|
+ UserBill::income('下级会员返利', $uid, 'brokerage_price', 'level_money', $rebate, $order['id'], $blance, '下级购买商品的会员返利佣金');
|
|
|
+ return true;
|
|
|
}
|
|
|
- } elseif ($type == 2) { //下级推荐返利
|
|
|
- UserBill::income('下级会员返利', $uid, 'brokerage_price', 'level_money', $rebate, $order['id'], $blance, '下级购买商品的会员返利佣金');
|
|
|
- return true;
|
|
|
- }
|
|
|
- User::where('uid',$uid)->update(['brokerage_price'=>$blance]);
|
|
|
+ User::where('uid',$uid)->update(['brokerage_price'=>$blance]);
|
|
|
|
|
|
+ }
|
|
|
+ $rebate=0;
|
|
|
$userInfo = User::get($uid);
|
|
|
@file_put_contents('quanju4.txt',$order['cart_id'] . "-购物车id\r\n", 8);
|
|
|
// $shopping_cart = json_decode($order['cart_id'], true);
|
|
|
@@ -947,27 +950,33 @@ class StoreOrder extends BaseModel
|
|
|
// 先不考虑什么商品返现比例了
|
|
|
foreach ($shopping_cart as $cart) {
|
|
|
@file_put_contents('quanju4.txt',$cart . "-购物车id\r\n", 8);
|
|
|
-
|
|
|
+ $product_radio=0;
|
|
|
$product_info = StoreCart::get($cart['cart_id']);
|
|
|
$product = StoreProduct::where('id', $product_info['product_id'])->find(); //商品返现比例
|
|
|
- $product_radio = $product['rebate_ratio'];
|
|
|
+ if (!empty($product)){
|
|
|
+ $product = $product->toArray();
|
|
|
+ $product_radio = $product['rebate_ratio'];
|
|
|
+ }
|
|
|
+ @file_put_contents('quanju.txt', json_encode($product) . "-商品详情\r\n", 8);
|
|
|
+
|
|
|
+
|
|
|
if ($product_radio>0){
|
|
|
- @file_put_contents('quanju.txt', json_encode($user_radio) . "-会员等级激励奖报错内容4\r\n", 8);
|
|
|
+ @file_put_contents('quanju.txt', $user_radio . "-会员等级激励奖报错内容4\r\n", 8);
|
|
|
|
|
|
$rebate = bcmul($order['pay_price'], bcdiv($user_radio, 100, 2), 2); //用户返现金额
|
|
|
- $blance = bcadd($userInfo['brokerage_price'], $rebate, 2); //用户佣金
|
|
|
- @file_put_contents('quanju.txt', json_encode(['line' => $rebate, 'message' => $order['id'], 'file' => $blance]) . "-会员等级激励奖报错内容2\r\n", 8);
|
|
|
-
|
|
|
-// var_dump($rebate, $order['id'], $blance);
|
|
|
-//die();
|
|
|
- if ($type == 1) {
|
|
|
- UserBill::income('商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '商品返利佣金');
|
|
|
- if ($userInfo['spread_uid'] > 0) {
|
|
|
- self::userLevelReward($order, $userInfo['spread_uid'], 2);
|
|
|
+ if ($rebate>0){
|
|
|
+ $blance = bcadd($userInfo['brokerage_price'], $rebate, 2); //用户佣金
|
|
|
+ @file_put_contents('quanju.txt', json_encode(['line' => $rebate, 'message' => $order['id'], 'file' => $blance]) . "-会员等级激励奖报错内容2\r\n", 8);
|
|
|
+
|
|
|
+ if ($type == 1) {
|
|
|
+ UserBill::income('商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '商品返利佣金');
|
|
|
+ if ($userInfo['spread_uid'] > 0) {
|
|
|
+ self::userLevelReward($order, $userInfo['spread_uid'], 2);
|
|
|
+ }
|
|
|
+ } elseif ($type == 2) { //下级推荐返利
|
|
|
+ UserBill::income('下级商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '下级购买商品的商品返利佣金');
|
|
|
+ return true;
|
|
|
}
|
|
|
- } elseif ($type == 2) { //下级推荐返利
|
|
|
- UserBill::income('下级商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '下级购买商品的商品返利佣金');
|
|
|
- return true;
|
|
|
}
|
|
|
}
|
|
|
}
|