コード例 #1
0
ファイル: Bootstrap.php プロジェクト: alexanderTsig/arabic
 /**
  * run payouts when scheduled
  */
 function onDaily(Am_Event $event)
 {
     $delay = $this->getConfig('payout_day');
     if (!$delay) {
         return;
     }
     list($count, $unit) = preg_split('/(\\D)/', $delay, 2, PREG_SPLIT_DELIM_CAPTURE);
     switch ($unit) {
         case 'd':
             if ($count != (int) date('d', amstrtotime($event->getDatetime()))) {
                 return;
             }
             break;
         case 'w':
             $w = date('w', amstrtotime($event->getDatetime()));
             if ($count != $w) {
                 return;
             }
             break;
         default:
             throw new Am_Exception_InternalError(sprintf('Unknown unit [%s] in %s::%s', $unit, __CLASS__, __METHOD__));
     }
     $this->getDi()->affCommissionTable->runPayout(sqlDate($event->getDatetime()));
 }
コード例 #2
0
 /**
  * run payouts when scheduled
  */
 function onDaily(Am_Event $event)
 {
     $delay = $this->getConfig('payout_day');
     if (!$delay) {
         return;
     }
     list($count, $unit) = preg_split('/(\\D)/', $delay, 2, PREG_SPLIT_DELIM_CAPTURE);
     switch ($unit) {
         case 'd':
             if ($count != (int) date('d', amstrtotime($event->getDatetime()))) {
                 return;
             }
             break;
         case 'w':
             $w = date('w', amstrtotime($event->getDatetime()));
             if ($count != $w) {
                 return;
             }
             break;
         default:
             return;
             // wtf?
     }
     $this->getDi()->affCommissionTable->runPayout(sqlDate($event->getDatetime()));
 }