/**
  * 处理小区id为0的情况
  * @param $beginId
  * @param $nocomms
  * @param $cityId
  * @param int $limit
  * @return array
  */
 public function dealPropCommidZero($beginId, $nocomms, $cityId, $limit = 100)
 {
     $allReturn = array();
     if (empty($nocomms)) {
         return array('status' => 0, 'msg' => 'nocomms is empty');
     }
     $searchProps = Bll_HzProp::getSearchProps(array('where' => 'status in (1,2,5,6,9,11,12,13,14,15) and cityid=? and proid>? limit ' . $limit, 'params' => array($cityId, $beginId)), $cityId);
     if (empty($searchProps)) {
         return array('status' => 0, 'msg' => 'empty');
     }
     foreach ($searchProps as $searchProp) {
         $proId = $this->cursor = $searchProp['proid'];
         if ($searchProp['commid']) {
             continue;
         }
         $prop = Bll_HzProp::get_prop($proId);
         foreach ($nocomms as $index => $nocomm) {
             $blockInofNew = Bll_HzProp::getBlockByTypeCode($nocomm['new_code']);
             $blockInofOld = Bll_HzProp::getBlockByTypeCode($nocomm['old_code']);
             if (!$blockInofNew || !$blockInofOld) {
                 return array('status' => 0, 'msg' => 'block info is empty');
             }
             if ($prop['blockid'] == $blockInofOld['id'] && $prop['areaid'] == $blockInofOld['parentid']) {
                 // 更新房源信息
                 $result = $this->changePropBlock($proId, $blockInofNew['id'], $blockInofNew['parentid'], $cityId, $searchProp['ajk_brokerid']);
                 if ($result['status'] == 0) {
                     $this->setLog('租房房源区域板块更新失败 id:[ ' . $proId . ' ]' . ' info:' . $result['msg']);
                 } else {
                     $this->setLog('租房房源区域板块更新成功 id:[ ' . $proId . ' ]');
                     //通知上下架队列
                     $param['prop_id'] = $proId;
                     $param['spread_id'] = 0;
                     //
                     $param['ajk_broker_id'] = $searchProp['ajk_brokerid'];
                     $param['from'] = 'cms_' . __FUNCTION__;
                     $param['time'] = time();
                     $param['operate_id'] = 0;
                     $param['site_type'] = 2;
                     $param['remark'] = json_encode(array('cityId' => $cityId, 'old' => $nocomm['old_code'], 'new' => $nocomm['new_code']));
                     $param['type'] = 'community_area_change_ex';
                     $getRes = $this->action_collect_Api_new($param);
                     $res = json_decode($getRes, true);
                     if ($res['status'] == 'err') {
                         $this->setLog('调用上下架队列api失败,租房房源id:[ ' . $proId . ' ] info:' . $res['msg']);
                     } else {
                         $this->setLog('调用上下架队列api成功,租房房源id:[ ' . $proId . ' ] info:' . $res['msg']);
                     }
                 }
                 $allReturn = array_merge($allReturn, $result['msg']);
             }
         }
     }
     return array('status' => 1, 'msg' => $allReturn);
 }
Ejemplo n.º 2
0
 /**
  * 处理小区id为0的情况
  * @param $beginId
  * @param $nocomms
  * @param $cityId
  * @param $youBiaoFile
  * @param int $limit
  * @return array
  */
 public static function dealPropCommidZero($beginId, $nocomms, $cityId, $youBiaoFile, $limit = 1000)
 {
     $allReturn = array();
     if (empty($nocomms)) {
         return self::buildReturn(0, 'nocomms is empty');
     }
     // sql commid=0去掉
     $searchProps = Bll_HzProp::getSearchProps(array('where' => 'status in (1,2,5,6,9,11,12,13,14,15) and cityid=? and proid>? limit ' . $limit, 'params' => array($cityId, $beginId)), $cityId);
     if (empty($searchProps)) {
         return self::buildReturn(0, 'empty');
     }
     foreach ($searchProps as $searchProp) {
         $proId = $searchProp['proid'];
         file_put_contents($youBiaoFile, $proId);
         if ($searchProp['commid']) {
             continue;
         }
         $prop = self::get_prop($proId);
         foreach ($nocomms as $index => $nocomm) {
             $blockInofNew = Bll_HzProp::getBlockByTypeCode($nocomm['new_code']);
             $blockInofOld = Bll_HzProp::getBlockByTypeCode($nocomm['old_code']);
             if (!$blockInofNew || !$blockInofOld) {
                 return self::buildReturn(0, 'block info is empty');
             }
             if ($prop['blockid'] == $blockInofOld['id'] && $prop['areaid'] == $blockInofOld['parentid']) {
                 // 更新房源信息
                 $result = self::changePropBlock($proId, $blockInofNew['id'], $blockInofNew['parentid'], $cityId);
                 if (!$result['status']) {
                     return $result;
                 }
                 $allReturn = array_merge($allReturn, $result['msg']);
             }
             /*else {
                   $allReturn[] = "proid: " . $proId . ",不需要更新";
               }*/
         }
     }
     return self::buildReturn(1, $allReturn);
 }