wupengfei 3 年之前
父節點
當前提交
e363aee429
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11 4
      addons/shopro/controller/LmtLevel.php

+ 11 - 4
addons/shopro/controller/LmtLevel.php

@@ -50,10 +50,12 @@ class LmtLevel extends Base
         $goods_arr = OrderItem::getOrderGoods($order_id);
         // 特殊商品赠送名额 start
         $quota = [];
+        $special_goods =  0;
         foreach ($goods_arr as $gv) {
             // 购买身份商品
             if(in_array($gv['goods_id'],$this->special_goods)) {
                 $q_num = $gv['goods_id'] == $this->special_goods[0] ? 1:10;
+                $special_goods  = $this->special_goods[0] ? 1:10;
                 $q_num = $q_num * $gv['goods_num'];// 赠送数量
                 $quota[]=[
                     'user_id' =>  $order_info['user_id'],
@@ -112,10 +114,15 @@ class LmtLevel extends Base
             foreach ($recom_list as $ck=>$cv) {
                 // 推荐线奖励条件
                 if($cv['level'] > $current_lev ){
-                    // 等级差率
-                    $rate = bcsub($this->lev_set[$current_lev]['discount'],$this->lev_set[$cv['level']]['discount'],2);
-                    $cl_rete = $rate > 0 ? $rate : 0;
-                    $qf_money = bcmul($order_info['total_fee'],$cl_rete/10,2);
+                    if($special_goods) {
+                        $qf_money = bcsub($this->lev_set[$current_lev]['price'],$this->lev_set[$cv['level']]['price'],2) * $special_goods;
+                    }else{
+                        // 等级差率
+                        $rate = bcsub($this->lev_set[$current_lev]['discount'],$this->lev_set[$cv['level']]['discount'],2);
+                        $cl_rete = $rate > 0 ? $rate : 0;
+                        $qf_money = bcmul($order_info['total_fee'],$cl_rete/10,2);
+                    }
+
                     $current_lev = $ck;
                     if($qf_money > 0){
                         $res = User::money($qf_money, $cv['id'], 'recommend', 0 , '推荐线奖励',['order_id'=>$order_id,'from_user'=>$user_info['id']]);