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


PHP Queue::model方法代码示例

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


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

示例1: run

 public function run($args)
 {
     echo "*********************\n " . date('Y-m-d H:i:s') . "\n*********************\n";
     $c = new CDbCriteria();
     $c->order = 'create_time ASC';
     /** @var Queue $queue */
     $queue = Queue::model()->find($c);
     if (!$queue) {
         echo "The queue is empty\n*********************\n";
         return;
     }
     switch ($queue->type) {
         case Queue::TYPE_MAIL:
             $this->handleMail($queue);
             break;
     }
     $queue->delete();
     echo "*********************\n";
 }
开发者ID:bartaakos,项目名称:yii-simple-queue,代码行数:19,代码来源:QueueCommand.php

示例2: actionIndex

 public function actionIndex($limit = 5)
 {
     $limit = (int) $limit;
     echo "Process " . $limit . " mail task...\n";
     Yii::log("Process " . $limit . " mail task...\n");
     $models = Queue::model()->findAll(array('condition' => 'worker = :worker AND status = :status', 'params' => array(':worker' => self::MAIL_WORKER_ID, ':status' => Queue::STATUS_NEW), 'limit' => $limit, 'order' => 'priority desc'));
     echo "Find " . count($models) . " new mail task...\n";
     Yii::log("Find " . count($models) . " new mail task...\n");
     foreach ($models as $model) {
         echo "Process mail task id = {$model->id}...\n";
         Yii::log("Process mail task id = {$model->id}...\n");
         if (!($data = (array) json_decode($model->task))) {
             $model->status = Queue::STATUS_ERROR;
             $model->notice = 'Error json_decode...';
             $model->save();
             echo "Error json_decode...\n";
             Yii::log('Error json_decode...');
             continue;
         }
         if (!isset($data['from'], $data['to'], $data['theme'], $data['body'])) {
             $model->status = Queue::STATUS_ERROR;
             $model->notice = 'Wrong data...';
             $model->save();
             echo "Wrong data...";
             Yii::log('Wrong data...');
             continue;
         }
         if (Yii::app()->mail->send($data['from'], $data['to'], $data['theme'], $data['body'])) {
             $model->status = Queue::STATUS_COMLETED;
             $model->complete_time = new CDbExpression('NOW()');
             $model->save();
             echo "Success send...";
             Yii::log("Success send...");
             continue;
         }
     }
 }
开发者ID:sherifflight,项目名称:yupe,代码行数:37,代码来源:YQueueMailSenderCommand.php

示例3: loadModel

 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет HTTP-исключение.
  * 
  * @throws CHttpException
  * 
  * @param integer $id идентификатор нужной модели
  * 
  * @return Queue $model
  *
  * @throws CHttpException If record not found
  */
 public function loadModel($id)
 {
     if (($model = Queue::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('QueueModule.queue', 'Requested page was not found.'));
     }
     return $model;
 }
开发者ID:sepaker,项目名称:yupe,代码行数:19,代码来源:QueueBackendController.php

示例4: init

 public function init()
 {
     parent::init();
     $this->queueTableName = Queue::model()->tableName();
 }
开发者ID:RonLab1987,项目名称:43berega,代码行数:5,代码来源:YDbQueue.php


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