本文整理汇总了PHP中Model_Broker_AjkBrokerExtend::scanBroker方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Broker_AjkBrokerExtend::scanBroker方法的具体用法?PHP Model_Broker_AjkBrokerExtend::scanBroker怎么用?PHP Model_Broker_AjkBrokerExtend::scanBroker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Broker_AjkBrokerExtend
的用法示例。
在下文中一共展示了Model_Broker_AjkBrokerExtend::scanBroker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_request
public function handle_request()
{
$this->__logFile = sprintf('/home/www/logs/User_ImportUserInfo-%s.log', date('Ymd'));
if (file_exists($this->__idFile) && is_readable($this->__idFile)) {
$this->startId = intval(file_get_contents($this->__idFile));
}
$index = 1;
$pageSize = 1000;
while (true) {
echo "开始导入第{$index}批经纪人信息, 起始BrokerId={$this->startId}\n";
$brokerList = Model_Broker_AjkBrokerExtend::scanBroker($this->startId, $pageSize);
if (empty($brokerList)) {
break;
}
foreach ($brokerList as $broker) {
$this->startId = $broker['brokerId'];
file_put_contents($this->__idFile, $this->startId);
file_put_contents($this->__logFile, "{$index}: 导入经纪人: {$broker['trueName']}\tBrokerId: {$broker['brokerId']}\tUserId: {$broker['userId']}\n", FILE_APPEND);
/** $aid,$user_id,$broker_id,$city_id,$user_name,$gender,$phone,$properties,$origin_properties,$grade_score,$grade_level */
Bll_Cms_ActivityUserProperty::add_broker(1, $broker['userId'], $broker['brokerId'], $broker['cityId'], $broker['trueName'], $broker['gender'] == 1 ? 0 : 1, $broker['userMobile'], $broker['gradeScore'], $broker['gradeScore'], $broker['gradeScore'], $broker['gradeLevel']);
}
$index++;
}
echo "导入经纪人信息完成,结束BrokerId={$this->startId}\n";
}
示例2: getAjkBrokerExtendList
private function getAjkBrokerExtendList($limit = 1000)
{
return Model_Broker_AjkBrokerExtend::scanBroker($this->brokerId, $limit);
}
示例3: handle_request
public function handle_request()
{
$brokerList = Model_Broker_AjkBrokerExtend::scanBroker($this->_startId, self::BATCH_LIMIT);
if (empty($brokerList)) {
file_put_contents($this->_doneFile, 'YES');
}
foreach ($brokerList as $broker) {
$brokerId = $broker['brokerId'];
$cityId = $broker['cityId'];
$this->setCursor($brokerId);
/** 套餐城市的不予以处理 */
if (Bll_City::isComboCity($broker['cityId'])) {
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 是套餐城市,不予处理。', $brokerId, $cityId));
continue;
}
/** 判断经纪人所在城市是否已经开启多档封顶 */
if (false == Bll_Broker_Manage_AjkPropList::checkSelectLimitTempAvailable($cityId)) {
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 没有开启多档封顶,不予处理。', $brokerId, $cityId));
continue;
}
/** 获取经纪人城市封顶限额 */
$ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId);
if (empty($ppcLimitInfo)) {
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 获取封顶限额失败。', $brokerId, $cityId));
file_put_contents($this->_errorBroker, $brokerId, FILE_APPEND);
continue;
}
$ppcFixHouseCountLimit = $ppcLimitInfo['promotionLimit'];
/** 获取经纪人所有的定价计划 */
$fixPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($broker);
$fixSpreadHouseList = array();
foreach ($fixPlanList as $fixPlan) {
$planId = $fixPlan['id'];
/** 获取经纪人指定定价计划下房源计划关系 */
$fixSpreadHouseList = $fixSpreadHouseList + Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerId, $cityId, $planId);
}
$fixSpreadHouseCount = count($fixSpreadHouseList);
if ($fixSpreadHouseCount <= $ppcFixHouseCountLimit) {
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 可以推广[%d]套房源,实际推广了[%d]套房源,没有多余房源。', $brokerId, $cityId, $ppcFixHouseCountLimit, $fixSpreadHouseCount));
continue;
}
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 可以推广[%d]套房源,实际推广了[%d]套房源,多余[%d]房源下架。', $brokerId, $cityId, $ppcFixHouseCountLimit, $fixSpreadHouseCount, $fixSpreadHouseCount - $ppcFixHouseCountLimit));
/** 测试,不予以处理 */
file_put_contents('/data1/logs/Repair_Bug46849.test', $brokerId, FILE_APPEND);
continue;
$updateTime2IdMapping = array();
$updateTime = array();
foreach ($fixSpreadHouseList as $fixSpreadHouse) {
$intUpdateTime = strtotime($fixSpreadHouse['updatedDatetime']);
$updateTime[] = $intUpdateTime;
if (!isset($updateTime2IdMapping[$intUpdateTime])) {
$updateTime2IdMapping[$intUpdateTime] = array();
}
$updateTime2IdMapping[$intUpdateTime][] = $fixSpreadHouse;
}
$updateTime = array_unique($updateTime, SORT_NUMERIC);
rsort($updateTime, SORT_NUMERIC);
$relationList = array();
foreach ($updateTime as $key) {
$relationList = array_merge($relationList, $updateTime2IdMapping[$key]);
}
/** 需要下架的推广房源 */
$houseList = array_slice($relationList, 0, $fixSpreadHouseCount - $ppcFixHouseCountLimit);
foreach ($houseList as $house) {
if (Bll_Ppc_ServiceAPI::deleteHouseFromFixPlan($brokerId, $house['planId'], $house['propId'], 46849)) {
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]从计划[%d]下架成功。', $brokerId, $cityId, $house['propId'], $house['planId']));
continue;
}
$this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]从计划[%d]下架失败。', $brokerId, $cityId, $house['propId'], $house['planId']));
}
}
if (count($brokerList) < self::BATCH_LIMIT) {
$this->logMsg(sprintf('startId: %d 处理结束。', $this->_startId));
file_put_contents($this->_doneFile, 'YES');
return;
}
}