本文整理汇总了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);
}