public function checkReward($reward) { if (!$reward['num']) { return new PwError('TASK:reward.credit.num.require'); } if (!WindValidator::isNonNegative($reward['num'])) { return new PwError('TASK:reward.credit.num.isNonNegative'); } $reward['num'] = ceil($reward['num']); return parent::checkReward($reward); }
public function checkReward($reward) { if (!$reward['time']) { return new PwError('TASK:reward.group.num.require'); } if (!WindValidator::isNonNegative($reward['time'])) { return new PwError('TASK:reward.group.num.isNonNegative'); } $reward['time'] = ceil($reward['time']); if ($reward['time'] <= 0) { return new PwError('TASK:reward.group.num.isNonNegative'); } return parent::checkReward($reward); }
/** * 处理过滤数据 * * 关于奖励: * 传递过来"key": 该key表明“value”中对应的值的组成,传递过来一个descript占位字串,也由key中对应的组成 * 比如key= typeid-name-unity 对应的value= 1-威望-个 * descript={num}{unity}{name} 对应将组成: 10个威望 ---num在传递过来的数组中有值 */ protected function filterRewardData() { if (!isset($this->_data['reward']) || !$this->decoration) { $this->_data['reward'] = serialize(array()); return true; } if (!is_array($this->_data['reward'])) { return new PwError('TASK:condition.reward.format.error'); } if ($this->decoration instanceof PwTaskRewardDoBase) { $reward = $this->decoration->checkReward($this->_data['reward']); if ($reward instanceof PwError) { return $reward; } } $this->_data['reward'] = serialize($reward); }