|
@@ -54,20 +54,6 @@ class RateMoney
|
|
|
krsort($this->mRates);
|
|
|
}
|
|
|
|
|
|
- public function balance($money)
|
|
|
- {
|
|
|
- $money = intval($money * 100 + 0.5);
|
|
|
- $total = intval($this->total() * 100 + 0.5);
|
|
|
-
|
|
|
- if($money > $total)
|
|
|
- {
|
|
|
- if(isset($this->mRates[self::PRED_RATE]) == false) {
|
|
|
- $this->mRates[self::PRED_RATE] = 0.00;
|
|
|
- }
|
|
|
- $this->mRates[self::PRED_RATE] += ($money - $total) / 100;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public function resort()
|
|
|
{
|
|
|
krsort($this->mRates);
|
|
@@ -205,8 +191,6 @@ class predeposit_helper
|
|
|
{
|
|
|
private $model_pd;
|
|
|
private $member_id;
|
|
|
- private $mTotalPred;
|
|
|
- private $mFreezePred;
|
|
|
private $mRates;
|
|
|
private $mBonusState;
|
|
|
private $mRateVersion; //用来记录,红包过期带来的红包变化
|
|
@@ -217,8 +201,6 @@ class predeposit_helper
|
|
|
$this->member_id = $member_id;
|
|
|
|
|
|
$pd_array = Model('member')->getMemberPdInfo($this->member_id);
|
|
|
- $this->mTotalPred = $pd_array['available_predeposit']; // 当前预存款
|
|
|
- $this->mFreezePred = $pd_array['freeze_predeposit']; // 当前预存款冻结
|
|
|
$this->mRateVersion = intval($pd_array['rate_version']);
|
|
|
$this->init_rate();
|
|
|
}
|
|
@@ -252,7 +234,6 @@ class predeposit_helper
|
|
|
$this->mRates = new RateMoney(array());
|
|
|
$items = $mod_bonus->getUsableBonus($this->member_id);
|
|
|
$this->mRates->add_bonuses($items);
|
|
|
- $this->mRates->balance($this->mTotalPred);
|
|
|
$bonus_rate = $this->mRates->format();
|
|
|
|
|
|
$this->mBonusState = [];
|
|
@@ -398,14 +379,13 @@ class predeposit_helper
|
|
|
return $bonuses;
|
|
|
}
|
|
|
|
|
|
- public function total_pred() {
|
|
|
- return $this->mTotalPred;
|
|
|
- }
|
|
|
- public function freeze_pred() {
|
|
|
- return $this->mFreezePred;
|
|
|
+ public function total_bonus()
|
|
|
+ {
|
|
|
+ return $this->mRates->total();
|
|
|
}
|
|
|
+
|
|
|
public function is_enough($money) {
|
|
|
- return intval($this->total_pred() * 100) >= intval($money * 100);
|
|
|
+ return intval($this->total_bonus() * 100) >= intval($money * 100);
|
|
|
}
|
|
|
|
|
|
public function person_enough($money,&$bonus_rate)
|