Beispiel #1
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $brokerId = $request->getBrokerId();
     $cityId = $request->getBrokerCityId();
     $sukId = $params['sukId'];
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     $companyId = intval($brokerInfo['COMPANYID']);
     if ($companyId > 0) {
         /** 通过配置文件配置那些城市的非独立经纪人不可以购买月套餐 */
         $canNotBuyMonthlyComboCitySet = APF::get_instance()->get_config('can_not_buy_monthly_combo_city_set');
         if (is_array($canNotBuyMonthlyComboCitySet) && in_array($cityId, $canNotBuyMonthlyComboCitySet)) {
             $companyId = 0;
         }
     }
     //经纪人能否购买
     $buyComboInfo = Bll_Combo_Broker_BrokerComboInfo::getBrokerallowBuy($brokerId, $cityId, $sukId, $companyId);
     $objResponse->set_content_type('application/json');
     echo json_encode($buyComboInfo);
     return false;
 }
Beispiel #2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $skuId = $this->_params['skuId'];
     $password = $this->_params['password'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $userId = $brokerInfo->userId;
     if ($brokerInfo->payType != 9999) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_IS_NOT_COMBO);
         //非套餐经纪人不能购买套餐
     }
     //购买
     $md5_password = md5($password);
     //密码加密
     $baseencode_password = base64_encode($md5_password);
     $userInfo = Model_Broker_Member::getAjkMembersByUserId($userId);
     //验证密码
     if ($userInfo->userPwd == $baseencode_password) {
         $result = Bll_Combo_Broker_BrokerComboInfo::brokerBuyCombo($userId, $skuId);
         if ($result['status'] == 'ok') {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '购买成功'));
         } else {
             switch ($result['code']) {
                 case '400539':
                 case '400015':
                 case '400540':
                 case '400545':
                 case '400498':
                 case '400541':
                 case '505008':
                 case '398489':
                 case '398491':
                 case '402205':
                 case '404086':
                     throw new Exception_JavaApiException($result['info']);
                     break;
                 case '398490':
                     throw new Exception_SameComboException('不支持再购买同类型套餐');
                     break;
                 case '402207':
                     throw new Exception_Account_BalanceNotEnough('余额不足');
                     break;
                 case '505007':
                     throw new Exception_Broker_NotPassCheck('您的双证审核未通过');
                     break;
                 default:
                     return Util_MobileAPI::error(Const_APIStatus::E_COMBO_BUY_COMBO_FAILED);
                     //购买失败
             }
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PASSWORD_DIFFERENT);
         //密码错误
     }
 }
Beispiel #3
0
 public function handle_request_combo()
 {
     $ajkBrokerId = $this->brokerId;
     $cityId = $this->cityId;
     //套餐信息
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($ajkBrokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         //获取当前使用的套餐
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['rentPropNum'] + $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'];
     $currentComboName = $currentCombo['name'];
     //二手房套餐列表
     $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($ajkBrokerId, $cityId);
     $comboEsfPropIds = array_keys($comboEsfList);
     //租房套餐列表
     $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $comboZuFangPropIds = array();
     foreach ($comboZuFangList as $v) {
         $comboZuFangPropIds[] = (int) $v['houseId'];
     }
     $currentComboUsed = count($comboZuFangPropIds) + count($comboEsfPropIds);
     $canSpread = $currentComboUsed >= $currentComboTotal ? 0 : 1;
     $propId = $this->_params['propId'];
     $comboInfo = Bll_Combo_HouseRelation::getHouseRelation($ajkBrokerId, $cityId, $propId, Bll_Combo_HouseRelation::SITE_TYPE_HZ);
     if (!empty($comboInfo) && $comboInfo[0]['state'] > 100 & $comboInfo[0]['state'] < 200) {
         //推广中
         $status = 2;
         $statusMsg = '套餐推广中';
         $currentComboInfo = $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})";
     } else {
         $comboInfos = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($ajkBrokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ);
         if (empty($comboInfos)) {
             $status = 0;
             $statusMsg = '尚未购买套餐,请购买套餐';
             $currentComboInfo = '尚未购买套餐';
         } else {
             $status = 1;
             $statusMsg = '好房源,不推广就浪费了~';
             $currentComboInfo = $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})";
         }
     }
     $startDate = $endDate = date('Ymd');
     $todayClicks = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($propId, $startDate, $endDate, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ);
     $totalClicks = Bll_House_HzHouse::getComboHouseAccumulateClick($ajkBrokerId, $propId, $cityId);
     $todayClick = $todayClicks[$propId][$startDate] ?: 0;
     $totalClick = $totalClicks[$propId] ?: 0;
     $totalClick += $todayClick;
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClick, 'totalClicks' => $totalClick, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo));
 }
Beispiel #4
0
 public function do_getComboPropClickInfo()
 {
     $proIds = is_string($this->params['proIds']) ? explode(',', $this->params['proIds']) : $this->params['proIds'];
     $data = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($proIds, date('Ymd'), date('Ymd'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ);
     $result = array();
     foreach ($proIds as $proId) {
         if (!$data || !$data[$proId]) {
             $result[$proId] = 0;
         } else {
             $result[$proId] = $data[$proId][date('Ymd')];
         }
     }
     return Util_GlobalFunc::buildReturn(1, $result);
 }
Beispiel #5
0
 private function checkConsume($brokerId, $cityId)
 {
     $result = array('isFree' => 0, 'isPlan' => 0, 'data' => '');
     $isComboCity = Bll_Combo_HouseRelation::ifComboCity($cityId);
     if ($isComboCity) {
         $conbosProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($brokerId);
         // 检查是否购买套餐
         if ($conbosProNum['totalSalePropNum'] <= 0) {
             $result['isPlan'] = 0;
             echo json_encode($result);
             exit;
         } else {
             $result['isPlan'] = 1;
         }
     } else {
         $result['isPlan'] = 1;
     }
     // 检查城市是否收费
     $checkFree = Bll_Broker_EntrustPrice::getInstance()->checkCityConsumeStatus($cityId);
     if ($checkFree == true) {
         // 收费
         // 获取余额
         $userId = Bll_Broker_BrokerCheckInfo::getUserIdByBrokerId($brokerId, 'sale');
         $balance = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerMoney($userId);
         // 获取委托价格
         $startDate = date("Ymd");
         $price = Bll_Broker_EntrustPrice::getInstance()->getSalePrice(self::$BrokerInfo['BaseInfo']['CITYID'], $startDate);
         $price = $price / 100;
         if ($balance >= $price) {
             $isEnough = 1;
         } else {
             $isEnough = 0;
         }
         $result['isFree'] = 0;
         $result['data'] = array('isEnough' => $isEnough, 'balance' => $balance . "元", 'price' => $price . "元");
     } else {
         // 不收费
         $houseId = intval($this->params['houseId']);
         $brokerName = self::$BrokerInfo['BaseInfo']['TRUENAME'];
         $brokerPhone = self::$BrokerInfo['BaseInfo']['USERMOBILE'];
         $consume = Bll_Broker_EntrustQuery::getInstance()->saleRush($houseId, $brokerId, $brokerName, $brokerPhone, $cityId, Const_Entrust::RUSH_FROM_PC, false, $isComboCity);
         $result['isFree'] = 1;
         $result['data'] = $consume;
     }
     echo json_encode($result);
     exit;
 }
Beispiel #6
0
 public function handle_request_internal()
 {
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     //经纪人信息
     if ($brokerInfo['PAYTYPE'] != 9999) {
         APF::get_instance()->get_response()->redirect('/user/combo/brokerhome');
         exit;
     }
     $updateCombos = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboForUpdate(self::$intUserID);
     $this->out['updateCombos'] = $updateCombos;
     //账户余额
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => self::$intUserID));
     $balancePerson = round($balance['data']['personBalance'] / 100, 2);
     //账户余额(个人)
     $this->out['balancePerson'] = $balancePerson;
     $this->setAttribute('out', $this->out);
     return 'Combo_Update_Update';
 }
Beispiel #7
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     usort($comboInfoList, function ($a, $b) {
         return $a['startTime'] > $b['startTime'] ? 1 : ($a['startTime'] == $b['startTime'] ? 0 : -1);
     });
     $currentCombo = array();
     $nextCombo = array();
     $currentDate = time();
     $currentComboStartDate = 0;
     $currentComboEndDate = 0;
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         $totalPropNum = $comboInfo['rentPropNum'] + $comboInfo['salePropNum'];
         /** 获取当前使用的非商铺套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $totalPropNum > 0) {
             $currentCombo = $comboInfo;
             $currentComboStartDate = $startDate;
             $currentComboEndDate = $endDate;
         }
         /** 获取续买的非商铺套餐 */
         if ($comboInfo['rentPropNum'] > 0 && $startDate > $currentDate) {
             if (!empty($nextCombo)) {
                 $nextComboEffectTime = strtotime($nextCombo['startTime']);
                 if ($nextComboEffectTime > $startDate) {
                     $nextCombo = $comboInfo;
                 }
             } else {
                 $nextCombo = $comboInfo;
             }
         }
     }
     return array('status' => 'ok', 'data' => array('currentCombo' => $currentCombo['name'], 'startDate' => date('Y.m.d', $currentComboStartDate), 'endDate' => date('Y.m.d', $currentComboEndDate), 'nextCombo' => $nextCombo['name']));
 }
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $cityId = $brokerInfo->cityId;
     if (empty($cityId)) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     //获取城市可选择的套餐列表
     $comboListInfo = Bll_Combo_Broker_BrokerComboInfo::getComboList($cityId);
     if (empty($comboListInfo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('comboList' => array()));
     }
     $comboList = array();
     foreach ($comboListInfo as $combo) {
         $tmpStr = '';
         if ($combo['salePropNum']) {
             $tmpStr = $tmpStr ? $tmpStr . ',出售房源' . $combo['salePropNum'] . '套' : '出售房源' . $combo['salePropNum'] . '套';
         }
         if ($combo['rentPropNum']) {
             $tmpStr = $tmpStr ? $tmpStr . ',租房' . $combo['rentPropNum'] . '套' : '租房' . $combo['rentPropNum'] . '套';
         }
         if ($combo['jpPropNum']) {
             $tmpStr = $tmpStr ? $tmpStr . ',商业地产房源' . $combo['jpPropNum'] . '套' : '商业地产房源' . $combo['jpPropNum'] . '套';
         }
         $combo['description'] = '可推广' . $tmpStr;
         foreach ($combo['types'] as $key => $type) {
             $type['price'] = $type['price'] / 100.0;
             $type['priceUnit'] = '元';
             $type['originPrice'] = $type['originPrice'] / 100.0;
             $type['originPriceUnit'] = '元';
             $combo['types'][$key] = $type;
         }
         unset($combo['comboId']);
         $comboList[] = $combo;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('comboList' => $comboList));
 }
Beispiel #9
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //获取经纪人套餐推广今日点击量
     $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK);
     //经纪人没有套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => 0));
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     if ($propIds) {
         $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
         $propsNum = count($propsInfo);
     } else {
         $propsNum = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => $propsNum));
 }
Beispiel #10
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             $comboPropNum = $currentCombo['salePropNum'];
             if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
                 $comboPropNum = $currentCombo['rentPropNum'] + $currentCombo['salePropNum'];
             }
             break;
         }
     }
     $hasCombo = 0;
     //没有二手房套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => 0, 'hasCombo' => $hasCombo));
     } else {
         $hasCombo = 1;
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($brokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK, true);
     } else {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK);
     }
     //套餐还可以推的房源数量
     $surplus = $comboPropNum - $currentSpreadHouseCount;
     if (empty($comboSpreadHouseList)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => $surplus, 'hasCombo' => $hasCombo));
     }
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
     //批量获取默认图片
     $propDefImages = Model_House_AjkPropertyData::getDafImages($propIds);
     //批量获取房源总点
     $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propIds);
     $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propIds, $cityId);
     //房源竞价&精选计划
     $propSpreadInfo = Model_Plan_EsfAjkPropSpread::getPlanByPropIds($propIds);
     //拼接房源列表中房源数据
     $newList = array();
     $oldList = array();
     foreach ($propsInfo as $prop) {
         $row = array();
         $row['propId'] = $prop->proId;
         $row['title'] = $prop->proName;
         $row['commId'] = $prop->commId;
         $row['commName'] = $prop->commName;
         $row['roomNum'] = $prop->roomNum;
         $row['hallNum'] = $prop->hallNum;
         $row['area'] = round($prop->areaNum);
         $row['toiletNum'] = $prop->toiletNum;
         $row['price'] = intval($prop->proPrice);
         $row['priceUnit'] = '万';
         $row['isBid'] = 0;
         $row['isChoice'] = 0;
         $row['isMoreImg'] = $prop->isHighQulity;
         $row['isPhonePub'] = $prop->uriCode == 'mobile.asyn' || $prop->uriCode == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $row['isVisible'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         //0-违规房源 1-非违规房源
         $row['createTime'] = $prop->postDate;
         //房源发布时间
         $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$prop->proId]);
         if ($prop->commitionType == 2) {
             $row['isEntrust'] = 1;
         } else {
             $row['isEntrust'] = 0;
         }
         $row['totalClicks'] = $houseTodayClickInfo[$prop->proId] + $houseClickInfo[$prop->proId];
         if (isset($propSpreadInfo[$prop->proId])) {
             if ($propSpreadInfo[$prop->proId]->bidVersion == 1 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) {
                 $row['isBid'] = 1;
             } elseif ($propSpreadInfo[$prop->proId]->bidVersion == 2 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) {
                 $row['isChoice'] = 1;
             }
         }
         //计算出房源发布天数
         $timeFixStr = strtotime(date("Ymd", $row['createTime']));
         $leftDay = floor((time() - $timeFixStr) / 86400);
         if ($leftDay >= 30) {
             $oldList[] = $row;
         } else {
             $newList[] = $row;
         }
     }
     // 排序
     usort($oldList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     usort($newList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus > 0 ? $surplus : 0, 'hasCombo' => $hasCombo));
 }
Beispiel #11
0
 /**
  * 111 房源手动套餐推广
  *
  * 1. 判断房源信息
  * 2. 获取经纪人套餐信息
  * 3. 获取经纪人当前推广中的房源数
  * 4. 判断经纪人已经推广的房源数 是否超过 套餐限制
  *      1. 超过 则 设置房源 套餐推广关系为未推广 结束
  * 5. 通知 用户端上线房源
  *
  * @param $params
  * @return array
  */
 public static function pro_start_combo($params)
 {
     $currentCombo = Bll_Combo_Broker_BrokerComboInfo::getBrokerCurrentCombo($params['broker_id'], Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK);
     /** 经纪人当前没有生效的套餐 */
     if (empty($currentCombo)) {
         return static::build_return(1, array(sprintf('%d 经纪人当前[%s]没有生效的租售套餐', $params['id'], date('Y-m-d H:i:s'))));
     }
     /** 获取经纪人当前在线的房源数 */
     /* 此处不需要判断。由于前台已经插入关系或者并发 都导致这个地方失败
         $onlineHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($params['broker_id'], $params['city_id'], Bll_Combo_HouseRelation::SITE_TYPE_AJK);
        if ($onlineHouseCount >= $currentCombo['salePropNum']) {
            return static::build_return(1, sprintf('%d 经纪人当前[%s]推广中的房源数[%d]超出套餐可推广房源数[%d]。', $params['id'], date('Y-m-d H:i:s'), $onlineHouseCount, $currentCombo['salePropNum']));
        }*/
     // 查询套餐关系
     if (!($comboRelations = Bll_Combo_HouseRelation::getRelationByHouseId($params['pro_id'], Bll_Combo_HouseRelation::SITE_TYPE_AJK))) {
         return self::build_return(0, array('房源[' . $params['pro_id'] . ']套餐关系为空'));
     }
     if (!Bll_Combo_HouseRelation::isRelationOnline($comboRelations['state'])) {
         return self::build_return(0, array('房源[' . $params['pro_id'] . ']套餐关系不在线'));
     }
     $data = self::build_prop_log($params, 20, '房源手动套餐推广;队列表id为' . $params['id'], $params['broker_id']);
     if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         return self::build_return(0, array('房源[' . $params['pro_id'] . ']手动套餐推广日志写入失败'));
     }
     return self::build_return(1, array('房源[' . $params['pro_id'] . ']手动套餐推广日志写入成功'));
 }
Beispiel #12
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $userId = $request->getUserId();
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     $siteType = $params['site_type'];
     //网站类型
     $isChoiceCity = Bll_City::isChoiceCity($cityId);
     $isBidCity = Bll_City::isBidCity($cityId);
     //返回数据
     $result = array();
     //网站类型
     $result['type'] = $siteType;
     //套餐、竞价近7天
     $ComboClick = Bll_Combo_Broker_BrokerComboInfo::getBrokerSevenClick($brokerId, $cityId, $siteType, $isBidCity || $isChoiceCity);
     $result['today_click'] = $ComboClick['today_click'];
     //当前情况
     $result['seven_days_click'] = $ComboClick['seven_days_click'];
     //7天情况
     //推广房源优良中
     $ComboProRank = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboProRank($brokerId, $siteType, $cityId);
     if ($siteType == 'ajk' || $siteType == 'hz') {
         $result['combo_house_info']['comboCount'] = count($ComboProRank['list']);
         //套餐推广数
         $result['combo_house_info']['superior'] = isset($ComboProRank['count'][3]['rankStarNum']) ? $ComboProRank['count'][3]['rankStarNum'] : 0;
         //优
         $result['combo_house_info']['well'] = isset($ComboProRank['count'][2]['rankStarNum']) ? $ComboProRank['count'][2]['rankStarNum'] : 0;
         //良
         $result['combo_house_info']['middling'] = isset($ComboProRank['count'][1]['rankStarNum']) ? $ComboProRank['count'][1]['rankStarNum'] : 0;
         //中
         $result['combo_house_info']['undetermined'] = isset($ComboProRank['count'][0]['rankStarNum']) ? $ComboProRank['count'][0]['rankStarNum'] : 0;
         //待评
     } else {
         $result['combo_house_info']['comboCount'] = count($ComboProRank['list']);
         //套餐推广数
         $result['combo_house_info']['quality'] = isset($ComboProRank['count'][1]['exquisiteStarNum']) ? $ComboProRank['count'][1]['exquisiteStarNum'] : 0;
         //精品
         $result['combo_house_info']['unQuality'] = isset($ComboProRank['count'][2]['exquisiteStarNum']) ? $ComboProRank['count'][2]['exquisiteStarNum'] : 0;
         //非经
     }
     //查询违规房源数
     $result['combo_house_info']['foul'] = Bll_Combo_Broker_BrokerComboInfo::getBrokerIllegalNum($brokerId, $cityId, $siteType);
     //违规
     if ($isChoiceCity || $isBidCity) {
         //查询竞价房源数
         $result['combo_house_info']['bidding'] = Bll_Combo_Broker_BrokerComboInfo::getBrokerBidNum($brokerId, $cityId, $siteType);
         //竞价
     }
     //json字符串输出
     $objResponse->set_content_type('application/json');
     echo json_encode($result);
     // 给宋刘伟造的假数据
     //        $tmpArr = array(
     //            'type'=>'ajk',
     //            'today_click'=>array(
     //                'combo'=>65,
     //                'bidding'=>70,
     //            ),
     //            'seven_days_click'=>array(
     //                '7-1'=>array(
     //                    'combo'=>30,
     //                    'bidding'=>48,
     //                ),
     //                '7-2'=>array(
     //                    'combo'=>23,
     //                    'bidding'=>46,
     //                ),
     //                '7-3'=>array(
     //                    'combo'=>28,
     //                    'bidding'=>40,
     //                ),
     //                '7-4'=>array(
     //                    'combo'=>32,
     //                    'bidding'=>40,
     //                ),
     //                '7-5'=>array(
     //                    'combo'=>40,
     //                    'bidding'=>50,
     //                ),
     //                '7-6'=>array(
     //                    'combo'=>50,
     //                    'bidding'=>55,
     //                ),
     //                '7-7'=>array(
     //                    'combo'=>65,
     //                    'bidding'=>70,
     //                ),
     //            ),
     //            'combo_house_info'=>array(
     //                'comboCount'=>30,//
     //                'superior'=>20,//优
     //                'well'=>5,//良
     //                'middling'=>2,//中
     //                'undetermined'=>3,//待评
     //                'foul'=>0,//违规
     //                'bidding'=>10,//竞价
     //            ),
     //        );
     //        echo json_encode($tmpArr);
     return true;
 }
Beispiel #13
0
 private static function preparePropInfo(&$out)
 {
     $out['propInfo'] = Bll_House_JpHouseInfo::getHouseInfoExt($out['proId']);
     if ($out['propInfo']['info']['isDelete'] == 1) {
         //房源删除 跳转管理页面
         APF::get_instance()->get_response()->redirect('/ajkbroker/combo/broker/manage/jp');
     }
     // 获取房源图片数 默认图片url
     $imageInfo = BLL_House_JpHouseManage::getPropImageInfo($out['proId'], $out['propInfo']['houseType']);
     $out['imgInfo'] = $imageInfo;
     //获取物业名称
     $propertyId = $out['propInfo']['houseType'] > 2 ? $out['propInfo']['info']['propertyId'] : $out['propInfo']['info']['buildingId'];
     $propertyInfo = Model_House_JpProperty::data_access()->filter('id', intval($propertyId))->get_row();
     $out['propertyName'] = $propertyInfo['name'];
     //房源的最近七天点击量/花费
     $clickAll = BLL_House_JpHouseManage::get7DaysHouseClick($out['proId']);
     //套餐房源点击量
     $comboClick = array();
     if ($out['isComboBroker']) {
         $comboClickInfo = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($out['proId'], date('Y-m-d', strtotime('-6 days')), date('Y-m-d'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_JP);
         $comboClick = $comboClickInfo[$out['proId']];
         //var_dump($comboClick);die;
     }
     $out['comboClick'] = $comboClick;
     $out['clickAndCost'] = $clickAll;
 }
Beispiel #14
0
 public function handle_request_combo()
 {
     $ajkBrokerId = $this->brokerId;
     $cityId = $this->cityId;
     $siteType = Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ;
     //首先获取套餐关系房源列表 ---- 那房源到主表去除status 已删除的房源 -----在房源主表获取房源基本信息
     $comboList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, $siteType, 1);
     $surplus = $hasCombo = 0;
     //获取套餐信息-首先判断经纪人有无套餐
     $comboInfos = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($ajkBrokerId, $siteType);
     if (count($comboInfos) > 0) {
         $index = Bll_Combo_Broker_BrokerComboInfo::getComboIndexBySiteType($siteType);
         $currentTime = time();
         foreach ($comboInfos as $combo) {
             if ($combo[$index] == 0) {
                 continue;
             }
             if (strtotime($combo['endTime']) > $currentTime && strtotime($combo['startTime']) < $currentTime) {
                 $currentCombo = $combo;
             }
         }
         if (!empty($currentCombo)) {
             $surplus = $currentCombo['rentPropNum'];
             if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
                 //商业地产没打通
                 $surplus = $currentCombo['rentPropNum'] + $currentCombo['salePropNum'];
             }
             $hasCombo = 1;
         }
     }
     //获取当前已推广套餐数量
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($ajkBrokerId, $siteType, true);
     } else {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($ajkBrokerId, $cityId, $siteType);
     }
     $oldList = $newList = array();
     if (empty($comboInfos)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo));
     }
     $propIds = array();
     foreach ($comboList as $row) {
         $propIds[] = $row['houseId'];
     }
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId);
     $comboPropList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $this->cityId);
     foreach ($comboPropList as $key => $list) {
         if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
             unset($comboPropList[$key]);
         }
     }
     //fix bug45133
     if (empty($comboPropList)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo));
     }
     $propIds = array();
     foreach ($comboPropList as $row) {
         $propIds[] = $row['proid'];
     }
     //从主表获取房源信息
     $propertyList = Model_House_HzProp::getPropsByPropIds($propIds);
     //获取是否精选或者竞价
     $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING));
     if (!empty($relations)) {
         $planPropMap = array();
         foreach ($relations as $relation) {
             $planIds[] = $relation['plan_id'];
             $planPropMap[$relation['plan_id']] = $relation['proid'];
         }
         if (!empty($planIds)) {
             $plans = Model_Plan_HzPlanBasic::getPlansByIds($planIds);
             foreach ($plans as $plan) {
                 if ($plan->flag == 0) {
                     continue;
                 }
                 if ($plan->bid_version == 2) {
                     $propId = $planPropMap[$plan['id']];
                     $propertyList[$propId]['isChoice'] = 1;
                 } else {
                     $propId = $planPropMap[$plan['id']];
                     $propertyList[$propId]['isBid'] = 1;
                 }
             }
         }
     }
     // 批量获取房源的默认图片
     $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds);
     if (!empty($defaultImages)) {
         foreach ($defaultImages as $defaultImage) {
             $propertyList[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
         }
     }
     krsort($propertyList);
     $startDate = $endDate = date('Ymd');
     $todayClicks = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($propIds, $startDate, $endDate, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ);
     $totalClicks = Bll_House_HzHouse::getComboHouseAccumulateClick($ajkBrokerId, $propIds, $cityId);
     foreach ($propertyList as $list) {
         $row = array();
         $row['id'] = $list['propId'];
         $row['propId'] = $list['propId'];
         $row['title'] = $list['title'];
         $row['imgUrl'] = $list['imgUrl'] ?: '';
         $row['commId'] = $list['commid'];
         $row['commName'] = $list['commname'];
         $row['roomNum'] = $list['roomnum'];
         $row['hallNum'] = $list['hallnum'];
         $row['toiletNum'] = $list['toilnetnum'];
         $row['area'] = round($list['areanum']);
         $row['price'] = round($list['pricenum']);
         $row['priceUnit'] = '元/月';
         $row['todayClicks'] = $todayClicks[$list['propId']][$startDate] ?: 0;
         $row['totalClicks'] = $totalClicks[$list['propId']] ?: 0;
         $row['totalClicks'] = $row['totalClicks'] + $row['todayClicks'];
         $row['isBid'] = isset($list['isBid']) ? $list['isBid'] : 0;
         $row['isChoice'] = isset($list['isChoice']) ? $list['isChoice'] : 0;
         $row['isVisible'] = (int) ($list['status'] != 6);
         $row['isMoreImg'] = (int) $list['quality'];
         $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker');
         $row['publishDays'] = floor((time() - $list['created']) / 86400);
         $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布';
         $row['createTime'] = date('Y-m-d H:i:s', $list['created']);
         //$row['updateTime'] = date('Y-m-d H:i:s', $list['updated']);
         //是否委托
         $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $ajkBrokerId, Model_House_Commission::TYPE_RENT);
         $row['isEntrust'] = $isEntrust ? 1 : 0;
         $row['publishDays'] > 30 ? $oldList[] = $row : ($newList[] = $row);
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo));
 }
Beispiel #15
0
 public function handle_request_internal()
 {
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $pageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     /*
      * 1.参数获取
      */
     $params = $this->request->get_parameters();
     $type = isset($params['type']) && in_array($params['type'], array('rent', 'sale')) ? $params['type'] : '';
     // 房源类型:不限、出粗、出售
     // $room = (isset($params['room']) && in_array($params['room'], array('1', '2', '3', '4'))) ? $params['room'] : ''; // 房源房型:不限、一室、二室、三室、三室以上
     //$areaId = (isset($params['area']) && is_numeric($params['area'])) ? intval($params['area']) : 0; // 房源区域:主版块
     //$subAreaId = ($areaId && isset($params['subArea']) && is_numeric($params['subArea'])) ? intval($params['subArea']) : 0; // 房源区域:子版块
     $cityId = $this->request->getBrokerCityId();
     //如果是审核直接跳到我得房源库
     /*
     if($cityId == 11){
         APF::get_instance()->get_response()->redirect($pageUrl.'/mysale');
         return false;
     }
     */
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $per = 10;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     /*
      * 2.获取经纪人主营板块下的所有委托房源(按照创建时间排序)
      */
     $rushedHouses = array();
     $daHouse = Model_House_CommissionHouse::data_access()->filter('cityId', $cityId)->filter('proStatus', Model_House_CommissionHouse::STATUS_ONGOING)->filter_by_op('openBrokerCnt', '<', Model_House_CommissionHouse::allowedMaxCommissionCount());
     // 房源区域
     /*$areas = $this->getCityAreas($cityId);
             $subAreas = array();
             if ($areaId) {
                 $subAreas = $this->getSubAreas($areaId);
     
                 if ($subAreas) {
                     $subAreaIds = array();
                     $subAreaCodes = array();
                     foreach ($subAreas as $subArea) {
                         $subAreaIds[$subArea->typeId] = $subArea->typeId;
                         $subAreaCodes[$subArea->typeId] = $subArea->typeCode;
                     }
     
                     if ($subAreaId && isset($subAreaCodes[$subAreaId])) {
                         $daHouse->filter('areaCode', $subAreaCodes[$subAreaId]);
                     } else {
                         $daHouse->filter('areaCode', $subAreaCodes);
                     }
                 } else {
                     $daHouse->filter('areaCode', 0);
                 }
             }
             */
     // 房源类型
     if ($type) {
         switch ($type) {
             case 'rent':
                 $daHouse->filter('commissionType', Model_House_CommissionHouse::COMMISSION_TYPE_RENT);
                 break;
             case 'sale':
                 $daHouse->filter('commissionType', Model_House_CommissionHouse::COMMISSION_TYPE_SALE);
                 break;
         }
     }
     /*
     // 房源房型
     if ($room) {
         switch ($room) {
             case '1':
             case '2':
             case '3':
                 $daHouse->filter('roomNum', $room);
                 break;
             case '4':
                 $daHouse->filter_by_op('roomNum', '>=', $room);
                 break;
         }
     }
     */
     // 获取经纪人的区域id
     $brokerAreaCode = $this->getBrokerAreaCode(self::$BrokerInfo['BaseInfo']);
     if (!empty($brokerAreaCode)) {
         $daHouse->filter_by_op('areaCode', 'like', "{$brokerAreaCode}%");
     } else {
         $daHouse->filter('id', 0);
         // 没有区域id,则不显示数据
     }
     // 获取满足条件的总量
     $daTotal = clone $daHouse;
     $total = $daTotal->count();
     // 分页
     $pager = Util_MultiPage::multiPage($params, '', $total, $per, 10, $pageUrl);
     $this->request->set_attribute('page', $page);
     $this->request->set_attribute('pager', $pager);
     $this->request->set_attribute('showPager', $total > $per);
     // 当前页面的个人房源
     $houses = $daHouse->limit($per)->offset(($page - 1) * $per)->sort('created', 'desc')->find_all();
     //print_r($daHouse->get_last_sql());
     $overHouses = $this->getHasOverHouses($cityId);
     // 获取小区默认图片 和 区域板块名称
     $houseIds = array();
     $communityIds = array();
     $areaCodes = array();
     foreach ($houses as $house) {
         $houseIds[] = $house->id;
         $communityIds[] = $house->commId;
         $areaCodes[] = $house->areaCode;
     }
     // 判断已经抢完的数据是否存在
     if (!empty($overHouses)) {
         foreach ($overHouses as $house) {
             $houseIds[] = $house->id;
             $communityIds[] = $house->commId;
             $areaCodes[] = $house->areaCode;
         }
     }
     // 房东房源图片
     $propImageUrls = Bll_Image_UtilsImage::getCommissionProImage($houseIds);
     $this->request->set_attribute('propImageUrls', $propImageUrls);
     // 小区默认图片
     $communityImageUrls = $this->getCommunityImageUrls($communityIds);
     $this->request->set_attribute('communityImageUrls', $communityImageUrls);
     // 区域板块
     $areaCodesNames = $this->getAreaCodeNames($areaCodes);
     $this->request->set_attribute('areaCodeNames', $areaCodesNames);
     // 获取当前经纪人房源委托情况,如果已经委托,提示已委托
     if ($houseIds) {
         $rushedCommissions = Model_House_Commission::data_access()->filter('houseId', $houseIds)->filter('brokerId', $brokerId)->find_all();
         $rushedHouses = array();
         foreach ($rushedCommissions as $rushedCommission) {
             $rushedHouses[$rushedCommission->houseId] = $rushedCommission->id;
         }
     }
     $rechargeUrl = "http://my.{$baseDomain}/user/broker/hpsupplement";
     $isCombo = Bll_Combo_HouseRelation::ifComboCity(self::$BrokerInfo['BaseInfo']['CITYID']);
     if ($isCombo == ture) {
         // 获取经纪人套餐房源数
         $conbosProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($brokerId);
         $this->request->set_attribute('conbosProNum', $conbosProNum);
     }
     $this->request->set_attribute('isCombo', $isCombo);
     $this->request->set_attribute('type', $type);
     //$this->request->set_attribute('room', $room);
     //$this->request->set_attribute('area', $areaId);
     //$this->request->set_attribute('subArea', $subAreaId);
     //$this->request->set_attribute('areas', $areas);
     //$this->request->set_attribute('subAreas', $subAreas);
     $this->request->set_attribute('pageUrl', $pageUrl);
     $this->request->set_attribute('houses', $houses);
     $this->request->set_attribute('rushedHouses', $rushedHouses);
     $this->request->set_attribute('overHouses', $overHouses);
     $this->request->set_attribute('rechargeUrl', $rechargeUrl);
     return 'House_Commission_All';
 }
Beispiel #16
0
 /**
  * 获取房源 7天内的点击信息
  *
  * @param int $houseId
  * @return array
  */
 private static function getHouseComboSpreadClickInfo($houseId)
 {
     $startDate = date('Y-m-d', strtotime('-6 days'));
     $houseClickInfo = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($houseId, $startDate, date('Y-m-d'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_AJK);
     if (empty($houseClickInfo)) {
         return array();
     }
     $result = array();
     foreach ($houseClickInfo[$houseId] as $date => $houseClicks) {
         $key = date('m.d', strtotime($date));
         $result[$key] = $houseClicks;
     }
     return $result;
 }
Beispiel #17
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $brokerId = $request->getBrokerId();
     $cityId = $request->getBrokerCityId();
     $userId = $request->getUserId();
     $sukId = $params['combo'];
     $password = $params['brokerPassword'];
     $act = $params['act'];
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     //非套餐经纪人不能进入该页面,跳转到首页
     if ($brokerInfo['PAYTYPE'] != 9999) {
         $this->redirect('/user/broker/brokerhome');
     }
     //查询账户余额
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     $UserAccountAll = $balance['data']['balance'] / 100.0;
     //账户余额
     $UserAccountPerson = $balance['data']['personBalance'] / 100.0;
     //账户余额(个人)
     $UserAccountCompany = $balance['data']['companyBalance'] / 100.0;
     //账户余额(公司)
     $companyId = intval($brokerInfo['COMPANYID']);
     if ($companyId > 0) {
         /** 通过配置文件配置那些城市的非独立经纪人不可以购买月套餐 */
         $canNotBuyMonthlyComboCitySet = APF::get_instance()->get_config('can_not_buy_monthly_combo_city_set');
         if (is_array($canNotBuyMonthlyComboCitySet) && in_array($cityId, $canNotBuyMonthlyComboCitySet)) {
             $companyId = 0;
         }
     }
     //经纪人能否购买
     $buyComboInfo = Bll_Combo_Broker_BrokerComboInfo::getBrokerallowBuy($brokerId, $cityId, $sukId, $companyId);
     $this->setAttribute('buyComboInfo', $buyComboInfo);
     $this->setAttribute('UserAccountAll', number_format($UserAccountAll, 2));
     $request->set_attribute("UserAccountPerson", number_format($UserAccountPerson, 2));
     $request->set_attribute("UserAccountCompany", number_format($UserAccountCompany, 2));
     $this->setAttribute('params', $params);
     //看能不能购买
     if (!$buyComboInfo['allowBuy']) {
         return 'Combo_Buy_Result';
     }
     //购买
     if ($act == 'pay') {
         //密码加密
         $md5_password = md5($password);
         $baseencode_password = base64_encode($md5_password);
         //查询经纪人信息
         $userInfo = Model_Broker_Member::getAjkMembersByUserId($userId);
         //验证密码
         if ($userInfo->userPwd == $baseencode_password) {
             //购买
             $buySuccess = Bll_Combo_Broker_BrokerComboInfo::buyCombo($userId, $sukId);
             //购买是否成功
             $this->setAttribute('buySuccess', $buySuccess);
             return 'Combo_Buy_Result';
         } else {
             //密码错误
             $this->setAttribute('pwdErr', 1);
         }
     }
     return 'Combo_Buy_Pay';
 }
Beispiel #18
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     //好丑陋。。。。。。好无奈。。。。。。
     //委托房源自动转发停用,为了app能够展示报错信息。。。
     if (empty($propId)) {
         $this->_params['apiDebug'] = 1;
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布');
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     $cityId = $brokerInfo->cityId;
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['rentPropNum'] + $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //没有二手房套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 0, 'statusMsg' => '尚未购买套餐,请购买套餐', 'currentComboInfo' => '尚未购买套餐'));
     }
     $currentComboName = $currentCombo['name'];
     $currentComboUsed = 0;
     $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'];
     //二手房套餐列表
     $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     $comboEsfPropIds = array_keys($comboEsfList);
     //租房套餐列表
     $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $comboZuFangPropIds = array();
     foreach ($comboZuFangList as $v) {
         $comboZuFangPropIds[] = (int) $v['houseId'];
     }
     $currentComboUsed = count($comboZuFangPropIds) + count($comboEsfPropIds);
     $canSpread = $currentComboUsed >= $currentComboTotal ? 0 : (!$currentCombo['openUp'] && !$currentCombo['salePropNum'] ? 0 : 1);
     if (in_array($propId, array_merge($comboEsfPropIds, $comboZuFangPropIds))) {
         $status = 2;
         $statusMsg = '套餐推广中';
     } else {
         $status = 1;
         $statusMsg = '好房源,不推广就浪费了~';
     }
     //房源今日点击  房源总点击
     $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propId);
     $todayClicks = $houseTodayClickInfo[$propId];
     //房源总点击
     $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propId, $cityId);
     $totalClicks = $todayClicks + $houseClickInfo[$propId];
     $currentComboInfo = isset($currentCombo) ? $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})" : '尚未购买套餐';
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'totalClicks' => $totalClicks, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo));
 }
Beispiel #19
0
 /**
  * 把经纪人因为套餐到期停止推广的房源(套餐规定的可推广房源数)重新上线,(按房源发布时间 倒序排列)
  * @return string
  */
 private function reUpExpireHouse()
 {
     $currentCombo = Bll_Combo_Broker_BrokerComboInfo::getBrokerCurrentCombo($this->params['ajk_broker_id'], Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ);
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         return $this->allReturn[] = '打通套餐,好租不处理';
     }
     // 当前在线房源数
     $onLineSpreadHouseCount = Bll_Combo_HouseRelation::getOnLineSpreadHouseCount($this->params['ajk_broker_id'], Bll_Combo_HouseRelation::SITE_TYPE_HZ);
     $comboProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($this->params['ajk_broker_id']);
     // 套餐可以推广的房源数
     $comboProNum = isset($comboProNum['totalRentPropNum']) ? $comboProNum['totalRentPropNum'] : 0;
     if (!$comboProNum) {
         return $this->allReturn[] = "套餐可以推广的房源数0";
     }
     if ($onLineSpreadHouseCount >= $comboProNum) {
         return $this->allReturn[] = "在线推广房源数{$onLineSpreadHouseCount}, 套餐可推广房源数{$comboProNum},不需要上线套餐到期的房子";
     }
     $shouldUpNum = $comboProNum - $onLineSpreadHouseCount;
     $allExpireRelations = Bll_Combo_HouseRelation::getHouseRelations($this->params['ajk_broker_id'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE);
     if (empty($allExpireRelations)) {
         return $this->allReturn[] = "没有需要上线的推广房子";
     }
     // 房子有效性判断
     $num = 0;
     $shouldUpRelations = array();
     foreach ($allExpireRelations as $relation) {
         $proId = $relation['houseId'];
         if (!($propInfo = Bll_House_HzHouse::getPropInfo($proId, $relation['cityId'], 2))) {
             continue;
         }
         if (!$propInfo['status'] || in_array($propInfo['msg']['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
             continue;
         }
         if ($num < $shouldUpNum) {
             $shouldUpRelations[] = $relation;
         }
         $num++;
     }
     foreach ($shouldUpRelations as $comboRelation) {
         $this->params['pro_id'] = $comboRelation['houseId'];
         // 更新关系
         Bll_Combo_HouseRelation::updateComboStatusById($comboRelation['id'], Model_Combo_HouseRelation::ENUM_HOUSE_ONLINE, Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         // 维护房子状态
         Bll_HzPropBll::bulidHzProStatu($this->params['pro_id']);
         // 写入房源取消套餐推广日志
         $this->writePropLog(Const_ProLogType::LOG_ADD_INTO_COMBO, '开始套餐推广');
     }
 }
Beispiel #20
0
 /**
  * 房源加入套餐推广
  *
  * @param int $brokerId
  * @param int $cityId
  * @param array $params
  * @return array
  */
 private function houseStartComboSpreadAction($brokerId, $cityId, $params)
 {
     $houseIds = is_array($params['houseIds']) ? $params['houseIds'] : explode(',', $params['houseIds']);
     $realHouseIds = $this->removeInvalidateHouseId($brokerId, $houseIds, $cityId);
     if (empty($realHouseIds)) {
         return $this->buildResponse('error', $houseIds, '请至少选择一套房源。');
     }
     $comboList = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
     if (empty($comboList)) {
         return $this->buildResponse('error', $realHouseIds, '您还没有购买套餐,购买后才能推广房源。<br /><a href="/ajkbroker/combo/buy/select" target="_blank">去购买套餐&gt;&gt;</a> ');
     }
     $currentComboHouseCount = 0;
     $currentCombo = array();
     $nextCombo = array();
     $currentTime = time();
     foreach ($comboList as $combo) {
         /** 打通的套餐 */
         if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($combo)) {
             /** 获取当前使用的套餐 */
             if (strtotime($combo['endTime']) > $currentTime && strtotime($combo['startTime']) < $currentTime) {
                 if ($combo['salePropNum'] > 0 || $combo['rentPropNum'] > 0) {
                     $currentCombo = $combo;
                     $currentComboHouseCount = $combo['salePropNum'] + $combo['rentPropNum'];
                 }
                 continue;
             }
             /** 获取续买套餐 */
             if (strtotime($combo['startTime']) > $currentTime) {
                 if ($combo['salePropNum'] > 0 || $combo['rentPropNum'] > 0) {
                     $nextCombo = $combo;
                 }
             }
             continue;
         }
         /** 未打通的套餐 */
         if (strtotime($combo['endTime']) > $currentTime && strtotime($combo['startTime']) < $currentTime && $combo['salePropNum'] > 0) {
             $currentComboHouseCount = $combo['salePropNum'];
             $currentCombo = $combo;
             break;
         }
         /** 获取续买套餐 */
         if ($combo['salePropNum'] > 0 && strtotime($combo['startTime']) > $currentTime) {
             $nextCombo = $combo;
         }
     }
     if (empty($currentCombo) && empty($nextCombo)) {
         return $this->buildResponse('error', $realHouseIds, '您还没有购买套餐,购买后才能推广房源。<br /><a href="/ajkbroker/combo/buy/select" target="_blank">去购买套餐&gt;&gt;</a> ');
     }
     if (empty($currentCombo) && !empty($nextCombo)) {
         return $this->buildResponse('error', $realHouseIds, sprintf('您购买的套餐 %s 需要到 %s 才能生效。', $nextCombo['name'], date('Y.m.d', strtotime($nextCombo['startTime']))));
     }
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_AJK, true);
     } else {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
     }
     if (count($realHouseIds) + $currentSpreadHouseCount > $currentComboHouseCount) {
         return $this->buildResponse('error', $realHouseIds, sprintf('最多只能推广 %d 套房源。', $currentComboHouseCount));
     }
     if (Bll_Combo_HouseRelation::houseStartComboSpread($brokerId, $cityId, $realHouseIds, Bll_Combo_HouseRelation::SITE_TYPE_AJK)) {
         return $this->buildResponse('ok', $realHouseIds, sprintf('成功推广 %d 套房源。', count($realHouseIds)));
     }
     return $this->buildResponse('error', $realHouseIds, '套餐推广失败。');
 }
Beispiel #21
0
 /**
  * 抢委托操作流程
  * @param $houseId 房源id
  * @param $brokerId 二手房经纪人Id
  * @param $brokerName 二手房经纪人真实姓名
  * @param $brokerPhone 经纪人手机电话
  * @param $cityId 经纪人城市id
  * @param $comeFrom 来源
  * @param $isConsume 是否扣费
  * @param $conboOn 套餐是否开启
  * @return array
  */
 public function saleRush($houseId, $brokerId, $brokerName, $brokerPhone, $cityId, $comeFrom = Const_Entrust::RUSH_FROM_PC, $isConsume = true, $conboOn = false)
 {
     $result = array('status' => 0, 'data' => array(), 'errorMsg' => "");
     if (empty($houseId) || empty($brokerId) || empty($cityId) || empty($brokerName) || empty($brokerPhone)) {
         $result['status'] = 99;
         $result['errorMsg'] = "输入的参数不正确";
         return $result;
     }
     // 验证套餐开关是否开启
     if ($conboOn == true) {
         $conbosProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($brokerId);
         if ($conbosProNum['totalSalePropNum'] <= 0) {
             $result['status'] = 20;
             $result['errorMsg'] = "没有购买出售套餐。";
             return $result;
         }
     }
     // 判断房源ID
     $id = isset($houseId) & intval($houseId) > 0 ? intval($houseId) : 0;
     if ($houseId <= 0) {
         $result['status'] = 2;
         $result['errorMsg'] = "无效的房源编号。";
         return $result;
     }
     // 判断委托房源是否存在
     $house = Model_House_CommissionHouse::data_access()->filter('id', $id)->find_only();
     if (!$house) {
         $result['status'] = 3;
         $result['errorMsg'] = "房源不可委托:房源不存在。";
         return $result;
     }
     if ($house->commissionType != Model_House_CommissionHouse::COMMISSION_TYPE_SALE) {
         $result['status'] = 4;
         $result['errorMsg'] = "房源类型不是二手房";
         return $result;
     }
     // 判断委托房源状态
     if ($house->proStatus != Model_House_CommissionHouse::STATUS_ONGOING) {
         if ($house->proStatus == Model_House_CommissionHouse::STATUS_DELETED) {
             $result['status'] = 9;
             $result['errorMsg'] = "房源不可委托:已被房东删除。";
         } elseif ($house->proStatus == Model_House_CommissionHouse::STATUS_ILLEGAL) {
             $result['status'] = 10;
             $result['errorMsg'] = "房源不可委托:已被违规删除。";
         } elseif ($house->proStatus == Model_House_CommissionHouse::STATUS_STOP) {
             $result['status'] = 11;
             $result['errorMsg'] = "房源不可委托:已被停止委托。";
         } elseif ($house->proStatus == Model_House_CommissionHouse::STATUS_SAVE) {
             $result['status'] = 12;
             $result['errorMsg'] = "房源不可委托:已被估价保存。";
         } else {
             $result['status'] = 5;
             $result['errorMsg'] = "房源不可委托:已过期。";
         }
         return $result;
     }
     // 判断委托房源已委托数量
     if ($house->openBrokerCnt >= Model_House_CommissionHouse::allowedMaxCommissionCount()) {
         $result['status'] = 6;
         $result['errorMsg'] = '委托已满。';
         return $result;
     }
     // 判断是否已抢过委托
     $commission = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('houseId', $house->id)->find_only();
     if ($commission) {
         $result['status'] = 7;
         $result['errorMsg'] = '你已经委托了该房源。';
         return $result;
     }
     if ($isConsume === true) {
         // 获取余额
         $userId = Bll_Broker_BrokerCheckInfo::getUserIdByBrokerId($brokerId, 'sale');
         $balance = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerMoney($userId);
         $balance = $balance * 100;
         // 获取委托价格
         $startDate = date("Ymd");
         $price = Bll_Broker_EntrustPrice::getInstance()->getSalePrice($cityId, $startDate);
         // 判断余额是否足够
         if ($balance < $price) {
             $result['status'] = 8;
             $result['errorMsg'] = '对不起,您的账户余额不足,请充值。';
             return $result;
         }
     }
     // 判断15天内未发布的房源的数量是否最多3套
     $tmpTime = time() - 15 * 24 * 3600;
     $startTime = date("Y-m-d H:i:s", $tmpTime > strtotime(Const_Entrust::EUSH_3HOUSE_RULE_STARTTIME) ? $tmpTime : strtotime(Const_Entrust::EUSH_3HOUSE_RULE_STARTTIME));
     $tmpCommission = Model_House_Commission::data_access()->load_field('id')->load_field('type')->load_field('brokerHouseId')->load_field('publishTime')->load_field('isDelete')->filter('brokerId', $brokerId)->filter_by_op('createTime', '>', $startTime)->find();
     // bug46464 慢查询,故把数据获取后来处理
     $tmpCount = 0;
     if (!empty($tmpCommission)) {
         foreach ($tmpCommission as $val) {
             if ($tmpCount == 5000) {
                 break;
             }
             if ($val['publishTime'] == '0000-00-00 00:00:00' && $val['isDelete'] == Model_House_Commission::DELETE_NO && $val['type'] == Model_House_Commission::TYPE_SALE && $val['brokerHouseId'] == 0) {
                 $tmpCount++;
             }
         }
     }
     if ($tmpCount == 5000) {
         $result['status'] = 15;
         $result['errorMsg'] = '15天之内已抢房源中有5000套未发,禁止经纪人继续抢房';
         return $result;
     }
     // 更新commission_prop表的openBrokerCnt+1
     if (!$house->updateCommissionCount()) {
         $result['status'] = 6;
         $result['errorMsg'] = '委托已满。';
         return $result;
     }
     // 更新成功 插入e_commission表
     $commission = Model_House_Commission::create(array('type' => $house->commissionType, 'ownerId' => $house->userId, 'houseId' => $house->id, 'brokerId' => $brokerId, 'origin' => $comeFrom, 'createTime' => date('Y-m-d H:i:s'), 'updateTime' => date('Y-m-d H:i:s')));
     $commission->save();
     if ($isConsume === true) {
         // 插入扣费队列
         $insertQueryArr = array('cityId' => $cityId, 'commissionId' => $commission->id, 'status' => 0, 'dateIndex' => date("Ymd"), 'createTime' => time(), 'updateTime' => date("Y-m-d H:i:s"));
         Bll_Broker_EntrustQuery::getInstance()->insertOneData($insertQueryArr);
     }
     // 更新推送房源状态
     $pushedHouse = Model_House_CommissionHousePushed::data_access()->filter('brokerId', $brokerId)->filter('propertyId', $house->id)->find_only();
     if ($pushedHouse) {
         $pushedHouse->propertyStatus = Model_House_CommissionHousePushed::STATUS_RUSHED;
         $pushedHouse->save();
     }
     // 记录到commission_sale_log日志表
     Bll_Broker_EntrustConsumeLog::getInstance()->insertCommissionSaleLog($house, $brokerId);
     // 给房东发送短信
     if ($house->ownerMobile) {
         // 小区名称
         $commName = mb_strlen($house->commName, "utf-8") <= 12 ? $house->commName : mb_substr($house->commName, 0, 12, "utf-8") . "...";
         // 经纪人信息
         $content = $house->userName . "您好,您在安居客发布的" . $commName . "的委托已被经纪人" . $brokerName . "接受,联系方式" . $brokerPhone;
         Bll_Broker_ShowcaseCommon::getInstance()->sendAlertMsg(array($house->ownerMobile), $content, 1010);
     }
     //给app房东推送消息,added by xiongjiewu at 2014-08-07
     $this->pushEntrustMsg($brokerId, $id);
     // 拼装返回数据
     $result['status'] = 1;
     // 抢委托成功
     $result['data'] = array('owner' => $house->userName, 'phone' => $house->getPhone(), 'title' => '', 'summary' => '', 'manageUrl' => '');
     $area = '[' . implode('-', $house->getAreaCodeNames()) . '] ';
     $houseModel = "{$house->roomNum}室{$house->hallNum}厅{$house->toiletNum}卫,{$house->areaNum}平方米,";
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $result['data']['title'] = '[出售] ' . $house->commName;
     $result['data']['summary'] = $area . $houseModel . $house->proPrice . '万元';
     $result['data']['manageUrl'] = "http://my.{$baseDomain}{$baseUri}/commissions/mysale";
     return $result;
 }
Beispiel #22
0
 /**
  * 判断新套餐 经纪人是否可以推广房源
  *
  * @param int $cityId
  * @param int $brokerId
  * @return bool
  */
 public static function ajkComboBrokerCanSpreadHouse($cityId, $brokerId)
 {
     $currentCombo = Bll_Combo_Broker_BrokerComboInfo::getBrokerCurrentCombo($brokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK);
     if (empty($currentCombo)) {
         return false;
     }
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_AJK, true);
         $salePropNum = $currentCombo[Bll_Combo_Broker_BrokerComboInfo::getComboIndexBySiteType(Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK)];
         $rentPropNum = $currentCombo[Bll_Combo_Broker_BrokerComboInfo::getComboIndexBySiteType(Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ)];
         return $currentSpreadHouseCount < $salePropNum + $rentPropNum;
     } else {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         return $currentSpreadHouseCount < $currentCombo[Bll_Combo_Broker_BrokerComboInfo::getComboIndexBySiteType(Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK)];
     }
 }
Beispiel #23
0
 public function updateCheck($orderId, $upSkuId, $userId, $checkState)
 {
     if (empty($orderId) || empty($upSkuId)) {
         return array('status' => 'error', 'errMsg' => '请选择升级的套餐');
     }
     //判定经纪人审核状态
     if ($checkState != 1) {
         return array('status' => 'error', 'errMsg' => '双证审核未通过,不能购买套餐');
     }
     $result = Bll_Combo_Broker_BrokerComboInfo::getUpdatePrice($upSkuId, $orderId);
     if (empty($result) || $result['result'] === false) {
         return array('status' => 'err', 'errMsg' => '套餐升级api获取失败');
     }
     if ($result['status'] == 'error') {
         return array('status' => 'err', 'errMsg' => $result['info']);
     }
     //假数据
     //$result['data'] = array('price' => 1000, 'startTime' => '2014-12-30 00:00:00.0', 'endTime' => '2014-12-30 00:00:00.0');
     //判定账户余额
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     $balancePerson = $balance['data']['personBalance'];
     //账户余额(个人)
     if ($balancePerson < $result['data']['price']) {
         return array('status' => 'err', 'errMsg' => '可用余额不足,<a href="/user/broker/hpsupplement">请充值</a>', 'price' => round($result['data']['price'] / 100, 2), 'frome' => date('Y.m.d', strtotime($result['data']['startTime'])), 'to' => date('Y.m.d', strtotime($result['data']['endTime'])));
     }
     $re = array();
     $re['status'] = 'ok';
     if ($result['data']) {
         $re['price'] = round($result['data']['price'] / 100, 2);
         $re['frome'] = date('Y.m.d', strtotime($result['data']['startTime']));
         $re['to'] = date('Y.m.d', strtotime($result['data']['endTime']));
     }
     return $re;
 }
Beispiel #24
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $userId = $request->getUserId();
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     //非套餐经纪人不能进入该页面,跳转到首页
     if ($brokerInfo['PAYTYPE'] != 9999) {
         $this->redirect('/user/broker/brokerhome');
     }
     $companyId = intval($brokerInfo['COMPANYID']);
     if ($companyId > 0) {
         /** 通过配置文件配置那些城市的非独立经纪人不可以购买月套餐 */
         $canNotBuyMonthlyComboCitySet = APF::get_instance()->get_config('can_not_buy_monthly_combo_city_set');
         if (is_array($canNotBuyMonthlyComboCitySet) && in_array($cityId, $canNotBuyMonthlyComboCitySet)) {
             $companyId = 0;
         }
     }
     //获取城市可选择的套餐列表
     if ($companyId > 0) {
         $comboList = Bll_Combo_Broker_BrokerComboInfo::getCompanyComboList($cityId, $companyId);
     } else {
         $comboList = Bll_Combo_Broker_BrokerComboInfo::getComboList($cityId);
     }
     //获取经纪人当前套餐
     $brokerCombos = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     //查询账户余额
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     $UserAccountAll = $balance['data']['balance'] / 100.0;
     //账户余额
     $UserAccountPerson = $balance['data']['personBalance'] / 100.0;
     //账户余额(个人)
     $UserAccountCompany = $balance['data']['companyBalance'] / 100.0;
     //账户余额(公司)
     /**
      * 获取经纪人信息身份认证状态(购买套餐时需要身份认证通过)
      * CheckState - 经纪人身份认证状态
      * OperateState - 经纪人审核过程中走到哪一步标记
      *
      * 备注:本处会出bug。(后台显示身份认证通过、不能购买套餐)
      * 经纪人后台判断身份认证状态只使用CheckState=1
      * 套餐购买的api里面判断CheckState=1 && OperateState=4
      * api组的志山同志拍脑袋,使用双验证。
      * caoyang 20140825
      */
     //$brokerInfo['CheckState'] = ($brokerInfo['CHECKSTATE'] == 1 && $brokerInfo['OPERATESTATE'] == 4) ? 1 : 0;
     $brokerInfo['CheckState'] = $brokerInfo['CHECKSTATE'];
     $this->setAttribute('comboList', $comboList);
     $this->setAttribute('brokerCombos', $brokerCombos);
     $this->setAttribute('UserAccountAll', number_format($UserAccountAll, 2, ".", ""));
     $this->setAttribute('UserAccountPerson', number_format($UserAccountPerson, 2, ".", ""));
     $this->setAttribute('UserAccountCompany', number_format($UserAccountCompany, 2, ".", ""));
     $this->setAttribute('brokerInfo', $brokerInfo);
     return 'Combo_Buy_Select';
 }
Beispiel #25
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     $apf = APF::get_instance();
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $brokerId = $request->getBrokerId();
     $userId = $request->getUserId();
     $cityId = $request->getBrokerCityId();
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     //非套餐经纪人不能进入该页面,跳转到首页
     if ($brokerInfo['PAYTYPE'] != 9999) {
         $this->redirect('/user/broker/brokerhome');
     }
     if (isset($params['p']) && !empty($params['p'])) {
         $page = intval($params['p']);
     } else {
         $page = 1;
     }
     //获取经纪人日志的总数
     $comboLogNum = Bll_Combo_Broker_BrokerComboInfo::getComboLogNumByUserId($userId);
     //查询列表数据
     $ComboLogList = Bll_Combo_Broker_BrokerComboInfo::getComboLogListByUserId($userId, $page, $this->page_num);
     //分页参数获取
     $arrPager = $this->getPager($params, $comboLogNum);
     //获取经纪人可以购买套餐列表
     $companyId = $brokerInfo['COMPANYID'];
     $canBuyComboList = Bll_Combo_Broker_BrokerComboInfo::getCanBuyComboList($cityId, $companyId);
     //获取经纪人当前套餐
     $brokerCombos = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboAlreadyGroup($userId);
     $allComboList = array();
     foreach ($brokerCombos['nowCombo'] as $combo) {
         $comboTip = array('status' => 1, 'name' => $combo['name'], 'content' => $combo['comboStr'], 'beginDate' => date('Y.m.d', $combo['startTimestamp']), 'endDate' => date('Y.m.d', $combo['endTimestamp']));
         $allComboList[] = $comboTip;
     }
     $jinPuComingCombo = array();
     $rentAndSaleComingCombo = array();
     foreach ($brokerCombos['comingCombo'] as $combo) {
         $comboTip = array('status' => 0, 'name' => $combo['name'], 'content' => $combo['comboStr'], 'beginDate' => date('Y.m.d', $combo['startTimestamp']), 'endDate' => date('Y.m.d', $combo['endTimestamp']));
         $allComboList[] = $comboTip;
         if (empty($rentAndSaleComingCombo) && ($combo['salePropNum'] > 0 || $combo['rentPropNum'])) {
             $rentAndSaleComingCombo = $combo;
         }
         if (empty($jinPuComingCombo) && $combo['jpPropNum'] > 0) {
             $rentAndSaleComingCombo = $combo;
         }
     }
     //查询账户情况
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     $FreezeAccount = $balance['data']['jp']['frozen'] / 100.0 + $balance['data']['hz']['frozen'] / 100.0 + $balance['data']['ajk']['frozen'] / 100.0;
     //冻结余额
     $UserAccount = $balance['data']['balance'] / 100.0;
     //账户余额
     $UserAccountPerson = $balance['data']['personBalance'] / 100.0;
     //账户余额(个人)
     $UserAccountCompany = $balance['data']['companyBalance'] / 100.0;
     //账户余额(公司)
     $UserAccountTotal = $FreezeAccount + $UserAccount;
     //账户总额 = 账户余额 + 冻结余额
     //金铺是否开放
     $JinpuOpenConfig = APF::get_instance()->get_config("jinpu_open", "ppc");
     $isJp = isset($JinpuOpenConfig[$cityId]) ? $JinpuOpenConfig[$cityId]['open'] : false;
     $request->set_attribute('arrPager', $arrPager);
     $request->set_attribute('isJp', $isJp);
     $request->set_attribute('canBuyComboList', $canBuyComboList);
     $request->set_attribute('brokerCombos', $brokerCombos);
     $request->set_attribute('allComboList', $allComboList);
     $request->set_attribute('ComboLogList', $ComboLogList);
     $request->set_attribute("UserAccount", number_format($UserAccount, 2, ".", ""));
     $request->set_attribute("UserAccountPerson", number_format($UserAccountPerson, 2, ".", ""));
     $request->set_attribute("UserAccountCompany", number_format($UserAccountCompany, 2, ".", ""));
     $request->set_attribute("FreezeAccount", number_format($FreezeAccount, 2, ".", ""));
     $request->set_attribute("UserAccountTotal", number_format($UserAccountTotal, 2, ".", ""));
     $request->set_attribute('rentAndSaleComingCombo', $rentAndSaleComingCombo);
     $request->set_attribute('jinPuComingCombo', $jinPuComingCombo);
     return 'Combo_Account_ComboLog';
 }
Beispiel #26
0
 /**
  * 获取房源今日套餐点击量
  *
  * @param int|array $houseIds
  * @return array
  */
 public static function getHouseTodayComboClick($houseIds)
 {
     $date = date('Y-m-d');
     if (!is_array($houseIds)) {
         $houseIds = array($houseIds);
     }
     $result = array_fill_keys($houseIds, 0);
     $houseComboClickList = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClick($houseIds, $date, $date, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_AJK);
     if (empty($houseComboClickList)) {
         return $result;
     }
     foreach ($houseComboClickList as $houseComboClick) {
         $result[$houseComboClick['propId']] = max(0, $houseComboClick['cnum']);
     }
     return $result;
 }
Beispiel #27
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     $apf = APF::get_instance();
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $brokerId = $request->getBrokerId();
     $userId = $request->getUserId();
     $cityId = $request->getBrokerCityId();
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     //非套餐经纪人不能进入该页面,跳转到老账户页面
     if ($brokerInfo['PAYTYPE'] != 9999) {
         $this->redirect($this->getURL('my', '/user/broker/accountmanagement/'));
     }
     $logtype = $params['logtype'] ? $params['logtype'] : "";
     if (isset($params['p']) && !empty($params['p'])) {
         $page = intval($params['p']);
     } else {
         $page = 1;
     }
     if (empty($params['tt']) && empty($params['ff'])) {
         $starttime = date('Ymd', strtotime('-29 day'));
         $endtime = date('Ymd');
     } else {
         $starttime = date("Ymd", strtotime($params['ff']));
         $endtime = date("Ymd", strtotime($params['tt']));
     }
     $AccountAll = 0;
     $dao = new Dao_Broker_AccountBalanceLog();
     //通过 userid 获取账户日志
     $UserAccountInfo = $dao->searchAccountBalanceLog($userId, $logtype, $starttime, $endtime, $page, $this->page_num);
     if (!empty($UserAccountInfo)) {
         $AccountAll = $UserAccountInfo['counts'];
     }
     unset($UserAccountInfo["counts"]);
     //echo "<pre>";print_r(isset($params['ff']) ? $params['ff'] : date('Y-m-d', strtotime($starttime)));exit;
     if (empty($UserAccountInfo) && empty($params['tt']) && empty($params['ff'])) {
         $starttime = date('Y-m-d', strtotime('-29 day'));
         $endtime = date('Y-m-d');
     }
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     $FreezeAccount = $balance['data']['jp']['frozen'] / 100.0 + $balance['data']['hz']['frozen'] / 100.0 + $balance['data']['ajk']['frozen'] / 100.0;
     //冻结余额
     $UserAccount = $balance['data']['balance'] / 100.0;
     //账户余额
     $UserAccountPerson = $balance['data']['personBalance'] / 100.0;
     //账户余额(个人)
     $UserAccountCompany = $balance['data']['companyBalance'] / 100.0;
     //账户余额(公司)
     $UserAccountTotal = $FreezeAccount + $UserAccount;
     //账户总额 = 账户余额 + 冻结余额
     //获取经纪人可以购买套餐列表
     $companyId = $brokerInfo['COMPANYID'];
     $canBuyComboList = Bll_Combo_Broker_BrokerComboInfo::getCanBuyComboList($cityId, $companyId);
     //获取经纪人当前套餐
     $brokerCombos = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboAlreadyGroup($userId);
     $jinPuComingCombo = array();
     $rentAndSaleComingCombo = array();
     $allComboList = array();
     foreach ($brokerCombos['nowCombo'] as $combo) {
         $comboTip = array('status' => 1, 'name' => $combo['name'], 'content' => $combo['comboStr'], 'beginDate' => date('Y.m.d', $combo['startTimestamp']), 'endDate' => date('Y.m.d', $combo['endTimestamp']));
         $allComboList[] = $comboTip;
     }
     foreach ($brokerCombos['comingCombo'] as $combo) {
         $comboTip = array('status' => 0, 'name' => $combo['name'], 'content' => $combo['comboStr'], 'beginDate' => date('Y.m.d', $combo['startTimestamp']), 'endDate' => date('Y.m.d', $combo['endTimestamp']));
         $allComboList[] = $comboTip;
         if (empty($rentAndSaleComingCombo) && ($combo['salePropNum'] > 0 || $combo['rentPropNum'])) {
             $rentAndSaleComingCombo = $combo;
         }
         if (empty($jinPuComingCombo) && $combo['jpPropNum'] > 0) {
             $rentAndSaleComingCombo = $combo;
         }
     }
     //金铺是否开放
     $JinpuOpenConfig = APF::get_instance()->get_config("jinpu_open", "ppc");
     $isJp = isset($JinpuOpenConfig[$cityId]) ? $JinpuOpenConfig[$cityId]['open'] : false;
     $request->set_attribute('isJp', $isJp);
     $request->set_attribute("AccountLogDownLOadName", sha1($userId . '安居客账户日志明细'));
     $request->set_attribute("UserAccount", number_format($UserAccount, 2, ".", ""));
     $request->set_attribute("UserAccountPerson", number_format($UserAccountPerson, 2, ".", ""));
     $request->set_attribute("UserAccountCompany", number_format($UserAccountCompany, 2, ".", ""));
     $request->set_attribute("FreezeAccount", number_format($FreezeAccount, 2, ".", ""));
     $request->set_attribute("UserAccountTotal", number_format($UserAccountTotal, 2, ".", ""));
     $request->set_attribute("UserAccountInfo", $UserAccountInfo);
     $request->set_attribute("AccountAll", $AccountAll);
     $request->set_attribute('params', $params);
     $request->set_attribute('ff', isset($params['ff']) ? $params['ff'] : date('Y-m-d', strtotime($starttime)));
     $request->set_attribute('tt', isset($params['tt']) ? $params['tt'] : date('Y-m-d', strtotime($endtime)));
     $arrPager = $this->getPager($params, $AccountAll);
     $request->set_attribute('arrPager', $arrPager);
     $request->set_attribute('canBuyComboList', $canBuyComboList);
     $request->set_attribute('brokerCombos', $brokerCombos);
     $request->set_attribute('allComboList', $allComboList);
     $request->set_attribute('rentAndSaleComingCombo', $rentAndSaleComingCombo);
     $request->set_attribute('jinPuComingCombo', $jinPuComingCombo);
     return 'Combo_Account_AccountLog';
 }
Beispiel #28
0
 /**
  * 组装套餐列表
  * @param $out
  */
 public static function prepareComboList(&$out)
 {
     // 获取套餐信息
     $out['comboInfos'] = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($out['ajkBrokerId'], Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ);
     if (count($out['comboInfos']) > 0) {
         $currentCombo = $out['comboInfos'][0];
         // 套餐打通
         if (isset($currentCombo['openUp']) && $currentCombo['openUp'] == 1) {
             $spreadPropNum = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'] + $currentCombo['jpPropNum'];
             // 减去二手房正在推广数
             $ajkSpreadList = Bll_Combo_HouseRelation::getHouseRelations($out['ajkBrokerId'], Bll_Combo_HouseRelation::SITE_TYPE_AJK, 1);
             $out['spreadPropNum'] = $spreadPropNum - count($ajkSpreadList);
         } else {
             $out['spreadPropNum'] = $currentCombo['rentPropNum'];
         }
     }
     // 获取套餐点击量
     // $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($out['ajkBrokerId'], date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_HZ);
     // $out['comboClick'] = $comboClick ? $comboClick : 0;
     // 获取套餐推广关系列表
     $out['comboList'] = Bll_Combo_HouseRelation::getHouseRelations($out['ajkBrokerId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $temProps = array();
     if (count($out['comboList'])) {
         foreach ($out['comboList'] as $k => $comboInfo) {
             // 转换房子id下标数组
             $out['comboList'][$comboInfo['houseId']] = $comboInfo;
             unset($out['comboList'][$k]);
             if (isset($out['props'][$comboInfo['houseId']])) {
                 $temProps[] = $out['props'][$comboInfo['houseId']];
             }
             // 非有效房源过滤
             $proId = $comboInfo['houseId'];
             // 房子无效 关系还在, 过滤掉
             if (!isset($out['props'][$proId])) {
                 unset($out['comboList'][$proId]);
                 continue;
             }
             $propInfo = $out['props'][$proId];
             if (!in_array($propInfo['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
                 continue;
             }
             unset($out['comboList'][$proId]);
         }
     }
     // 获取定价房子可否精选状态
     if ($out['isChoiceCity']) {
         $out['propChoiceStatus'] = Bll_HzProp::getPropChoiceStatus($temProps, $out['cityId']);
     }
 }
Beispiel #29
0
 public function handle_request_internal()
 {
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $params = $this->request->get_parameters();
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $cityId = self::$BrokerInfo['BaseInfo']['CITYID'];
     try {
         // 必须使用POST请求
         if (!$this->request->is_post_method()) {
             throw new Exception('请使用POST请求。');
         }
         /*
         if($cityId == 11){
             APF::get_instance()->get_response()->redirect('/ajkbroker/commissions/my');
             return false;
         }
         */
         // 判断是否套餐城市
         $isComboCity = Bll_Combo_HouseRelation::ifComboCity($cityId);
         if ($isComboCity == true) {
             // 判断经纪人是否购买了租房套餐
             $conbosProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($brokerId);
             if ($conbosProNum['totalRentPropNum'] <= 0) {
                 $isPlan = 0;
                 throw new Exception('经纪人无租房套餐。');
             } else {
                 $isPlan = 1;
             }
         } else {
             $isPlan = 1;
         }
         // 判断房源ID
         $id = isset($params['id']) & intval($params['id']) > 0 ? intval($params['id']) : 0;
         if ($id <= 0) {
             throw new Exception('无效的房源编号。');
         }
         // 判断委托房源是否存在
         $house = Model_House_CommissionHouse::data_access()->filter('id', $id)->find_only();
         if (!$house) {
             throw new Exception('房源不可委托:房源不存在或已被业主删除。');
         }
         // 判断类型是否是出租
         if ($house->commissionType != Model_House_CommissionHouse::COMMISSION_TYPE_RENT) {
             throw new Exception('房源类型不是出租');
         }
         // 判断委托房源状态
         if ($house->proStatus != Model_House_CommissionHouse::STATUS_ONGOING) {
             throw new Exception('房源不可委托:已过期或已被删除。');
         }
         // 判断委托房源已委托数量
         if ($house->openBrokerCnt >= Model_House_CommissionHouse::allowedMaxCommissionCount()) {
             throw new Exception('委托已满。', 37);
         }
         // 判断是否已抢过委托
         $commission = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('houseId', $house->id)->find_only();
         if ($commission) {
             throw new Exception('你已经委托了该房源。', 77);
         }
         // 防并发(先插入,再检测(超出,删除),最后更新)
         // TODO 该方案层使用在2013圣诞活动“找锤子,砸金蛋”,并导致数据库多次TMC,但是在该业务场景中瞬时并发并没有那么多,暂定使用 by 胡言言 2014.02.28
         $commission = Model_House_Commission::create(array('type' => $house->commissionType, 'ownerId' => $house->userId, 'houseId' => $house->id, 'brokerId' => $brokerId, 'createTime' => date('Y-m-d H:i:s'), 'updateTime' => date('Y-m-d H:i:s')));
         $commission->save();
         $rank = Model_House_Commission::data_access()->filter_by_op('houseId', '=', $house->id)->filter_by_op('id', '<=', $commission->id)->sort('id', 'asc')->count();
         if ($rank > Model_House_CommissionHouse::allowedMaxCommissionCount()) {
             $commission->delete();
             throw new Exception('委托已满。', 37);
         }
         // 更新房源的委托数量
         $house->incrCommissionCount();
         // 更新推送房源状态
         $pushedHouse = Model_House_CommissionHousePushed::data_access()->filter('brokerId', $brokerId)->filter('propertyId', $house->id)->find_only();
         if ($pushedHouse) {
             $pushedHouse->propertyStatus = Model_House_CommissionHousePushed::STATUS_RUSHED;
             $pushedHouse->save();
         }
         // 拼装返回数据
         $result = array('isPlan' => $isPlan, 'code' => 0, 'data' => array('owner' => $house->userName, 'phone' => $house->getPhone(), 'title' => '', 'summary' => ''));
         $area = '[' . implode('-', $house->getAreaCodeNames()) . '] ';
         $houseModel = "{$house->roomNum}室{$house->hallNum}厅{$house->toiletNum}卫,{$house->areaNum}平方米,";
         switch ($house->commissionType) {
             case Model_House_CommissionHouse::COMMISSION_TYPE_SALE:
                 // 记录到commission_sale_log日志表
                 $this->insertCommissionSaleLog($house, $brokerId);
                 $result['data']['title'] = '[出售] ' . $house->commName;
                 $result['data']['summary'] = $area . $houseModel . $house->proPrice . '万元';
                 break;
             case Model_House_CommissionHouse::COMMISSION_TYPE_RENT:
                 $result['data']['title'] = '[出租] ' . $house->commName;
                 $result['data']['summary'] = $area . $houseModel . $house->proPrice . '元/月';
                 break;
         }
     } catch (Exception $e) {
         $result = array('code' => $e->getCode() ? $e->getCode() : 1, 'message' => $e->getMessage(), 'isPlan' => $isPlan);
     }
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $result['data']['manageUrl'] = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     $this->response->add_header('Content-type', 'application/json');
     echo json_encode($result);
     die;
 }
 /**
  * @param $brokerId
  * @param $cityId
  * @param string $siteType
  * @return array
  * 房源发布验证是否能够套餐推广
  */
 public static function housePublishComboCheck($brokerId, $cityId, $siteType = self::SITE_TYPE_AJK)
 {
     $comboList = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($brokerId, $siteType);
     if (empty($comboList)) {
         return Util_GlobalFunc::buildReturn(-1, '您还没有购买套餐,只能保存到未推广房源');
     }
     $currentCombo = array();
     $nextCombo = array();
     $currentTime = time();
     $index = Bll_Combo_Broker_BrokerComboInfo::getComboIndexBySiteType($siteType);
     foreach ($comboList as $combo) {
         if (strtotime($combo['endTime']) > $currentTime && strtotime($combo['startTime']) < $currentTime) {
             $currentCombo = $combo;
         } else {
             $nextCombo = $combo;
         }
     }
     $currentComboHouseCount = $currentCombo[$index];
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentComboHouseCount = $currentCombo['rentPropNum'] + $currentCombo['salePropNum'];
     }
     if (empty($currentCombo) && empty($nextCombo)) {
         return Util_GlobalFunc::buildReturn(-2, '您还没有购买套餐,只能保存到未推广房源');
     }
     if (empty($currentCombo) && !empty($nextCombo)) {
         return Util_GlobalFunc::buildReturn(-3, '您的套餐未生效,只能保存到未推广房源');
     }
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo) && ($siteType == self::SITE_TYPE_HZ || $siteType == self::SITE_TYPE_AJK)) {
         $currentSpreadHouseCount = static::getHouseCount($brokerId, $siteType, true);
     } else {
         $currentSpreadHouseCount = static::getHouseCountEx($brokerId, $cityId, $siteType);
     }
     if ($currentSpreadHouseCount >= $currentComboHouseCount) {
         return Util_GlobalFunc::buildReturn(-4, '推广房源已满,只能保存到未推广房源');
     }
     return Util_GlobalFunc::buildReturn(1, '');
 }