Ejemplo n.º 1
0
 /**
  * modified by wujie @2011-10-27 for pmt3134
  * 查询虚假房源
  * @param unknown_type $p_arrParams
  * @param int $p_IsWeeklyView 1-查寻7日内信息,0-查询30日内信息
  */
 public static function getFalsePropertys($p_arrParams = array(), $p_IsWeeklyView = 0)
 {
     apf_require_class('Util_Memcache');
     apf_require_class("DAO_Broker_common");
     //查询违规经纪人列表(加过滤判断)
     if (isset($p_arrParams['daydate']) and !empty($p_arrParams['daydate'])) {
         $intDate = $p_arrParams['daydate'];
     } else {
         $intDate = date('Ymd', time() - 86400);
     }
     $intCityId = isset($p_arrParams['cityid']) ? (int) $p_arrParams['cityid'] : 11;
     //判断是否是查询7日数据
     if ($p_IsWeeklyView) {
         $intLastTime = time() - 7 * 86400;
         $strSQL = "CITYID=? AND DAYDATE=? AND PUNISHTIME>=?";
         $arrParams = array($intCityId, $intDate, $intLastTime);
     } else {
         $strSQL = "CITYID=? AND DAYDATE=?";
         $arrParams = array($intCityId, $intDate);
     }
     $strListSQL = $strSQL . ' ORDER BY FALSENUM DESC,PUNISHTIME DESC';
     $intPage = isset($p_arrParams['page']) ? (int) $p_arrParams['page'] : 1;
     $intPageSize = isset($p_arrParams['pagesize']) ? (int) $p_arrParams['pagesize'] : 10;
     $intStart = ($intPage - 1) * $intPageSize;
     $strListSQL .= ' limit ' . $intStart . ', ' . $intPageSize;
     $arrBrokersList = Util_Memcache::memcached('DAO_Property_etc', 'getFalsePropertyStat', array($strListSQL, $arrParams, true), 7200);
     if (empty($arrBrokersList)) {
         return array('arrList' => array(), 'intBrokerTotalNum' => 0, 'intFalsePropertyTotalNum' => 0);
     }
     $arrProIds = array();
     foreach ($arrBrokersList as $arrItem) {
         $arrProId = json_decode($arrItem['LATESTFALSEPRO'], true);
         if (!empty($arrProId) && is_array($arrProId)) {
             $arrProIds = array_merge($arrProIds, $arrProId);
         }
     }
     //获取房源信息(LATESTFALSEPRO中所有房源,无过滤判断)
     $arrProData = array();
     if (!empty($arrProIds)) {
         $strProSql = "PROID IN (" . join(',', $arrProIds) . ")";
         $arrPropertys = DAO_Property_etc::getFalseProperty($strProSql, array());
         if (!empty($arrPropertys)) {
             foreach ($arrPropertys as $arrItem) {
                 $intProId = $arrItem['PROID'];
                 $arrProData[$intProId] = $arrItem;
             }
         }
     }
     //组织经纪人信息(加过滤判断)
     $arrBrokerData = array();
     foreach ($arrBrokersList as $arrItem) {
         $arrProId = json_decode($arrItem['LATESTFALSEPRO'], true);
         //判断是否是查询7日数据
         if ($p_IsWeeklyView) {
             $arrProIdTmp = array();
             //过滤出$arrItem['LATESTFALSEPRO']中7日内房源ID
             $strSql = "CITYID = ? and BROKERID = ? and PUNISHTIME >= ? order by DID asc";
             $arrFalseProps = Util_Memcache::memcached('DAO_Property_etc', 'getFalsePropByBrokerID', array($strSql, array($intCityId, $arrItem['BROKERID'], $intLastTime)), 7200);
             foreach ($arrFalseProps as $id => $arrFalseProp) {
                 if (in_array($arrFalseProp['PROID'], $arrProId)) {
                     array_push($arrProIdTmp, $arrFalseProp['PROID']);
                 }
             }
             $arrProId = $arrProIdTmp;
         }
         $arrItem['arrPropertys'] = array();
         foreach ($arrProId as $intProId) {
             if (isset($arrProData[$intProId]) && !empty($arrProData[$intProId])) {
                 $arrItem['arrPropertys'][] = $arrProData[$intProId];
             }
         }
         $arrBrokerInfo = DAO_Broker_common::getBrokerInfo($arrItem['BROKERID']);
         //区域板块显示优先级:门店 > 注册 > 违规记录 > 空
         if ($arrBrokerInfo) {
             if ($arrBrokerInfo['CST_BROKER_COMPANY_ID']) {
                 $arrStore = DAO_Common_common::getStoreDetail($arrBrokerInfo['CST_BROKER_COMPANY_ID']);
                 $strAreaCode = $arrStore['AREACODE'];
             } else {
                 $strAreaCode = $arrBrokerInfo['AREACODE'];
             }
             if (!$strAreaCode) {
                 $strAreaCode = $arrItem['AREACODE'];
             }
         }
         if (strlen($strAreaCode) > 8) {
             $arrArea = DAO_Common_common::getAreaInfo(substr($strAreaCode, 0, 8));
             $arrBlock = DAO_Common_common::getAreaInfo($strAreaCode);
         } else {
             $arrArea = DAO_Common_common::getAreaInfo($strAreaCode);
             $arrBlock = array();
         }
         $arrItem['AREAINFO'] = isset($arrArea['TYPENAME']) ? $arrArea['TYPENAME'] : '';
         $arrItem['BLOCKINFO'] = isset($arrBlock['TYPENAME']) ? $arrBlock['TYPENAME'] : '';
         $arrBrokerData[] = $arrItem;
     }
     //查询违规经纪人数量
     $arrBrokersCnt = Util_Memcache::memcached('DAO_Property_etc', 'getFalsePropertyStatCnt', array($strSQL, $arrParams, true), 7200);
     //查询违规房源数量
     if ($p_IsWeeklyView) {
         $strSQL = "CITYID = ? and PUNISHTIME >= ?";
         $arrFalsePropertyCnt = Util_Memcache::memcached('DAO_Property_etc', 'getFalsePropertysCnt', array($strSQL, array($intCityId, $intLastTime)), 7200);
     } else {
         $strSQL = "select sum(falsenum) from false_propertys_stat where cityid=? and daydate=?";
         $arrFalsePropertyCnt = Util_Memcache::memcached('DAO_Property_etc', 'getFalsePropertyCnt', array($strSQL, array($intCityId, $intDate)), 7200);
     }
     return array('arrList' => $arrBrokerData, 'intBrokerTotalNum' => $arrBrokersCnt, 'intFalsePropertyTotalNum' => $arrFalsePropertyCnt);
 }