|
@@ -35,14 +35,15 @@ class submit_rule
|
|
|
public function make_bonus($num,&$amount,&$bonus_rate)
|
|
|
{
|
|
|
if($this->support_bonus() == false) return false;
|
|
|
- if($this->has_bonus() == true) return $this->type_sn();
|
|
|
+ if($this->has_bonus($amount,$bonus_rate) == true) {
|
|
|
+ return $this->type_sn();
|
|
|
+ }
|
|
|
|
|
|
try
|
|
|
{
|
|
|
$trans = new trans_wapper(null,'submit_rule make_bonus');
|
|
|
$type = bonus\type::create_by_sn($this->type_sn());
|
|
|
$bonus_rate = $type->bonus_rate();
|
|
|
-
|
|
|
$bonus_value = intval(floatval($this->per_amount()) * $num * 100 + 0.5);
|
|
|
|
|
|
if($type->isEnd() || $type->remain_over()) {
|
|
@@ -117,7 +118,7 @@ class submit_rule
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function has_bonus()
|
|
|
+ private function has_bonus(&$bonus_value,&$bonus_rate)
|
|
|
{
|
|
|
$mod_bonus = Model('user_bonus');
|
|
|
$sessionid = session_helper::session_id();
|
|
@@ -134,6 +135,8 @@ class submit_rule
|
|
|
if(empty($bonusex)) {
|
|
|
return false;
|
|
|
} else {
|
|
|
+ $bonus_value = doubleval($bonusex[0]['bonus_value']);
|
|
|
+ $bonus_rate = intval($bonusex[0]['bonus_rate']);
|
|
|
return true;
|
|
|
}
|
|
|
}
|