public function handle_request() { $brokerId = $this->_brokerId; if (false == file_put_contents($this->_pidFile, $brokerId)) { return; } $this->logMsg(sprintf('开始处理经纪人【%d】', $brokerId)); $pictureList = Model_Jinpu_PersonalGallery::getGalleryByMemberId($brokerId); $group = array(); foreach ($pictureList as $pictureInfo) { $key = sprintf('%d_%d_%s_%d', $pictureInfo['member_id'], $pictureInfo['property_id'], $pictureInfo['key'], $pictureInfo['type']); if (isset($group[$key])) { $group[$key]++; if ($this->hideGalleryPicture($pictureInfo['id'])) { $this->logMsg(sprintf('隐藏经纪人【%d】的图片[%d]成功[%s]', $brokerId, $pictureInfo['id'], $key)); } else { $this->logMsg(sprintf('隐藏经纪人【%d】的图片[%d]失败[%s]', $brokerId, $pictureInfo['id'], $key)); } continue; } $group[$key] = 1; } $this->displayGalleryRepeatDetail($brokerId, $group); /** 删除 PID 文件用于判断是否处理成功 */ unlink($this->_pidFile); }
public function handle_request() { $brokerList = $this->getBrokerList(); foreach ($brokerList as $brokerInfo) { $brokerId = $brokerInfo['id']; $this->logMsg(sprintf('开始处理经纪人【%s】memberId:%d', $brokerInfo['realName'], $brokerId)); $this->setCursor($brokerId); $pictureList = Model_Jinpu_PersonalGallery::getGalleryByMemberId($brokerId); $group = array(); foreach ($pictureList as $pictureInfo) { $key = sprintf('%d_%d_%s_%d', $pictureInfo['member_id'], $pictureInfo['property_id'], $pictureInfo['key'], $pictureInfo['type']); if (isset($group[$key])) { $group[$key]++; if ($this->hideGalleryPicture($pictureInfo['id'])) { $this->logMsg(sprintf('隐藏经纪人【%s】的图片[%d]成功[%s]', $brokerInfo['realName'], $pictureInfo['id'], $key)); } else { $this->logMsg(sprintf('隐藏经纪人【%s】的图片[%d]失败[%s]', $brokerInfo['realName'], $pictureInfo['id'], $key)); } continue; } $group[$key] = 1; } $this->displayGalleryRepeatDetail($brokerId, $group); } if (count($brokerList) < self::BATCH_LIMIT) { $this->logMsg('处理完成....'); $this->done(true); } }