/** * @param $cityId * @param $propId * @param $planType 1.定价,2.竞价,3.定+竟 * @param $status * @return array */ public static function updatePropStatus($cityId, $propId, $planType, $status) { $propPlanType = self::getPropPlanType($propId); /** 记录房源下线日志 */ if ($status != 1) { //TODO } $needMap2PropStatus = false; $propUpdatedStatus = $status; switch ($planType) { case 1: if (isset($propPlanType['bid']['isValid']) && !empty($propPlanType['bid']['isValid'])) { $propUpdatedStatus = $propPlanType['bid']['isValid']; $needMap2PropStatus = true; } break; case 2: if ($status == 1) { $propUpdatedStatus = 1; } else { if (isset($propPlanType['fix']['isValid']) && !empty($propPlanType['fix']['isValid'])) { $propUpdatedStatus = $propPlanType['fix']['isValid']; $needMap2PropStatus = true; } else { $propUpdatedStatus = $status; } } break; case 3: $propUpdatedStatus = $status; break; } if ($needMap2PropStatus) { $propUpdatedStatus = self::mapPropStatus($propUpdatedStatus); } /** 更新 prop 表 */ $prop = Model_House_HzProp::get_prop_info_by_prop_id($propId); $prop['contentBasic']['status'] = $propUpdatedStatus; Model_House_HzProp::updateProp($propId, array('contentBasic' => json_encode($prop['contentBasic']))); Model_House_HzPropSearch::updatePropStatus($cityId, $propId, $propUpdatedStatus); return $propPlanType; }
/** * 更新房源推广类型 * * @param $cityId * @param $propId * @param $type */ public static function updateSpreadType($cityId, $propId, $type) { $propSearchInfo = Model_House_HzPropSearch::get_prop_by_prop_id($cityId, $propId); switch ($type) { case 1: // 定价增 if (empty($propSearchInfo['spread_type']) || $propSearchInfo['spread_type'] == 2) { $propSearchInfo['spread_type'] = $propSearchInfo['spread_type'] + 1; } break; case 2: // 定价减 if (!empty($propSearchInfo['spread_type'])) { $propSearchInfo['spread_type'] = $propSearchInfo['spread_type'] - 1; } break; case 3: // 定价、竞价减 $propSearchInfo['spread_type'] = 0; break; case 4: // 竞价增 if (empty($propSearchInfo['spread_type']) || $propSearchInfo['spread_type'] == 1) { $propSearchInfo['spread_type'] = $propSearchInfo['spread_type'] + 2; } break; case 5: // 竞价减 if ($propSearchInfo['spread_type'] == 3 || $propSearchInfo['spread_type'] == 2) { $propSearchInfo['spread_type'] = $propSearchInfo['spread_type'] - 2; } break; } $propSearchInfo['spread_type'] = $propSearchInfo['spread_type'] < 0 ? 0 : $propSearchInfo['spread_type']; if ($propSearchInfo['spread_type'] > 3) { $propSearchInfo['spread_type'] = $propSearchInfo['spread_type'] % 2 == 0 ? 2 : 1; } Model_House_HzPropSearch::updateProp($cityId, $propId, array('spread_type' => $propSearchInfo['spread_type'])); $propInfo = Model_House_HzProp::get_prop_info_by_prop_id($propId); $propInfo['contentBasic']['spread_type'] = $propSearchInfo['spread_type']; Model_House_HzProp::updateProp($propId, array('contentBasic' => json_encode($propInfo['contentBasic']))); }
/** * 更新房源状态 * * @param $propId * @param $newStatus */ public static function updatePropStatus($propId, $newStatus) { $prop = Model_House_HzProp::get_prop_info_by_prop_id($propId); if (empty($prop)) { return; } $prop['contentBasic']['status'] = $newStatus; Model_House_HzProp::updateProp($propId, array('contentBasic' => json_encode($prop['contentBasic']))); }