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


PHP Model_Broker_AjkBrokerExtend::getBrokersBetween方法代码示例

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


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

示例1: handle_request

 public function handle_request()
 {
     // 获取查询范围
     $beginTime = $this->cursor['updatedDatetime'];
     $endTime = $beginTime + $this->interval;
     // 获取当前的DB最新时间(考虑到Web Server和DB时间可能有差异,以DB时间为准)
     $fetchTime = $this->getDbCurrentTime();
     $formatBeginTime = date('Y-m-d H:i:s', $beginTime);
     $formatEndTime = date('Y-m-d H:i:s', $endTime);
     $formatFetchTime = date('Y-m-d H:i:s', $fetchTime);
     $this->log("*** BeginTime: {$formatBeginTime}; EndTime: {$formatEndTime}; FetchTime: {$formatFetchTime}");
     // 获取更新信息的经纪人列表,逐个判断待同步的字段是否有更新
     $brokers = Model_Broker_AjkBrokerExtend::getBrokersBetween($formatBeginTime, $formatEndTime);
     foreach ($brokers as $broker) {
         // 获取经纪人待同步字段
         $columns = $broker->getSyncFields();
         $columns = array_merge($columns, array('From' => 'User_BrokerSyncQueue'));
         // 提取新字段的MD5值
         ksort($columns);
         $context = json_encode($columns);
         $md5 = md5($context);
         // 获取经纪人最新同步记录
         $brokerInfo = Model_Log_LogMergeQueneNew::getLatestBroker($broker->brokerId);
         // 经纪人同步记录不存在 或者 存在且MD5值不一致,插入新纪录
         if (!$brokerInfo || $brokerInfo->md5 != $md5) {
             $params = array();
             $params['cityId'] = $broker->cityId;
             $params['brokerId'] = $broker->brokerId;
             $params['context'] = $context;
             $params['md5'] = $md5;
             $params['addTime'] = date('Y-m-d H:i:s');
             Model_Log_LogMergeQueneNew::insertQuene($params);
             $this->log("BrokerId: {$broker->brokerId} - Remark: Success,CheckState: {$broker->checkState}");
         } else {
             $this->log("BrokerId: {$broker->brokerId} - Remark: 经纪人待同步字段没有变更,CheckState: {$broker->checkState}");
         }
     }
     // 更新游标
     $this->cursor['updatedDatetime'] = min($endTime, $fetchTime);
     $this->setFlag($this->cursor);
 }
开发者ID:emilymwang8,项目名称:ajk-broker,代码行数:41,代码来源:BrokerSyncQueue.php


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