Пример #1
0
 /**
  * reset the jcoins for user
  */
 public function resetJCoins()
 {
     $condition = new PreparedStatementConditionBuilder();
     $condition->add('user.userID IN (?)', array($this->objectIDs));
     // reset it, without set transfer-log
     $stmt = WCF::getDB()->prepareStatement('UPDATE wcf' . WCF_N . '_user user SET user.jCoinsBalance = 0 ' . $condition);
     $stmt->execute($condition->getParameters());
     // trash statements
     $list = new UserJcoinsStatementList();
     $list->getConditionBuilder()->add('user_jcoins_statement.userID IN (?)', array($this->objectIDs));
     $list->readObjectIDs();
     // trash statements
     $action = new UserJcoinsStatementAction($list->objectIDs, 'trashAll');
     $action->executeAction();
     $this->unmarkItems();
 }
 /**
  * @see	wcf\system\cronjob\ICronjob::execute()
  */
 public function execute(Cronjob $cronjob)
 {
     parent::execute($cronjob);
     $statementList = new UserJcoinsStatementList();
     $statementList->getConditionBuilder()->add('user_jcoins_statement.time < ?', array(TIME_NOW - 86400 * JCOINS_STATEMENTS_DELETEAFTER));
     if (JCOINS_STATEMENTS_DELETEONLYTRASHED) {
         $statementList->getConditionBuilder()->add('user_jcoins_statement.isTrashed = ?', array(1));
     }
     $statementList->readObjects();
     if (!$statementList->count()) {
         return;
     }
     $statementAction = new UserJcoinsStatementAction($statementList->getObjects(), 'delete');
     $statementAction->executeAction();
 }