示例#1
0
 public function init()
 {
     $value = $this->getValue();
     if ($this->_riseValue === null) {
         $addonModel = new Addon();
         $rangeStart = $addonModel->getAddonPeriodRangeStart($this->addonTypeId, $this->customerTypeId, $this->brandId, $this->depositDays);
         $rangeEnd = $addonModel->getAddonPeriodRangeEnd($this->addonTypeId, $this->customerTypeId, $this->brandId, $this->depositDays);
         if ($rangeStart !== null && $rangeEnd === null) {
             $this->_riseValue += $rangeStart->interest_value / 100;
         } else {
             $x0 = $rangeStart->interest_step;
             $x1 = $rangeEnd->interest_step;
             $y0 = $rangeStart->interest_value;
             $y1 = $rangeEnd->interest_value;
             $x = $this->depositDays;
             $this->_riseValue += $this->linearInterpolation($x0, $x1, $y0, $y1, $x) / 100;
         }
     }
     $value += $this->_riseValue;
     $this->setValue($value);
 }