Bladeren bron

add to local

stanley-king 6 jaren geleden
bovenliggende
commit
17fa6c6ad3

+ 9 - 0
core/lrlz.php

@@ -111,5 +111,14 @@ function isBonusExpiryDate()
 {
     return (defined('BONUS_EXPIRY_DATE') && BONUS_EXPIRY_DATE == true);
 }
+function isUseBonusRate() {
+    return (defined('USE_BONUS_RATE') && USE_BONUS_RATE == true);
+}
+function noBonusRate() {
+    return (defined('USE_BONUS_RATE') && USE_BONUS_RATE == false);
+}
+function defaultBonusRate() {
+    return 30;
+}
 
 ?>

+ 1 - 0
crontab/control/command.php

@@ -14,6 +14,7 @@ require_once(BASE_ROOT_PATH . '/helper/predeposit_helper.php');
 require_once(BASE_DATA_PATH . '/mobile/omsid.php');
 require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/bonus/witholder.php');
+require_once (BASE_ROOT_PATH . '/helper/bonus/norate_holder.php');
 require_once(BASE_ROOT_PATH . '/helper/notify_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/account_helper.php');
 require_once(BASE_ROOT_PATH . '/data/mobile/lrlz_staff.php');

+ 10 - 18
data/model/member.model.php

@@ -607,30 +607,22 @@ class memberModel extends Model
 
     /**
      * @param $user_id  用户ID
-     * @return array  获取用户预存款, 冻结预存款金额
+     * @return array|bool  获取用户预存款, 冻结预存款金额
      */
     public function getMemberPdInfo($member_id)
     {
         //查询会员信息
         $member_id = intval($member_id);
-        $member_info = $this->getMemberInfo(array('member_id'=>$member_id));
-
-        if (!is_array($member_info) || count($member_info)<=0){
-            return 0;  // 用户信息不对
-        }
-
-        $available_predeposit=floatval($member_info['available_predeposit']);
-        $freeze_predeposit=floatval($member_info['freeze_predeposit']);
-        $available_relay_balance=floatval($member_info['available_relay_balance']);
-        $freeze_relay_balance=floatval($member_info['freeze_relay_balance']);
-        $rate_version = intval($member_info['rate_version']);
-
-        return array('available_predeposit' => $available_predeposit,
-            'freeze_predeposit' => $freeze_predeposit,
-            'available_relay_balance' => $available_relay_balance,
-            'freeze_relay_balance' => $freeze_relay_balance,
-            'rate_version' => $rate_version);
+        $info = $this->getMemberInfo(['member_id'=>$member_id]);
+        if(empty($info)) return false;
+
+        return ['available_predeposit' => floatval($info['available_predeposit']),
+                'freeze_predeposit'    => floatval($info['freeze_predeposit']),
+                'available_bonus' => floatval($info['available_bonus']),
+                'freeze_bonus'    => floatval($info['freeze_bonus']),
+                'rate_version'    => intval($info['rate_version'])];
     }
+
     public function inc_rate_version($member_id)
     {
         $this->table('member')->where(array('member_id' => $member_id))->update(array('rate_version' => array('exp', "rate_version+1")));

+ 7 - 7
helper/bonus/manager.php

@@ -12,7 +12,6 @@ require_once(BASE_ROOT_PATH . '/helper/model_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/algorithm.php');
 require_once(BASE_ROOT_PATH . '/helper/util_helper.php');
 
-
 use session_helper;
 use member_info;
 use algorithm;
@@ -32,19 +31,20 @@ class manager
     const bonus_state_binded = 2; //已绑定手机
     const bonus_state_topuped= 3; //已经充值
 
+    const type_prefix = 'bonus_type';
+
     public function __construct() {
 
     }
 
-    const type_prefix = 'bonus_type';
-
     private function avatars($user_ids)
     {
         $result = [];
         $user_ids = array_unique($user_ids);
         $mod_member = Model('member');
-        $items = $mod_member->getMemberList(array('member_id' => array('in',$user_ids)));
-        foreach ($items as $item) {
+        $items = $mod_member->getMemberList(['member_id' => ['in',$user_ids]]);
+        foreach ($items as $item)
+        {
             $member = new member_info($item);
             $uid = $member->member_id();
             $avatar = $member->avatar();
@@ -103,8 +103,8 @@ class manager
             $url = BASE_SITE_URL . "/mobile/index.php?act=bonusex&op=open&client_type=wap&type_sn={$type_sn}";
             $ret['url'] = $url;
 
-            $bonus_info = array('type_info' => $type_info,'binded_info' => $bonus_ex,'avatars' => $user_avatars);
-            wcache($type_sn,array('infos' => serialize($bonus_info)),self::type_prefix);
+            $bonus_info = ['type_info' => $type_info,'binded_info' => $bonus_ex,'avatars' => $user_avatars];
+            wcache($type_sn,['infos' => serialize($bonus_info)],self::type_prefix);
         }
         else {
             $bonus_info = unserialize($bonus_info['infos']);

+ 141 - 0
helper/bonus/norate_holder.php

@@ -0,0 +1,141 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 2018/8/23
+ * Time: 下午3:31
+ */
+
+namespace bonus;
+use bonus_helper;
+use QueueClient;
+
+class norate_holder
+{
+    private $member_id;
+    private $usable_amount; //可用红包总金额
+    private $mUsedType;
+    private $mod_bonus;
+    private $all_bonus;
+
+    public function __construct($member_id,$used_type)
+    {
+        $this->mod_bonus = Model('user_bonus');
+        $this->member_id = $member_id;
+        $this->usable_amount = 0.00;
+
+        $items = $this->mod_bonus->getUsableBonus($this->member_id);
+        $this->all_bonus = [];
+        foreach ($items as $item) {
+            $bonus = user_bonus::create_by_param($item);
+            $this->all_bonus[] = $bonus;
+            $this->usable_amount += $bonus->remain_amount();
+        }
+        $this->usable_amount = ($this->usable_amount * 100 + 0.5) / 100;
+        $this->mUsedType = $used_type;
+    }
+
+    public function usable_amount() {
+        return $this->usable_amount;
+    }
+
+    public function withold_bonus($rate,$bonus_sn,$money)
+    {
+        foreach ($this->all_bonus as $bonus)
+        {
+            if($bonus_sn == $bonus->bonus_sn())
+            {
+                $left  = intval($bonus->remain_amount() * 100 + 0.5);
+                $money = intval($money * 100 + 0.5);
+                $left = $left - $money;
+                $left = $left >= 0 ? $left / 100 : 0.00;
+                $rate = $bonus->bonus_rate();
+
+                $param = $bonus->get_param();
+                $param['remain_amount'] = $left;
+
+                if($this->mUsedType == bonus_helper::send_bonus_withold) {
+                    $send = intval($bonus->send_amount() * 100 + 0.5);
+                    $send = $send + $money;
+                    $send = $send / 100;
+                    $param['send_amount'] = $send;
+                }
+                elseif($this->mUsedType == bonus_helper::pay_order_withold) {
+                    $paied = intval($bonus->pay_amount() * 100 + 0.5);
+                    $paied = $paied + $money;
+                    $paied = $paied / 100;
+                    $param['pay_amount'] = $paied;
+                }
+                else {
+
+                }
+                QueueClient::push("onUseBonus",['time' => time(),'use_type' => $this->mUsedType,'rate' => $rate,'amount' => $money / 100,'member_id' => $this->member_id]);
+                $this->mod_bonus->replace($param);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public function withold($rate,$money)
+    {
+        $left_cent = intval($this->usable_amount * 100 + 0.5);
+        $money_cent = intval($money * 100 + 0.5);
+
+        if($money_cent <= 0 || $left_cent <= 0  || $left_cent <= $money_cent) {
+            return false;
+        }
+
+        $left = $money_cent;
+
+        $datas = [];
+        foreach ($this->all_bonus as $bonus)
+        {
+            if($left <= 0) break;
+            if($this->mUsedType == bonus_helper::send_bonus_withold && $bonus->can_share() == false) {
+                continue;
+            }
+
+            $rate = $bonus->bonus_rate();
+            $param  = $bonus->get_param();
+            $remain = $bonus->remain_amount();
+            $remain = intval($remain * 100 + 0.5);
+
+            if($left >= $remain) {
+                $left -= $remain;
+                $param['remain_amount'] = 0.00;
+                $used = $remain;
+            } else {
+                $remain -= $left;
+                $param['remain_amount'] = $remain / 100;
+                $used = $left;
+                $left = 0;
+            }
+
+            if($this->mUsedType == bonus_helper::send_bonus_withold) {
+                $send = intval($bonus->send_amount() * 100 + 0.5);
+                $send = $send + $used;
+                $send = $send / 100;
+                $param['send_amount'] = $send;
+            }
+            elseif($this->mUsedType == bonus_helper::pay_order_withold) {
+                $paied = intval($bonus->pay_amount() * 100 + 0.5);
+                $paied = $paied + $used;
+                $paied = $paied / 100;
+                $param['pay_amount'] = $paied;
+            }
+            else {
+
+            }
+
+            QueueClient::push("onUseBonus",['time' => time(),'use_type' => $this->mUsedType,'rate' => $rate,'amount' => $used / 100,'member_id' => $this->member_id]);
+            array_push($datas,$param);
+        }
+
+        if(!empty($datas)) {
+            $this->mod_bonus->replaceAll($datas);
+        }
+
+        return true;
+    }
+}

+ 0 - 5
helper/bonus/user_bonus.php

@@ -67,11 +67,9 @@ class user_bonus
     public function can_share() {
         return intval($this->mParamer['can_share']) == 1;
     }
-
     public function client_can_share() {
         return (!$this->expired() && $this->can_share() && $this->spend_over() == false && $this->isBinded());
     }
-
     public function can_shake() {
         $status = intval($this->mParamer['bonus_status']);
         return ($status == self::GrabStatus || $status == self::BindStatus);
@@ -80,7 +78,6 @@ class user_bonus
         $usable_time = intval($this->mParamer['usable_time']);
         return ($usable_time <= time());
     }
-
     public function remain_amount() {
         $val = intval(doubleval($this->mParamer['remain_amount']) * 100 + 0.5);
         return doubleval($val) / 100;
@@ -93,12 +90,10 @@ class user_bonus
         $val = intval(doubleval($this->mParamer['send_amount']) * 100 + 0.5);
         return doubleval($val) / 100;
     }
-
     public function spend_over() {
         $remain = intval(doubleval($this->mParamer['remain_amount']) * 100 + 0.5);
         return ($remain == 0);
     }
-
     public function type_sn() {
         return $this->mParamer['type_sn'];
     }

+ 13 - 3
helper/bonus_helper.php

@@ -21,6 +21,8 @@ require_once (BASE_ROOT_PATH . '/helper/bonus/manager.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/shaker.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/allocator.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/witholder.php');
+require_once (BASE_ROOT_PATH . '/helper/bonus/norate_holder.php');
+require_once (BASE_ROOT_PATH . '/helper/bonus/norate_holder.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/open_sharer.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/scaler.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/thief_vilator.php');
@@ -286,7 +288,7 @@ class bonus_helper
     {
         $fsuccess =  true;
         $total = 0.00;
-        $holder = new bonus\witholder($member_id,$used_type);
+        $holder = self::create_holder($member_id,$used_type);
         foreach ($rates as $rate => $money)
         {
             if($holder->withold($rate,$money) == true) {
@@ -306,7 +308,7 @@ class bonus_helper
 
     static public function withold_money($member_id,$rate,$money,$used_type)
     {
-        $holder = new bonus\witholder($member_id,$used_type);
+        $holder = self::create_holder($member_id,$used_type);
         if($holder->withold($rate,$money) == false) {
             Log::record("withold user member_id={$member_id} money={$money}.",Log::ERR);
         }
@@ -315,7 +317,7 @@ class bonus_helper
 
     static public function withold_bonus($member_id,$bonus_sn,$rate,$money,$used_type)
     {
-        $holder = new bonus\witholder($member_id,$used_type);
+        $holder = self::create_holder($member_id,$used_type);
         return $holder->withold_bonus($rate,$bonus_sn,$money);
     }
 
@@ -409,4 +411,12 @@ class bonus_helper
         $scaler = new bonus\scaler($rate_moneys);
         return $scaler->calc();
     }
+    static private function create_holder($member_id,$used_type)
+    {
+        if(isUseBonusRate()) {
+            return new bonus\witholder($member_id,$used_type);
+        } else {
+            return new bonus\norate_holder($member_id,$used_type);
+        }
+    }
 }

+ 164 - 15
helper/predeposit_helper.php

@@ -12,6 +12,16 @@ require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/account_helper.php');
 
 
+interface IMoneyCalc
+{
+    public function add_bonuses($items);
+    public function is_enough(&$rate,$amount);
+    public function with_hold($rate,$amount);
+    public function find_rate($amount);
+    public function format();
+    public function total();
+}
+
 class RateMoney
 {
     const ASC  = 1;
@@ -215,6 +225,144 @@ class RateMoney
     }
 }
 
+class BonusAmount
+{
+    const ASC  = 1;
+    const DESC = 2;
+    const PRED_RATE = 30;
+    private $mRates;
+    private $mDirty;
+    private $mAmount;
+
+    public function __construct($rates)
+    {
+        $this->mDirty = false;
+        $this->mAmount = 0.00;
+
+        $amount = 0.0;
+        foreach ($rates as $key => $val) {
+            $amount += $val;
+        }
+        $this->mAmount = intval(100 * $amount + 0.5) / 100;
+    }
+    public function add_bonuses($items)
+    {
+        foreach ($items as $item)
+        {
+            $bonus = \bonus\user_bonus::create_by_param($item);
+            $amount = intval($bonus->remain_amount() * 100 + 0.5) / 100;
+
+            if($amount <= 0) continue;
+            $this->mAmount += intval(100 * $amount + 0.5) / 100;
+            $this->mDirty = true;
+        }
+    }
+    public function is_enough(&$rate,$amount)
+    {
+        $rate = defaultBonusRate();
+        $amount = intval($amount * 100 + 0.5);
+        $tmp = intval($this->mAmount * 100 + 0.5);
+        return $tmp >= $amount;
+    }
+    public function with_hold($rate,$amount)
+    {
+        $this->mAmount -= ($amount * 100 + 0.5) / 100;
+        $this->mDirty = true;
+    }
+    public function find_rate($amount)
+    {
+        if($this->is_enough($rate,$amount)) {
+            return ['rate' => defaultBonusRate(),'amount' => intval($this->mAmount * 100 + 0.5) / 100];
+        } else {
+            $amount = intval($amount * 100 + 0.5);
+            return ['rate' => $rate,'amount' => $amount / 100];
+        }
+    }
+    public function format()
+    {
+        return [defaultBonusRate() => intval($this->mAmount * 100 + 0.5) / 100];
+    }
+    public function total()
+    {
+        return $this->mAmount;
+    }
+
+    public function dirty() {
+        return $this->mDirty;
+    }
+    public function clean() {
+        $this->mDirty = false;
+    }
+    public function calc_rates($amount)
+    {
+        $rates = [];
+
+        $left = intval($amount * 100 + 0.5);
+        foreach ($this->mRates as $rate => $total)
+        {
+            if($left <= 0) break;
+            if($rate > 100) continue;
+
+            $total = intval($total * 100 + 0.5);
+            if($total <= 0) {
+                continue;
+            }
+            else
+            {
+                if($total >= $left) {
+                    $rates[$rate] = $left / 100;
+                    $left = 0;
+                } else {
+                    $rates[$rate] = $total / 100;
+                    $left -= $total;
+                }
+            }
+        }
+        return $rates;
+    }
+
+    public function calc_money($price,&$rates)
+    {
+        $rates = [];
+        $disc = 0;
+        $left = intval($price * 100 + 0.5);
+        foreach ($this->mRates as $rate => $total)
+        {
+            if($left <= 0) break;
+            if($rate > 100) continue;
+
+            $total = intval($total * 100 + 0.5);
+            if($total <= 0) {
+                continue;
+            }
+            else
+            {
+                $max_rate = intval($left * $rate / 100 + 0.5);
+                if($total >= $max_rate) {
+                    $disc += $max_rate;
+                    $left = 0;
+                    $rates[$rate] = $max_rate / 100;
+                } else {
+                    $disc += $total;
+                    $left -= intval($total * 100 / $rate + 0.5);
+                    $rates[$rate] = $total / 100;
+                }
+            }
+        }
+        $cur_price = intval($price * 100 + 0.5) - $disc;
+        return $cur_price / 100;
+    }
+
+    public function calc_price($price,&$rates)
+    {
+        $cur_price = intval($this->calc_money($price,$rates) * 100 + 0.5);
+        return $cur_price / 100;
+    }
+    static function scale() {
+        return (100 - self::PRED_RATE) / 100;
+    }
+}
+
 class predeposit_helper
 {
     private $model_pd;
@@ -235,10 +383,8 @@ class predeposit_helper
 
         $pd_array = Model('member')->getMemberPdInfo($this->member_id);
         $this->mRateVersion  = intval($pd_array['rate_version']);
-
         $this->init_rate();
     }
-
     public function __destruct()
     {
         if($this->mDirty)
@@ -249,17 +395,15 @@ class predeposit_helper
             $this->inc_rate_version();
         }
     }
-
     public function member_id() {
         return $this->member_id;
     }
-
     private function init_rate()
     {
         if($this->mFromSession)
         {
             $fUpdate = false;
-            if(isset($_SESSION['bonus_rate_version']) == false) {
+            if(!isset($_SESSION['bonus_rate_version'])) {
                 $fUpdate = true;
             }
             else
@@ -271,8 +415,8 @@ class predeposit_helper
                 else
                 {
                     if(isset($_SESSION['bonus_rate']) && isset($_SESSION['bonus_state']) && isset($_SESSION['share_bonus_rate'])) {
-                        $this->mPayRates = new RateMoney($_SESSION['bonus_rate']);
-                        $this->mShareRates = new RateMoney($_SESSION['share_bonus_rate']);
+                        $this->mPayRates   = self::create_moneycalc($_SESSION['bonus_rate']);
+                        $this->mShareRates = self::create_moneycalc($_SESSION['share_bonus_rate']);
                         $this->mBonusState = $_SESSION['bonus_state'];
                     } else {
                         $fUpdate = true;
@@ -288,12 +432,12 @@ class predeposit_helper
         if($fUpdate || $this->need_update())
         {
             $mod_bonus = Model('user_bonus');
-            $this->mPayRates = new RateMoney(array());
+            $this->mPayRates = self::create_moneycalc(array());
             $pay_items = $mod_bonus->getUsableBonus($this->member_id);
             $this->mPayRates->add_bonuses($pay_items);
             $pay_bonus_rate = $this->mPayRates->format();
 
-            $this->mShareRates = new RateMoney(array());
+            $this->mShareRates = self::create_moneycalc(array());
             $share_items = $mod_bonus->getShareableBonus($this->member_id);
             $this->mShareRates->add_bonuses($share_items);
             $share_bonus_rate = $this->mShareRates->format();
@@ -312,7 +456,6 @@ class predeposit_helper
             }
 
             $this->write_rates($this->mBonusState,$pay_bonus_rate,$share_bonus_rate);
-
             $this->mPayRates->clean();
             $this->mShareRates->clean();
 
@@ -352,11 +495,9 @@ class predeposit_helper
     public function share_total_bonus() {
         return $this->mShareRates->total();
     }
-
     public function bonus_state() {
         return $this->mBonusState;
     }
-
     private function query_cond($query_state)
     {
         static $stQuerys = array('usable','expiring','used','expired');
@@ -914,7 +1055,7 @@ class predeposit_helper
             $pred = new predeposit_helper($_SESSION['member_id'],true);
             $bonus_rate = $pred->pay_bonus_rates();
         } else {
-            $bonus_rate = new RateMoney($_SESSION['bonus_rate']);
+            $bonus_rate = self::create_moneycalc($_SESSION['bonus_rate']);
         }
 
         return $bonus_rate->calc_money($goods_amount,$rates);
@@ -928,7 +1069,7 @@ class predeposit_helper
                 $pred = new predeposit_helper($_SESSION['member_id'],true);
                 $bonus_rate = $pred->pay_bonus_rates();
             } else {
-                $bonus_rate = new RateMoney($_SESSION['bonus_rate']);
+                $bonus_rate = self::create_moneycalc($_SESSION['bonus_rate']);
             }
 
             return $bonus_rate->calc_price($goods_price,$rates);
@@ -942,7 +1083,7 @@ class predeposit_helper
     static public function unlogin_bonus_price($goods_price,$rate_moneys,&$rates)
     {
         if(!empty($rate_moneys)) {
-            $bonus_rate = new RateMoney($rate_moneys);
+            $bonus_rate = self::create_moneycalc($rate_moneys);
             return $bonus_rate->calc_price($goods_price,$rates);
         } else {
             return $goods_price;
@@ -966,4 +1107,12 @@ class predeposit_helper
         $types = bonus\type::create_by_paramer($bonus_type);
         QueueClient::push('onPredeposit',array('change_type' => 'bonus_refund','buyer_id' => $types->sender_id(),'order_sn' => $types->getType_sn()));
     }
+    static private function create_moneycalc($rate_moneys)
+    {
+        if(noBonusRate()) {
+            return new BonusAmount($rate_moneys);
+        } else {
+            return new RateMoney($rate_moneys);
+        }
+    }
 }

+ 0 - 7
helper/room/cli_seq.puml

@@ -50,11 +50,4 @@ access -> access : decode author info
 access ->o sock_cli : author success
 deactivate access
 
-
-
-
-
-
-
-
 @enduml

+ 2 - 0
helper/session_helper.php

@@ -389,6 +389,8 @@ class session_helper
 
     static public function can_send()
     {
+        if(noBonusRate()) return true;
+
         if (array_key_exists('order_num', $_SESSION)) {
             $order_num = $_SESSION['order_num'];
         }

+ 32 - 18
mobile/control/member_bonus.php

@@ -41,19 +41,16 @@ class member_bonusControl extends mbMemberControl
 
         $bonus_state = $this->mPred->bonus_state();
         $expiring = $bonus_state['expiring'];
-        $warning = "";
-        if(!empty($expiring))
-        {
-            $expiring = intval($expiring * 100 + 0.5);
-            if($expiring > 0) {
-                $expiring = $expiring / 100;
-                $warning = "您有{$expiring}元红包即将过期";
-            }
+        $expiring = intval($expiring * 100 + 0.5);
+        if($expiring > 0) {
+            $expiring = $expiring / 100;
+            $warning = "您有{$expiring}元红包即将过期";
         }
 
         $result = array_merge($result,$bonus_state);
         $result['bonus_rate'] = $this->format_rates($this->mPred->pay_bonus_rates());
         $result['share_bonus_rate'] = $this->format_rates($this->mPred->share_bonus_rates());
+
         $result['send_bless'] = $this->cur_bless();
         $result['avatar'] = session_helper::avatar();
         $result['sub_titles'] = ['shake' => '','invite' => '赚百分百红包','friends' => '','bonus_detail' => $warning];
@@ -68,10 +65,21 @@ class member_bonusControl extends mbMemberControl
         {
             $rates = $bonus_rate->format();
             $rates_money = [];
-            foreach ($rates as $rate => $money) {
-                $item['rate'] = $rate;
-                $item['total'] = $money;
-                $rates_money[] = $item;
+            if(noBonusRate())
+            {
+                $amount = 0.0;
+                foreach ($rates as $rate => $money) {
+                    $amount += $money;
+                }
+                $rates_money[] = ['rate' => defaultBonusRate(),'total' => $amount];
+            }
+            else
+            {
+                foreach ($rates as $rate => $money) {
+                    $item['rate'] = $rate;
+                    $item['total'] = $money;
+                    $rates_money[] = $item;
+                }
             }
         }
         else {
@@ -161,10 +169,16 @@ class member_bonusControl extends mbMemberControl
             return self::outerr(errcode::ErrBonus,self::msg_malice_bonus);
         }
 
-        if (intval($_GET['bonus_rate']) > 0) {
-            $bonus_rate = intval($_GET['bonus_rate']);
-        } else {
-            return self::outerr(errcode::ErrParamter,'红包折扣率错误,客户端需要升级新版本.');
+        if(isUseBonusRate())
+        {
+            if (intval($_GET['bonus_rate']) > 0) {
+                $bonus_rate = intval($_GET['bonus_rate']);
+            } else {
+                return self::outerr(errcode::ErrParamter,'红包折扣率错误,客户端需要升级新版本.');
+            }
+        }
+        else {
+            $bonus_rate = defaultBonusRate();
         }
 
         $param = $this->fill_param($_GET,$bonus_rate);
@@ -1164,7 +1178,7 @@ class member_bonusControl extends mbMemberControl
     private function send_list(&$pages)
     {
         $mod_type = Model('bonus_type');
-        $cond['sender_id|relayer_id'] = array('_multi'=>true,$_SESSION['member_id'],$_SESSION['member_id']);
+        $cond['sender_id|relayer_id'] = ['_multi'=>true,$_SESSION['member_id'],$_SESSION['member_id']];
         $cond['make_type'] = array('in',array(bonus\type::MakeSendType,bonus\type::MakeInviteType));
 
         $count = $mod_type->getTypeCount($cond);
@@ -1179,8 +1193,8 @@ class member_bonusControl extends mbMemberControl
             $type_info = bonus_helper::filter_type($val);
             $type_infos[] = $type_info;
         }
-
         $pages = $this->pages($count);
+
         return $type_infos;
     }
 }

+ 1 - 0
test/TestBonus.php

@@ -12,6 +12,7 @@ define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/bonus/witholder.php');
+require_once(BASE_ROOT_PATH . '/helper/bonus/norate_holder.php');
 require_once(BASE_ROOT_PATH . '/helper/notify_helper.php');
 require_once(BASE_ROOT_PATH . '/data/mobile/lrlz_staff.php');
 

File diff suppressed because it is too large
+ 5 - 0
test/TestUGC.php