当前位置: 首页>>代码示例>>PHP>>正文


PHP Campaign::getByStatusAndSendingTime方法代码示例

本文整理汇总了PHP中Campaign::getByStatusAndSendingTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Campaign::getByStatusAndSendingTime方法的具体用法?PHP Campaign::getByStatusAndSendingTime怎么用?PHP Campaign::getByStatusAndSendingTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Campaign的用法示例。


在下文中一共展示了Campaign::getByStatusAndSendingTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateCampaignItemsForDueCampaigns

 /**
  * For now we should limit to process one campaign at a time until it is completely processed. This will
  * avoid potential performance problems.
  * @param null $pageSize - used to determine how many campaignItems to create per run.
  * @param integer $campaignPageSize
  * @return bool
  */
 public static function generateCampaignItemsForDueCampaigns($pageSize = null, $campaignPageSize = 1)
 {
     assert('is_int($pageSize) || $pageSize == null');
     assert('is_int($campaignPageSize)');
     $dueCampaigns = Campaign::getByStatusAndSendingTime(Campaign::STATUS_ACTIVE, time(), $campaignPageSize);
     foreach ($dueCampaigns as $dueCampaign) {
         if (static::generateCampaignItems($dueCampaign, $pageSize)) {
             $dueCampaign->status = Campaign::STATUS_PROCESSING;
             if (!$dueCampaign->save()) {
                 throw new FailedToSaveModelException("Unable to save campaign");
             }
         }
     }
     return true;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:22,代码来源:CampaignItemsUtil.php

示例2: resolveJobsForQueue

 /**
  * @see parent::resolveJobsForQueue()
  */
 public static function resolveJobsForQueue()
 {
     parent::resolveJobsForQueue();
     $pageSize = static::JOB_QUEUE_PAGE_SIZE;
     $offset = 0;
     $timeStamp = time();
     do {
         $campaigns = Campaign::getByStatusAndSendingTime(Campaign::STATUS_ACTIVE, $timeStamp, $pageSize, $offset, false);
         $offset = $offset + $pageSize;
         if (is_array($campaigns) && count($campaigns) > 0) {
             foreach ($campaigns as $campaign) {
                 Yii::app()->jobQueue->resolveToAddJobTypeByModelByDateTimeAttribute($campaign, 'sendOnDateTime', 'CampaignGenerateDueCampaignItems');
             }
         }
     } while (is_array($campaigns) && count($campaigns) > 0);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:19,代码来源:CampaignGenerateDueCampaignItemsJob.php

示例3: testGetByStatusAndSendingTime

 /**
  * @depends testGetByStatus
  */
 public function testGetByStatusAndSendingTime()
 {
     $totalCampaigns = Campaign::getAll();
     $this->assertNotEmpty($totalCampaigns);
     $this->assertCount(4, $totalCampaigns);
     $dueActiveCampaigns = Campaign::getByStatusAndSendingTime(Campaign::STATUS_ACTIVE, time() + 100);
     $this->assertNotEmpty($dueActiveCampaigns);
     $this->assertCount(3, $dueActiveCampaigns);
     $campaign = $dueActiveCampaigns[0];
     $this->assertEquals('Test Campaign Name2', $campaign->name);
     $this->assertEquals(0, $campaign->supportsRichText);
     $this->assertEquals('From Name2', $campaign->fromName);
     $this->assertEquals('from2@zurmo.com', $campaign->fromAddress);
     $this->assertEquals('Test Subject2', $campaign->subject);
     $this->assertEquals('Test Html Content2', $campaign->htmlContent);
     $this->assertEquals('Test Text Content2', $campaign->textContent);
     $duePausedCampaigns = Campaign::getByStatusAndSendingTime(Campaign::STATUS_PAUSED);
     $this->assertNotEmpty($duePausedCampaigns);
     $this->assertCount(1, $duePausedCampaigns);
     $campaign = $duePausedCampaigns[0];
     $this->assertEquals('Test Campaign Name', $campaign->name);
     $this->assertEquals(1, $campaign->supportsRichText);
     $this->assertEquals(Campaign::STATUS_PAUSED, $campaign->status);
     $this->assertEquals('From Name', $campaign->fromName);
     $this->assertEquals('from@zurmo.com', $campaign->fromAddress);
     $this->assertEquals('Test Subject', $campaign->subject);
     $this->assertEquals('Test Html Content', $campaign->htmlContent);
     $this->assertEquals('Test Text Content', $campaign->textContent);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:32,代码来源:CampaignTest.php


注:本文中的Campaign::getByStatusAndSendingTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。