|
@@ -927,31 +927,53 @@ class StoreOrder extends BaseModel
|
|
|
$blance = bcadd($userInfo['brokerage_price'], $rebate, 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);
|
|
@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();
|
|
|
|
|
|
|
+// var_dump($rebate, $order['id'], $blance);
|
|
|
|
|
+//die();
|
|
|
if ($type == 1) {
|
|
if ($type == 1) {
|
|
|
- UserBill::income('商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '商品返利佣金');
|
|
|
|
|
|
|
+ UserBill::income('会员返利', $uid, 'brokerage_price', 'level_money', $rebate, $order['id'], $blance, '会员返利佣金');
|
|
|
if ($userInfo['spread_uid'] > 0) {
|
|
if ($userInfo['spread_uid'] > 0) {
|
|
|
self::userLevelReward($order, $userInfo['spread_uid'], 2);
|
|
self::userLevelReward($order, $userInfo['spread_uid'], 2);
|
|
|
}
|
|
}
|
|
|
} elseif ($type == 2) { //下级推荐返利
|
|
} elseif ($type == 2) { //下级推荐返利
|
|
|
- UserBill::income('下级商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '下级购买商品返利佣金');
|
|
|
|
|
|
|
+ UserBill::income('下级会员返利', $uid, 'brokerage_price', 'level_money', $rebate, $order['id'], $blance, '下级购买商品的会员返利佣金');
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
+ User::where('uid',$uid)->update(['brokerage_price'=>$blance]);
|
|
|
|
|
|
|
|
-// $rebate = 0;
|
|
|
|
|
-// $shopping_cart = json_decode($order['cart_id'], true);
|
|
|
|
|
|
|
+ $userInfo = User::get($uid);
|
|
|
|
|
+
|
|
|
|
|
+ $shopping_cart = json_decode($order['cart_id'], true);
|
|
|
// 先不考虑什么商品返现比例了
|
|
// 先不考虑什么商品返现比例了
|
|
|
-// foreach ($shopping_cart as $cart) {
|
|
|
|
|
-// $product_info = StoreCart::get($cart['cart_id']);
|
|
|
|
|
-// $product_radio = StoreProduct::where('id', $product_info['product_id'])->find(); //商品返现比例
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ foreach ($shopping_cart as $cart) {
|
|
|
|
|
+ $product_info = StoreCart::get($cart['cart_id']);
|
|
|
|
|
+ $product = StoreProduct::where('id', $product_info['product_id'])->find(); //商品返现比例
|
|
|
|
|
+ $product_radio = $product['rebate_ratio'];
|
|
|
|
|
+ if ($product_radio>0){
|
|
|
|
|
+ @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);
|
|
|
|
|
+
|
|
|
|
|
+// 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ } elseif ($type == 2) { //下级推荐返利
|
|
|
|
|
+ UserBill::income('下级商品返利', $uid, 'brokerage_price', 'order_money', $rebate, $order['id'], $blance, '下级购买商品的商品返利佣金');
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ User::where('uid',$uid)->update(['brokerage_price'=>$blance]);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}catch (\Exception $e) {
|
|
}catch (\Exception $e) {
|
|
|
// 处理异常
|
|
// 处理异常
|
|
|
- @file_put_contents('quanju.txt', json_encode(['line' => $e->getLine(), 'message' => $e->getMessage(), 'file' => $e->getFile()]) . "-会员等级激励奖报错内容\r\n", 8);
|
|
|
|
|
|
|
+ @file_put_contents('quanju4.txt', json_encode(['line' => $e->getLine(), 'message' => $e->getMessage(), 'file' => $e->getFile()]) . "-会员等级激励奖报错内容\r\n", 8);
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|