示例#1
0
 private function _getDownloadCredit($operation, PwUserBo $user, PwCreditBo $creditBo, $creditset = array())
 {
     $strategy = $creditBo->getStrategy($operation);
     if ($this->_checkCreditSetEmpty($strategy['credit']) && $this->_checkCreditSetEmpty($creditset['credit'])) {
         return false;
     }
     //如果外部有积分设置传入则使用外部的积分设置策略
     if (!empty($creditset['limit']) || $creditset['credit'] && false === $this->_checkCreditSetEmpty($creditset['credit'])) {
         $strategy['limit'] = $creditset['limit'];
         $strategy['credit'] = $creditset['credit'];
     }
     if ($strategy['limit']) {
         $count = $creditBo->getOperateCount($user->uid, $operation);
         if ($count >= $strategy['limit']) {
             return false;
         }
     }
     return $strategy['credit'];
 }