/** * 商铺物业板块变更 * * @param $blockId * @param $newBlockId * @param $propertyId * @param $houseType * @param $houseLogType * @param $actionType * @return array */ public function dealBuildingOrPropertyAreaChange($blockId, $newBlockId, $propertyId, $houseType, $houseLogType, $actionType) { /** 获取精选的房源 */ $houseList = Model_House_JpHouseIdx::getChoiceHouseListByProperTyId($propertyId, $houseType); if (empty($houseList)) { return array(sprintf('没有获取到[property_id=%d, house_type=%d]的精选房源', $propertyId, $houseType)); } $rtn = array(); foreach ($houseList as $houseInfo) { $choicePlan = Model_Plan_Jp::getChoicePlanById($houseInfo['bidSpreadId']); if (empty($choicePlan)) { $rtn[] = sprintf('房源[%d]精选计划[%d]没有获取到计划', $houseInfo['id'], $houseInfo['bidSpreadId']); continue; } if ($choicePlan['isDelete']) { $rtn[] = sprintf('房源[%d]精选计划[%d]已删除', $houseInfo['id'], $houseInfo['bidSpreadId']); continue; } if ($choicePlan['status'] != Model_Plan_Jp::ENUM_STATUS_CHOICE_HOLD && $choicePlan['status'] != Model_Plan_Jp::ENUM_STATUS_ONLINE) { $rtn[] = sprintf('房源[%d]精选计划[%d]已停止[%d]', $houseInfo['id'], $houseInfo['bidSpreadId'], $choicePlan['status']); continue; } /** 写房源日志 */ $houseLog = array(); $houseLog['houseId'] = $choicePlan['houseId']; $houseLog['planId'] = $choicePlan['id']; $houseLog['brokerId'] = $choicePlan['ajkBrokerId']; $houseLog['cityId'] = $choicePlan['cityId']; $houseLog['type'] = $houseLogType; $houseLog['changeType'] = $actionType; $houseLog['remark'] = sprintf('房源所在物业、写字楼板块发生变更[%d -> %d]', $blockId, $newBlockId); $houseLog['addDate'] = date('Y-m-d H:i:s'); $houseLog['operatorId'] = 0; $houseLog['siteType'] = 3; if (!Model_Log_HouseLogNew::create($houseLog, date('Ymd'))->save()) { $rtn[] = sprintf('板块变更房源[%d]日志写入失败', $choicePlan['houseId']); continue; } $rtn[] = sprintf('板块变更房源[%d]日志写入成功', $choicePlan['houseId']); } return $rtn; }