本文整理汇总了PHP中OW_Example::andFieldLessThan方法的典型用法代码示例。如果您正苦于以下问题:PHP OW_Example::andFieldLessThan方法的具体用法?PHP OW_Example::andFieldLessThan怎么用?PHP OW_Example::andFieldLessThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW_Example
的用法示例。
在下文中一共展示了OW_Example::andFieldLessThan方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findExpiredInactiveItems
/**
* @param string $timeStamp
* @return array<BOL_Attachment>
*/
public function findExpiredInactiveItems($timeStamp)
{
$example = new OW_Example();
$example->andFieldEqual(self::STATUS, 0);
$example->andFieldLessThan(self::ADD_STAMP, $timeStamp);
return $this->findListByExample($example);
}
示例2: processScheduler
public function processScheduler()
{
/**
* following step to speed up & beat performance
* 1. check album limit
* 2. check quota limit
* 3. get nodes of this schedulers
* 4. get all items of current schedulers.
* 5. process each node
* 5.1 check required quota
* 5.2 fetch data to pubic file
* 5.3 store to file model
* 6. check status of schedulers, if scheduler is completed == (remaining == 0)
* 6.1 udpate feed and message.
*/
/**
* Unlimited time.
*/
set_time_limit(0);
/**
* default 20
* @var int
*/
$configs = OW::getConfig()->getValues('ynmediaimporter');
$limitUserPerCron = $configs['number_photo'] ? intval($configs['number_photo']) : 20;
/**
* default 20
* @var int
*/
$limitQueuePerCron = $configs['number_queue'] ? intval($configs['number_queue']) : 20;
/**
* process number queue.
*/
/**
* get scheduler from tables data.
*/
$example = new OW_Example();
$example->andFieldLessThan('status', '3');
$example->setOrder('last_run');
$example->setLimitClause($first, $count)->setLimitClause(0, $limitQueuePerCron);
$schedulers = YNMEDIAIMPORTER_BOL_SchedulerDao::getInstance()->findListByExample($example);
foreach ($schedulers as $scheduler) {
Ynmediaimporter::processScheduler($scheduler, 0, $limitUserPerCron, 1, 1);
}
echo "success!";
exit(0);
}
示例3: findList
/**
* Finds action list by type
*
* @param string $type
*/
public function findList($type)
{
$example = new OW_Example();
if ($type == 'earn') {
$example->andFieldGreaterThan('amount', 0);
} else {
if ($type == 'lose') {
$example->andFieldLessThan('amount', 0);
} else {
if ($type == 'unset') {
$example->andFieldEqual('amount', 0);
}
}
}
$example->andFieldEqual('isHidden', 0);
$example->andFieldEqual('active', 1);
return $this->findListByExample($example);
}
示例4: findListAfterAvatarId
public function findListAfterAvatarId($avatarId, $count, $includes = true)
{
$avatar = $this->findLastByAvatarId($avatarId);
if ($avatar === null) {
return array();
}
$example = new OW_Example();
$example->andFieldEqual("userId", $avatar->userId);
if ($includes) {
$example->andFieldLessOrEqual("timeStamp", $avatar->timeStamp);
} else {
$example->andFieldLessThan("timeStamp", $avatar->timeStamp);
}
$example->setOrder("`timeStamp` DESC");
$example->setLimitClause(0, $count);
return $this->findListByExample($example);
}
示例5: findExpireFileList
public function findExpireFileList($expirationPeriod)
{
if (empty($entityId) || (int) $userId <= 0 || (int) $expirationPeriod < 0) {
return array();
}
$example = new OW_Example();
$example->andFieldLessThan('timestamp', time() - (int) $expirationPeriod);
return $this->findListByExample($example);
}
示例6: getNextPhoto
public function getNextPhoto($albumId, $id)
{
if (!$id) {
return false;
}
$example = new OW_Example();
$example->andFieldEqual('albumId', $albumId);
$example->andFieldLessThan('id', $id);
$example->andFieldEqual('status', 'approved');
$example->setOrder('`id` DESC');
$example->setLimitClause(0, 1);
return $this->findObjectByExample($example);
}
示例7: expirePreparedSales
/**
* Expire sales with 'prepared' status
*
* @return boolean
*/
public function expirePreparedSales()
{
$example = new OW_Example();
$example->andFieldEqual('status', self::STATUS_PREPARED);
$example->andFieldLessThan('timeStamp', time() - self::PREPARED_SALES_EXPIRE_INTERVAL);
$this->deleteByExample($example);
}
示例8: findNextSection
public function findNextSection($order)
{
if ($order === null) {
return null;
}
$example = new OW_Example();
$example->andFieldLessThan('sortOrder', (int) $order);
return $this->findObjectByExample($example);
}
示例9: deleteExpired
/**
* @param $timestamp
*/
public function deleteExpired($timestamp)
{
$example = new OW_Example();
$example->andFieldLessThan('visitTimestamp', time() - $timestamp);
$this->deleteByExample($example);
}
示例10: deleteExpiredList
public function deleteExpiredList()
{
$example = new OW_Example();
$example->andFieldLessThan('expireStamp', time());
$this->deleteByExample($example);
}
示例11: findPreviousPost
/**
* Finds previous post in the topic
*
* @param int $topicId
* @param int $postId
* @return FORUM_BOL_Post
*/
public function findPreviousPost($topicId, $postId)
{
$example = new OW_Example();
$example->andFieldEqual('topicId', $topicId);
$example->andFieldLessThan('id', $postId);
$example->setOrder('`id` DESC');
$example->setLimitClause(0, 1);
return $this->findObjectByExample($example);
}
示例12: processScheduler
public static function processScheduler($scheduler, $user_aid = null, $limit = 10, $sendNotification = false, $sendActivity = true)
{
//register_shutdown_function(array('Ynmediaimporter','handleShutdown'), $scheduler -> id);
//ini_set('max_execution_time',1);
$movedCount = 0;
$movedArray = array();
$photos = array();
$schedulerId = $scheduler->id;
$userId = $scheduler->user_id;
$user = BOL_UserService::getInstance()->findUserById($userId);
$album = null;
$example = new OW_Example();
$example->andFieldEqual('scheduler_id', $schedulerId);
$example->andFieldLessThan('status', '3');
$example->andFieldGreaterThan('status', '0');
$example->setLimitClause(0, $limit);
if ($user_aid) {
$example->andFieldEqual('user_aid', intval($user_aid));
}
$nodeList = YNMEDIAIMPORTER_BOL_NodeDao::getInstance()->findListByExample($example);
$order = 0;
foreach ($nodeList as $node) {
if ('photo' == $node->media && $node->user_aid > 0) {
$album = PHOTO_BOL_PhotoAlbumDao::getInstance()->findById($node->user_aid);
if (!is_object($album)) {
continue;
}
//download file
$dir = Ynmediaimporter::getValidDir();
$file = $dir . $node->getUUID();
$privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $album->userId, 'action' => 'photo_view_album'));
$photo = new PHOTO_BOL_Photo();
$photo->description = '';
$photo->albumId = $album->id;
$photo->addDatetime = time();
$photo->status = 'approved';
$photo->hasFullsize = '1';
$photo->privacy = mb_strlen($privacy) ? $privacy : 'everybody';
$source = self::saveImageFromUrl($node->getDownloadFilename(), $file);
$photo = self::__savePhoto($photo, $source, $userId);
if ($photo) {
$photos[] = $photo;
$movedArray[] = array('addTimestamp' => time(), 'photoId' => $photo->id);
$movedCount++;
}
$node->status = 3;
YNMEDIAIMPORTER_BOL_NodeDao::getInstance()->save($node);
} else {
if (in_array($node->media, array('album', 'photoset', 'gallery')) && 0 == $node->user_aid) {
// create new albums for this roles
$album = self::createPhotoAlbums($scheduler, $node);
// setup album and node.
// update all sub node of current scheduler to this albums.
$example = new OW_Example();
$example->andFieldEqual('scheduler_id', $schedulerId);
$example->andFieldEqual('aid', $node->aid);
$nodeTemp = YNMEDIAIMPORTER_BOL_NodeDao::getInstance()->findObjectByExample($example);
$nodeTemp->user_aid = $album->id;
$nodeTemp->status = '1';
YNMEDIAIMPORTER_BOL_NodeDao::getInstance()->save($nodeTemp);
$node->user_aid = $album->id;
$node->status = 1;
YNMEDIAIMPORTER_BOL_NodeDao::getInstance()->save($node);
self::processScheduler($scheduler, $album->id, 10, 0, 0);
break;
// force process this album to escape no value style.
}
}
}
$example = new OW_Example();
$example->andFieldEqual('scheduler_id', $schedulerId);
$example->andFieldEqual('media', 'photo');
$example->andFieldLessThan('status', '3');
$remain = intval(YNMEDIAIMPORTER_BOL_NodeDao::getInstance()->countByExample($example));
// all scheduler is completed. send notification to users
if (is_object($album) && $remain == 0) {
// Send notification
if ($sendNotification) {
$actor = array('username' => BOL_UserService::getInstance()->getUserName($userId), 'name' => BOL_UserService::getInstance()->getDisplayName($userId), 'url' => BOL_UserService::getInstance()->getUserUrl($userId));
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId));
$event = new OW_Event('notifications.add', array('pluginKey' => 'ynmediaimporter', 'entityType' => 'ynmediaimporter_album', 'entityId' => (int) $album->id, 'action' => 'ynmediaimporter_album-added', 'userId' => $album->userId, 'time' => time()), array('avatar' => $avatars[$userId], 'string' => array('key' => 'ynmediaimporter+added_album_notification_string', 'vars' => array('actor' => $actor['name'], 'actorUrl' => $actor['url'], 'title' => $album->name, 'url' => OW::getRouter()->urlForRoute('photo_user_album', array('user' => $actor['username'], 'album' => $album->id)))), 'content' => $album->name, 'url' => OW::getRouter()->urlForRoute('photo_user_album', array('user' => $actor['username'], 'album' => $album->id))));
OW::getEventManager()->trigger($event);
}
if ($sendActivity) {
self::__sendActivity($album, $photos, $movedArray, $movedCount);
}
}
$scheduler->status = $remain == 0 ? 3 : 1;
$scheduler->last_run = time();
YNMEDIAIMPORTER_BOL_SchedulerDao::getInstance()->save($scheduler);
// and of process rec count all
$tableName = OW_DB_PREFIX . 'ynmediaimporter_nodes';
$sql = "SELECT\n\t\t\t\t album.id,\n\t\t\t\t (SELECT\n\t\t\t\t COUNT( * )\n\t\t\t\t FROM {$tableName} AS photo\n\t\t\t\t WHERE photo.media = 'photo'\n\t\t\t\t AND photo.aid = album.id\n\t\t\t\t AND photo.status = 1) AS remaining\n\t\t\t\tFROM `{$tableName}` album\n\t\t\t\tWHERE album.media <> 'photo'\n\t\t\t\t AND album.status = 1\n\t\t\t\tGROUP BY album.id\n\t\t\t\tHAVING remaining = 0";
$completedList = OW::getDbo()->queryForColumnList($sql);
if ($completedList) {
$sql = "UPDATE `{$tableName}` SET `status` = '3' where `id` IN (" . implode(',', $completedList) . ")";
OW::getDbo()->query($sql);
}
return array('remain' => $remain, 'scheduler_id' => $schedulerId);
}