|
|
@@ -7,7 +7,6 @@
|
|
|
|
|
|
namespace app\models\store;
|
|
|
|
|
|
-use app\admin\model\store\StoreProductCate;
|
|
|
use app\admin\model\system\ShippingTemplatesFree;
|
|
|
use app\admin\model\system\ShippingTemplatesRegion;
|
|
|
use app\models\store\StoreProductReturnLog;
|
|
|
@@ -835,7 +834,7 @@ class StoreOrder extends BaseModel
|
|
|
*/
|
|
|
public static function backGroupAward($order): bool
|
|
|
{
|
|
|
-// return true;
|
|
|
+ return true;
|
|
|
//TODO 营销产品不返佣金
|
|
|
if (isset($orderInfo['combination_id']) && $orderInfo['combination_id']) return true;
|
|
|
if (isset($orderInfo['seckill_id']) && $orderInfo['seckill_id']) return true;
|
|
|
@@ -849,19 +848,11 @@ class StoreOrder extends BaseModel
|
|
|
if (!$user_level_id) $user_level_id = 0;
|
|
|
$last_price = [];
|
|
|
$cartNum = [];
|
|
|
- $sum_sp = ['real' => 0, 'virtual' => 0];
|
|
|
foreach ($cartInfo as $value) {
|
|
|
$product = json_decode($value, true);
|
|
|
if (isset($product['productInfo'])) {
|
|
|
-
|
|
|
$productInfo = $product['productInfo'];
|
|
|
$cartNum[$product['id']] = $product['cart_num'] ?? 0;
|
|
|
-
|
|
|
- $cates = StoreProductCate::where('product_id', $product['product_id'])->column('cate_id');
|
|
|
- if (in_array(49, $cates)) {
|
|
|
- $sum_sp[(isset($productInfo['store_type']) && $productInfo['store_type'] == 1 ? 'real' : 'virtual')] += $cartNum[$product['id']];
|
|
|
- }
|
|
|
-
|
|
|
if (isset($productInfo['attrInfo'])) {
|
|
|
$attrInfo = $productInfo['attrInfo'];
|
|
|
$level_price = json_decode($attrInfo['level_price'] ?? '', true);
|
|
|
@@ -951,21 +942,20 @@ class StoreOrder extends BaseModel
|
|
|
|
|
|
if ($this_price == $last_price && $same == 0 && $user_level_id == $last_level) {
|
|
|
//平级奖
|
|
|
-// $brokeragePrice = bcmul($last_send['real'], bcdiv($level['same_level_award_ratio'], 100, 4), 8);
|
|
|
- $brokeragePrice = bcmul($sum_sp['real'], $level['same_level_award_ratio'], 2);
|
|
|
+ $brokeragePrice = bcmul($last_send['real'], bcdiv($level['same_level_award_ratio'], 100, 4), 8);
|
|
|
if ($brokeragePrice <= 0) {
|
|
|
$spread = User::getUserInfo($spread['spread_uid']);
|
|
|
continue;
|
|
|
}
|
|
|
- $mark = '用户' . $userInfo['nickname'] . '(' . $order['uid'] . ')' . '购买实体升级商品,获得团队平级奖励' . $brokeragePrice;
|
|
|
+ $mark = '用户' . $userInfo['nickname'] . '(' . $order['uid'] . ')' . '购买实体商品,获得团队平级奖励' . $brokeragePrice;
|
|
|
$res = $res && UserBill::income('获得商品平级奖', $spread['uid'], 'now_money', 'brokerage', $brokeragePrice, $order['id'], $spread['brokerage_price'], $mark, 0);
|
|
|
|
|
|
- $brokeragePrice = bcmul($sum_sp['virtual'], $level['same_level_award_ratio'], 2);
|
|
|
+ $brokeragePrice = bcmul($last_send['virtual'], bcdiv($level['same_level_award_ratio'], 100, 4), 8);
|
|
|
if ($brokeragePrice <= 0) {
|
|
|
$spread = User::getUserInfo($spread['spread_uid']);
|
|
|
continue;
|
|
|
}
|
|
|
- $mark = '用户' . $userInfo['nickname'] . '(' . $order['uid'] . ')' . '购买虚拟升级商品,获得团队平级奖励' . $brokeragePrice;
|
|
|
+ $mark = '用户' . $userInfo['nickname'] . '(' . $order['uid'] . ')' . '购买虚拟商品,获得团队平级奖励' . $brokeragePrice;
|
|
|
$res = $res && UserBill::income('获得商品平级奖', $spread['uid'], 'now_money', 'brokerage', $brokeragePrice, $order['id'], bcadd($spread['brokerage_price'], $brokeragePrice, 2), $mark);
|
|
|
Message::addMessage($order['uid'], $mark, 200);
|
|
|
$res = $res && User::where('uid', $spread['uid'])->inc('brokerage_price', $brokeragePrice)->update();
|