public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Пример #2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     //区域板块
     $saleBlockList = Model_Mobile_CustomerSaleRange::getBrokerIdRange($brokerId, 1, 3);
     $saleBlock = array();
     if (!empty($saleBlockList)) {
         foreach ($saleBlockList as $key => $val) {
             $saleBlock[$key] = array('areaId' => $val['areaId'], 'area' => $val['area'], 'blockId' => $val['blockId'], 'block' => $val['block'], 'mapx' => $val['mapx'], 'mapy' => $val['mapy']);
         }
     }
     //主营小区
     $saleCommunityList = Model_Mobile_CustomerSaleRange::getBrokerIdRange($brokerId, 2, 10);
     $saleCommunity = array();
     if (!empty($saleCommunityList)) {
         foreach ($saleCommunityList as $key => $val) {
             $saleCommunity[$key] = array('communityId' => $val['communityId'], 'communityName' => $val['communityName']);
         }
     }
     //代理新盘
     $newCommunityList = Model_Mobile_CustomerNewPropRange::getBrokerIdRange($brokerId, 10);
     $newCommunity = array();
     if (!empty($newCommunityList)) {
         foreach ($newCommunityList as $key => $val) {
             $newCommunity[$key] = array('loupanId' => $val['loupanId'], 'loupanName' => $val['loupanName']);
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('saleBlock' => array_values($saleBlock), 'saleCommunity' => array_values($saleCommunity), 'newCommunity' => array_values($newCommunity)));
 }
Пример #3
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     //区域板块
     $saleBlockList = Model_Mobile_CustomerSaleRange::getBrokerIdRange($brokerId, 1, 1);
     //主营小区
     $saleCommunityList = Model_Mobile_CustomerSaleRange::getBrokerIdRange($brokerId, 2, 1);
     //代理新盘
     $newCommunityList = Model_Mobile_CustomerNewPropRange::getBrokerIdRange($brokerId, 1);
     if ($saleBlockList || $saleCommunityList || $newCommunityList) {
         $randed = 1;
     } else {
         $randed = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('randed' => $randed));
 }
Пример #4
0
 /**
  * @param $data
  * @return mixed
  */
 public function insertCustomerNewCommunityRange($data)
 {
     return Model_Mobile_CustomerNewPropRange::getInstance()->insertData($data);
 }
Пример #5
0
 /**
  * 添加代理新盘
  * @param $brokerId
  * @param $newCommunityData
  * @return bool
  */
 protected function doNewCommunity($brokerId, $newCommunityData)
 {
     $newCommunityList = Model_Mobile_CustomerNewPropRange::getBrokerIdRange($brokerId);
     $newCommunity = array();
     if (!empty($newCommunityList)) {
         foreach ($newCommunityList as $key => $val) {
             $newCommunity[$val['loupanId']] = $val;
         }
     }
     $insertData = array();
     if (!empty($newCommunityData) && is_array($newCommunityData)) {
         if (count($newCommunityData) > 10) {
             array_splice($newCommunityData, 10);
         }
         foreach ($newCommunityData as $key => $val) {
             if ($newCommunity[$val['loupanId']]) {
                 //unset已经存在的,剩余数据删除
                 unset($newCommunity[$val['loupanId']]);
             } else {
                 //插入数据
                 $insertData[] = $val;
             }
         }
     }
     if (!empty($newCommunity)) {
         $deleteDataId = array();
         foreach ($newCommunity as $key => $val) {
             $deleteDataId[] = $val['id'];
         }
     }
     if (!empty($deleteDataId)) {
         Model_Mobile_CustomerNewPropRange::delRangeByBrokerId($brokerId, $deleteDataId);
     }
     $flag = true;
     foreach ($insertData as $val) {
         $data = array();
         $data['loupanId'] = $val['loupanId'];
         $data['loupanName'] = $val['loupanName'];
         $data['cityId'] = $this->cityId;
         $data['brokerId'] = $brokerId;
         $data['createTime'] = time();
         $rs = Bll_CustomerRush_Customer::getInstance()->insertCustomerNewCommunityRange($data);
         if (!$rs) {
             $flag = false;
         }
     }
     return $flag;
 }