示例#1
0
 public function createThreeSiteAccountMust($userId, $ajkBrokerId)
 {
     //查询三网mapping
     $objMapping = Model_Payment_AccountMapping::getAccountMappingByUserId($userId);
     if (!$objMapping || !$objMapping->accountidAjk || !$objMapping->accountidHz || !$objMapping->accountidJp) {
         //获取安居客账户
         $objajkAccount = Model_Payment_AjkUserAccount::getAjkUserAccountByUserId($userId);
         if ($objajkAccount) {
             $ajkAccount = $objajkAccount->accountId;
         } else {
             $ajkAccount = $this->createAjkAccountId($userId);
         }
         //获取租房账户
         $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
         $objHzAccount = Model_Payment_HzUsersAccountMapping::getHzUserAccountByUserId($hzBrokerId);
         if ($objHzAccount) {
             $hzAccount = $objHzAccount->accountId;
         } else {
             $hzAccount = $this->createHzAccountId($hzBrokerId);
         }
         //获取金铺账户
         $objJpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
         $objJpAccount = Model_Payment_JpPayAccount::getAccountByBrokerId($objJpMember->id);
         if ($objJpAccount) {
             $jpAccount = $objJpAccount->account;
         } else {
             $jpAccount = $this->createJpAccountId($objJpMember->id);
         }
         //创建三网账号
         $this->doCreateThreeSiteAccountMust($userId, $ajkAccount, $hzAccount, $jpAccount, $objMapping);
     }
 }
示例#2
0
 public function handle_request_internal()
 {
     /**
      * @var AJKRequest $request
      */
     $request = APF::get_instance()->get_request();
     $cityId = $request->getBrokerCityId();
     $keyWord = $request->get_parameter('q');
     $siteType = trim($request->get_parameter('site'));
     if (empty($keyWord)) {
         $this->response('error', array());
         return;
     }
     if ($siteType == 'hz') {
         //$this->response('ok', Util_SearchUtil::getHzSearchCommunity($cityId, $keyWord));
         // 走二手房小区solr
         $result = Util_SearchUtil::getSearchCommunity($cityId, $keyWord);
         $this->response('ok', $result ? $result : array());
     } elseif ($siteType == 'jp') {
         $pb = trim($request->get_parameter('pb'));
         $cityId = BLL_House_JpHouseManage::getMemberCityId($cityId);
         $jpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId(self::$intBrokerID);
         $this->response('ok', Util_SearchUtil::getJpSearchProperty($cityId, $keyWord, $pb, intval($jpMember->id)));
     } else {
         $this->response('ok', Util_SearchUtil::getSearchCommunity($cityId, $keyWord));
     }
 }
示例#3
0
 /**
  * init env
  * @param AJKRequest $request
  * @param $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $out['isComboBroker'] = Bll_Broker_HzBroker::isComboBroker($out['ajkBrokerId']);
     $route_matches = $request->get_router_matches();
     $out['proId'] = trim($route_matches[2], "/ \t\n\r\v");
     if (!$out['proId']) {
         throw new Exception('缺少房源Id参数');
     }
     $jpMemberInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($out['ajkBrokerId']);
     // 获取金铺brokerId
     $out['jpBrokerId'] = $jpMemberInfo->id;
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::JINPU);
     $out['isBidCity'] = Bll_City::isBidCity($out['cityId'], Const_Site::JINPU);
     if ($out['isChoiceCity'] || $out['isBidCity']) {
         $out['bidTip'] = $out['isChoiceCity'] ? '精选' : '竞价';
         $out['bidUrl'] = $out['isChoiceCity'] ? '/ajkbroker/user/choice/set/jp/' . $out['proId'] : '/jinpu/bid/new/' . $out['proId'];
     }
     $multicity = APF::get_instance()->get_config("cities", "multicity");
     $out['cityName'] = $multicity[$out['cityId']];
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_JpBroker::data_access()->filter('id', $jpMemberInfo->id)->get_row())) {
         throw new Exception('获取金铺经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
 }
示例#4
0
 /**
  * 根据二手房经纪人ID获取金铺经纪人ID
  *
  * @param int $ajkBrokerId
  * @return int
  */
 public static function getJpBrokerInfoByAjkBrokerId($ajkBrokerId)
 {
     $brokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
     if (!$brokerInfo) {
         return 0;
     }
     return $brokerInfo->id;
 }
 public function DownHouse($brokerId = 0, $promitionHouseNum = 0)
 {
     $brokerId = intval($brokerId);
     $promitionHouseNum = intval($promitionHouseNum);
     if ($brokerId == 0 || $promitionHouseNum == 0) {
         return false;
     }
     //将二手房经纪人ID转成商业地产ID
     $jpBrokerInfoObj = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($brokerId);
     if (!$jpBrokerInfoObj || $jpBrokerInfoObj->id == 0) {
         return Util_GlobalFunc::buildReturn(0, "该经纪人:{$brokerId}没有找到");
     }
     //获取这个经纪人的有效计划
     $OnlinePlan = Model_Plan_Jp::getOnlinePlanByMemberId($jpBrokerInfoObj->id);
     if (!$OnlinePlan) {
         return Util_GlobalFunc::buildReturn(0, "该经纪人:{$brokerId}没有有效计划");
     }
     $onlineplan = array();
     foreach ($OnlinePlan as $plan) {
         $onlineplan[] = $plan->id;
         $isBidVersion[$plan->id]['bidVersion'] = $plan->bidVersion;
     }
     //获取这些有效计划下的房子
     $houseIdx = Model_House_JpHouseIdx::getHouseInfoByFixPlanId($onlineplan);
     if (!$houseIdx) {
         return Util_GlobalFunc::buildReturn(0, "该经纪人:{$brokerId}有效计划下的房子");
     }
     $housecount = count($houseIdx);
     echo '正在处理商业地产' . $brokerId . ',总推广房源数' . $housecount . ',api中允许推广数量' . $promitionHouseNum;
     $allReturn = array();
     //和套餐的推广房源做比较,如果当前在线推广的房子大于套餐推广房子,则下房源将较早推广的房子下架
     if ($housecount > $promitionHouseNum) {
         $offNum = $housecount - $promitionHouseNum;
         for ($i = $offNum; $i >= 1; $i--) {
             if (empty($houseIdx[$i])) {
                 continue;
             }
             if ($houseIdx[$i]->bidSpreadId) {
                 $resultBid = Bll_House_JpHouseInfo::removeBidHouseFromSpread($houseIdx[$i], $jpBrokerInfoObj->id, 1, false);
                 if (!$resultBid['success']) {
                     $allReturn[] = $resultBid['data'];
                 }
             }
             $resultFix = Bll_House_JpHouseInfo::removeFixHouseFromSpread($houseIdx[$i], $jpBrokerInfoObj->id);
             if (!$resultFix['success']) {
                 $allReturn[] = $resultFix['data'];
             }
         }
     }
     return Util_GlobalFunc::buildReturn(1, $allReturn);
 }
示例#6
0
 public static function propdata_out_fix($params)
 {
     //系统操作,需要移出计划中房源
     $houseInfoObj = Model_House_JpHouseIdx::getPropInfoByPk($params['pro_id']);
     $return = array();
     if ($houseInfoObj->fixSpreadId) {
         $fixPlanInfoObj = Model_Plan_Jp::getPlanInfoByPk($houseInfoObj->fixSpreadId);
         if (!$fixPlanInfoObj) {
             return array('status' => 1, 'msg' => array("定价计划" . $houseInfoObj->fixSpreadId . "信息为空"));
         }
         $jpBrokerInfoObj = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($params['broker_id']);
         $params['broker_id'] = $jpBrokerInfoObj->id;
         if ($params['broker_id'] != $fixPlanInfoObj->memberId) {
             return array('status' => 1, 'msg' => array("定价计划" . $houseInfoObj->fixSpreadId . "信息经纪人ID不同"));
         }
         //取消定价,更新数据
         if ($houseInfoObj->bidSpreadId) {
             //todo 取消定价之前需要先取消竞价
         }
         //更新房源信息
         if (BLL_Fixedspread_StaticPlanUpDownSwicher::isOnline()) {
             $houseInfoObj->save(array('id' => $params['pro_id'], 'fixSpreadId' => 0));
         }
         $return[] = "房源" . $params['pro_id'] . "fixSpreadId:N=>0";
         $return[] = "房源" . $params['pro_id'] . ",fixSpreadId:" . $houseInfoObj->fixSpreadId . "=>0";
         $return[] = "定价计划" . $houseInfoObj->fixSpreadId . ",status=" . $fixPlanInfoObj->status;
         //房源移出定价计划日志
         $data = self::build_prop_log($params, 11, "房源移出定价组", 0);
         Model_Log_HouseLogNew::create($data, date('Ymd'))->save();
         //房源在线
         if ($fixPlanInfoObj->status == 2 && $fixPlanInfoObj->noBudgetDate < date("Ymd")) {
             $return[] = "status=2,no_budget_date=" . $fixPlanInfoObj->noBudgetDate . ",房源在线";
             if (BLL_Fixedspread_StaticPlanUpDownSwicher::isOnline()) {
                 //获取房源分表信息
                 $houseClass = Model_House_JpHouseIdx::getHouseTypeModelClass($houseInfoObj->houseType);
                 $houseObj = $houseClass::getPropInfoByPk($params['pro_id']);
                 //更新删除房源时间
                 $houseObj->isList = 0;
                 $houseObj->save();
                 $all_return[] = "houseType:" . $houseInfoObj->houseType . ",isList:1=>0";
             }
             //写入下线日志,并且更新数据
             $data = self::build_prop_log($params, 6, "房源下线", 0);
             Model_Log_HouseLogNew::create($data, date('Ymd'))->save();
             $return[] = "房源" . $params['pro_id'] . "下线日志写入";
         }
     }
     return array('status' => 1, 'msg' => $return);
 }
 private function jpAction($brokerId, $params)
 {
     $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($brokerId)->id;
     $houseId = $params['propId'];
     $dateStr = $params['date'];
     $date = str_replace('.', '', $dateStr);
     //获取金铺精选点击明细
     $getChoiceClickDetails = Model_Choice_JpPropClickDetails::getChoiceClickDetailsInfo($jpBrokerId, $houseId, $date);
     $result = array();
     foreach ($getChoiceClickDetails as $click) {
         $result[] = date('H:i:s', $click['clickTime']);
     }
     echo json_encode($result);
     return false;
 }
示例#8
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     if ($params['site'] == 'jp') {
         //金铺逻辑
         $jpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($brokerId);
         $jpMemberId = intval($jpMember->id);
         $this->response(BLL_House_JpProperty::getJpLibrary($params, $jpMemberId));
     } elseif ($params['site'] == 'hz') {
         //租房逻辑
     } else {
         //二手房房逻辑
     }
 }
示例#9
0
 /**
  * @param $request object
  * @param $brokerInfo array
  * @param $type string rent || sale
  * @return array
  */
 public static function getShopBeforePost($request, $brokerInfo, $type)
 {
     $out = $logGiveArr = array();
     $params = $request->get_parameters();
     // manager_id不为空,说明是伪登录
     $out['managerId'] = $request->get_cookie('manager_id');
     // 经纪人信息
     $out['brokerInfo'] = $brokerInfo;
     $cityId = $brokerInfo['CITYID'];
     //金铺城市ID转换
     $jpCityId = $out['brokerInfo']['jpCityId'] = BLL_House_JpHouseManage::getMemberCityId($cityId);
     $out['ajkBrokerId'] = $out['brokerInfo']['BROKERID'];
     $jpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($out['ajkBrokerId']);
     $out['brokerInfo']['jpMemberId'] = intval($jpMember->id);
     //获取城市配置信息是否是精选推广
     $out['isChoiceCity'] = Bll_City::isChoiceCity($jpCityId, Const_Site::JINPU);
     $out['bidTip'] = $out['isChoiceCity'] ? '精选' : '竞价';
     //是否套餐经纪人
     $out['isCombo'] = $brokerInfo['PAYTYPE'] == 9999 ? 1 : 0;
     //套餐城市是否显示推广按钮,以及提示
     $out['spreadFlagInfo'] = array('spreadFlag' => 1, 'info' => '');
     if ($out['isCombo']) {
         $comboCheck = Bll_Combo_HouseRelation::housePublishComboCheck($out['ajkBrokerId'], $cityId, Bll_Combo_HouseRelation::SITE_TYPE_JP);
         if ($comboCheck['status'] != 1) {
             $out['spreadFlagInfo'] = array('spreadFlag' => 0, 'info' => $comboCheck['msg']);
         }
     }
     // 获取全部图片分类信息(用于编辑时候默认展示分类情况)
     $arrCategory = array();
     $arrAllCates = Model_Image_Category::get_img_cates_by_type('shop');
     $arrCategory['all'] = $arrAllCates;
     $arrCategory['classify'] = array_fill_keys(array_keys($arrAllCates), 0);
     $out['arrCategory'] = $arrCategory;
     // 描述引导
     $out['descGuide'] = self::getShopDescGuideTitle($type);
     //编辑图片,用于展示退回照片模块
     $out['editPic'] = $params['edit_pic'];
     //北上广深 四城市
     $citySpecial = array('13', '14');
     $out['priceType'] = in_array($jpCityId, $citySpecial) ? 1 : 0;
     $out['isPost'] = $request->is_post_method();
     if ($type == 'rent') {
         //交租方式
         $out['rentModeFirst'] = Model_House_JpShopRent::getRentModeFirst();
         $out['rentModeSecond'] = Model_House_JpShopRent::getRentModeSecond();
     }
     //---------是否编辑---------------//
     $shopInfo = array();
     $shopId = 0;
     $propertyId = 0;
     // 初始化参数
     $matches = $request->get_router_matches();
     if (isset($matches[2]) && !empty($matches[2])) {
         $shopId = intval($matches[2]);
         $shopInfo = $type == 'rent' ? Model_House_JpShopRent::getPropInfoById($shopId) : Model_House_JpShopSale::getPropInfoById($shopId);
         $propertyId = $shopInfo['propertyId'];
     }
     $out['isEdit'] = empty($shopInfo) ? 0 : 1;
     //四选一弹层
     $out['bolFlag'] = $out['isEdit'] || !isset($params['from']) ? 0 : 1;
     $out['shopInfo'] = $shopInfo;
     $out['shopId'] = $shopId;
     if (!$out['isCombo']) {
         $planInfo = BLL_House_JpHouseManage::getFixPlanInfo($shopId);
         if ($out['isEdit'] && $planInfo['success'] && $planInfo['data']['status'] == 3) {
             //定价计划状态为3,不可编辑
             return array('status' => 'error', 'errCode' => Const_PublishCode::UNKNOWN_ERROR);
         }
     }
     //新发,需要验证房源发布套数限制
     if (!$out['isEdit']) {
         if (BLL_House_JpHouseManage::houseNumLimit($out['brokerInfo']['jpMemberId'], $out['ajkBrokerId'], true)) {
             //保存漏斗日志
             if ($out['isPost']) {
                 $houseType = Bll_Loudou_Log::jinpuHouseType('shop', $type);
                 $str = '';
                 switch ($params['goto_next_step']) {
                     case 'planCombo':
                     case 'planFix':
                         $str = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_OTHERS;
                         break;
                     case 'justSaveHouse':
                         $str = Bll_Loudou_Log::RESULT_TYPE_SAVE_FAILED_HOUSE_MAX_LIMIT;
                         break;
                 }
                 $logGiveArr[] = array('func' => array('Bll_Loudou_log', 'add'), 'params' => array($houseType, $str, Bll_Loudou_Log::SOURCE_TYPE_FORM));
             }
             return array('status' => 'error', 'errCode' => Const_PublishCode::PUBLISH_OUT_OF_LIMIT);
         }
     }
     //经营信息模块的配置信息
     list($out['enumShopType'], $out['enumShopMatching'], $out['enumShopIndustry'], $out['enumShopIndustryLimit'], $out['enumShopPassengerType']) = BLL_House_JpProperty::getShopEnum();
     //页面精品房源url
     $out['exquisiteUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1026');
     //页面经典范例url
     $out['exampleTitleUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1044');
     //页面房源描述下方经典范例url
     $out['exampleDescUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1045');
     //房源发布协议url
     $out['contractUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('554');
     //房源PPC价格段信息
     $out['ppcInfo'] = Bll_Plan_JpPlanManage::getInstance()->getPPCPrice($jpCityId, $type == 'rent' ? 3 : 4);
     //城市区域列表,选择区域使用
     $out['districts'] = Model_Jinpu_District::getCityDistricts($jpCityId);
     //经纪人定价推广组信息
     $out['fixPlanInfo'] = $out['isCombo'] ? array() : Bll_Plan_JpPlanManage::getInstance()->getBrokerFixPlans($out['brokerInfo']['jpMemberId']);
     if ($out['isEdit']) {
         //编辑状态下的特殊信息
         //编辑 验证房源是否属于经纪人
         if ($out['brokerInfo']['jpMemberId'] != $out['shopInfo']['memberId']) {
             return array('status' => 'error', 'errCode' => Const_PublishCode::NOT_OWN_HOUSE);
         }
         //房源交租方式(付一押一)
         list($out['rentModelFirst'], $out['rentModelSecond']) = explode(',', $shopInfo['rentMode']);
         //单层 多层 独栋
         $out['floorType'] = 1;
         if ($shopInfo['isFullFloor']) {
             $out['floorType'] = 3;
         } elseif ($shopInfo['upFloor']) {
             $out['floorType'] = 2;
         }
         //房源推广信息,被编辑的房源是否在推广中
         $houseCanSpread = 1;
         if ($out['isCombo']) {
             $houseCombo = Model_Combo_HouseRelation::getOnlineHousebyHouseId($out['ajkBrokerId'], $shopId, $cityId, Model_Combo_HouseRelation::SITE_TYPE_JP);
             if (!empty($houseCombo)) {
                 $houseCanSpread = 0;
             }
         } else {
             $shopIdx = Model_House_JpHouseIdx::data_access()->filter('id', $shopId)->get_row();
             if (!empty($shopIdx['fixSpreadId'])) {
                 $houseCanSpread = 0;
             }
         }
         $out['houseCanSpread'] = $houseCanSpread;
         //图片退回信息
         $out['backRows'] = array();
         if ($shopId && $out['isEdit']) {
             $out['backRows'] = Bll_Image_JpHouseImage::getBackRows($shopId, $type == 'rent' ? 3 : 4);
         }
         //房源描述
         $desc = $type == 'rent' ? Model_Jinpu_ShopRentDesc::getByPk($shopId) : Model_Jinpu_ShopSaleDesc::getByPk($shopId);
         $out['shopDesc'] = $desc['desc'];
         //房源物业信息
         $out['propertyData'] = $propertyData = (array) BLL_House_JpProperty::getProperty($shopInfo['propertyId']);
         if (!$propertyData) {
             return array('status' => 'error', 'errCode' => Const_PublishCode::NOT_OWN_HOUSE);
         }
         if ($propertyData['isRoad'] == 1 && ($shopInfo['districtId'] || !$shopInfo['blockId'])) {
             $out['forceBlockEdit'] = true;
         } elseif ($propertyData['isRoad'] == 0 && (!$propertyData['districtId'] || !$propertyData['blockId'])) {
             $out['forceBlockEdit'] = true;
         }
         if (!$out['forceBlockEdit']) {
             //逻辑好多啊 妹子的
             $districtIdForSearch = !$propertyData['isRoad'] ? $propertyData['districtId'] : $shopInfo['districtId'];
             $blockIdForSearch = !$propertyData['isRoad'] ? $propertyData['blockId'] : $shopInfo['blockId'];
             $districtInfo = Model_Jinpu_District::data_access()->filter('id', $districtIdForSearch)->get_row();
             $districtName = $districtInfo['is_actived'] == 1 ? $districtInfo['name'] : '';
             $blockInfo = Model_Jinpu_Block::data_access()->filter('id', $blockIdForSearch)->get_row();
             $blockName = $blockInfo['isActived'] == 1 ? $blockInfo['name'] : '';
             $titleStr = $districtName . '&nbsp;' . $blockName . '&nbsp;' . (!$propertyData['isRoad'] ? $propertyData['address'] : '') . (!empty($shopInfo['closeRoad']) ? '靠近:' . $shopInfo['closeRoad'] : '');
             $showStr = strlen($titleStr) > 90 ? Util_GlobalFunc::cutchar($titleStr, 28) : $titleStr;
             $out['titleStr'] = $titleStr;
             $out['showStr'] = $showStr;
         }
         $out['hasLibrary'] = BLL_House_JpProperty::hasLibrary($out['brokerInfo']['jpMemberId'], $shopInfo['propertyId'], 'property');
         //房源图片查询和排序
         $images = self::handleShopImages($shopId, $type);
         //个人图库图片是否被锁定
         foreach ($images as $key => $imgVal) {
             $imgVal['isLock'] = 0;
             if ($imgVal && $imgVal['personalImgId']) {
                 $personalImg = Model_Jinpu_PersonalGallery::getImgById($imgVal['personalImgId']);
                 if ($personalImg && $personalImg->category) {
                     $imgVal['isLock'] = 1;
                 }
             }
             if ($imgVal['category'] && isset($out['arrCategory']['classify'][intval($imgVal['category'])])) {
                 $out['arrCategory']['classify'][intval($imgVal['category'])] += 1;
             }
             $images[$key] = $imgVal;
         }
         $out['images'] = $images;
     }
     $lng = $lat = $mapDataFlag = 0;
     //地图标注商铺位置的逻辑
     $DShopMap = Model_Jinpu_MapShop::getByPK($shopId);
     if (!empty($DShopMap)) {
         $lng = $DShopMap['lng'];
         $lat = $DShopMap['lat'];
         $mapDataFlag = 1;
     } else {
         if ($propertyId > 0) {
             $shopLocation = Model_Jinpu_MapProperty::getPropertyMapById($propertyId);
             if (!empty($shopLocation)) {
                 $lng = $shopLocation['lng'];
                 $lat = $shopLocation['lat'];
             }
         } else {
             list($lng, $lat) = BLL_House_JpHouseManage::getDefaultMap($out['brokerInfo']['CITYID']);
         }
         $mapDataFlag = 0;
     }
     $out['lng'] = $lng;
     $out['lat'] = $lat;
     $out['mapDataFlag'] = $mapDataFlag;
     return array('status' => 'ok', 'info' => $out, 'logArr' => $logGiveArr);
 }
示例#10
0
 /**
  * 金铺-精选房源设置
  *
  * @param $ajkBrokerId
  * @param $cityId
  * @param $propId
  * @param array $params
  * @return array
  */
 public static function jp_setting_post($ajkBrokerId, $cityId, $propId, $params = array())
 {
     $jpBrokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
     //check房源是否已经加入精选推广
     $bidObj = Model_Plan_Jp::getBidPlanByHouseIdEx($ajkBrokerId, $propId, true);
     if (!empty($bidObj)) {
         if ($bidObj['status'] == Model_Plan_Jp::ENUM_STATUS_ONLINE || $bidObj['status'] == Model_Plan_Jp::ENUM_STATUS_CHOICE_HOLD) {
             return array('err_no' => self::BID_HOUSE_ALREADY_IN_BID, 'err_msg' => '房源已经加入精选推广');
         } elseif ($bidObj['status'] == Model_Plan_Jp::ENUM_STATUS_HOLD) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源正在结算中,请稍后...');
         }
     }
     $bidChoiceCount = Model_Plan_Jp::getBidChoiceInfoEx($cityId, $ajkBrokerId);
     //获取精选推广预算
     $brokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($ajkBrokerId);
     $brokerCompanyId = $brokerInfo['BaseInfo']['COMPANYID'];
     $choiceSet = APF::get_instance()->get_config('choice_set');
     if (isset($choiceSet[$brokerCompanyId]) && !empty($choiceSet[$brokerCompanyId])) {
         $min_budget = $choiceSet[$brokerCompanyId]['jp']['JP_CHOICE_MIN_BUDGET'];
         $max_budget = $choiceSet[$brokerCompanyId]['jp']['JP_CHOICE_MAX_BUDGET'];
     } else {
         $min_budget = $choiceSet['default']['jp']['JP_CHOICE_MIN_BUDGET'];
         $max_budget = $choiceSet['default']['jp']['JP_CHOICE_MAX_BUDGET'];
     }
     if ($params['budget'] < $min_budget || $params['budget'] > $max_budget) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '推广预算最低' . $min_budget . '安币,最高' . $max_budget . '安币');
     }
     $status = isset($bidObj['status']) ? $bidObj['status'] : 0;
     if (count($bidChoiceCount) >= self::ALL_JP_PLAN_NUM && $status != 4) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '精选推广房源已经超过' . self::ALL_JP_PLAN_NUM . '套');
     }
     if (0 == $jpBrokerInfo) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '您不是金铺经纪人');
     }
     /** 获取房源基本信息 */
     $propInfo = Bll_House_JpHouseInfo::getHouseInfoById($propId);
     if (empty($propInfo)) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源不存在');
     }
     if ($propInfo['base']['memberId'] != $jpBrokerInfo['id']) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源不属于该经纪人');
     }
     /** 判断是否是精选开放城市 */
     if (!Bll_City::isChoiceIndependentCity($cityId, Const_Site::JINPU)) {
         /** 判断房源是否在套餐推广 */
         $propCombos = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($propId, Bll_Combo_HouseRelation::SITE_TYPE_JP);
         if (empty($propCombos)) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源必须在套餐推广才能参与精选');
         }
     }
     if (false == $propInfo['info']['isExquisite']) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '精品、新发15天房源才能参与精选推广', 'params' => array('site' => 'jp'));
     }
     $limitDay = intval(date('Ymd', strtotime('-15 days')));
     $postDay = intval(date('Ymd', strtotime($propInfo['base']['createTime'])));
     if ($limitDay > $postDay) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '精品、新发15天房源才能参与精选推广', 'params' => array('site' => 'jp'));
     }
     /** 获取板块信息 **/
     $blockArr = Bll_House_JpHouseInfo::getBlock($propInfo['base']['houseType'], $propInfo['info']);
     if (!$blockArr['blockId'] && !$blockArr['newBlockId']) {
         return array('err_no' => self::BID_HOUSE_ALREADY_IN_BID, 'err_msg' => '房源缺少板块信息');
     }
     /** 获取价格信息 **/
     $arrPrice = Bll_House_JpHouseInfo::getPrice($cityId, $propInfo['base']['houseType'], $propInfo['info']);
     if (empty($arrPrice['price_id'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '缺少价格段信息');
     }
     /** 获取点击单价开始 */
     try {
         $apiParams = array('brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'price' => $arrPrice['price'] ?: 0, 'blockId' => $blockArr['blockId'] ?: 0, 'newBlockId' => $blockArr['newBlockId'] ?: 0, 'houseType' => $propInfo['base']['houseType']);
         /**
          * @var Bll_Service_Client_HttpResponse $clickPrice
          */
         for ($i = 0; $i < 3; $i++) {
             $clickPrice = Bll_Service_Choice::jpClickPrice($apiParams);
             if ($clickPrice->isSucceeded()) {
                 break;
             }
         }
         if (!$clickPrice->isSucceeded() || $clickPrice['status'] == 'error') {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统繁忙(code:-1000)');
         }
         if ($params['budget'] * 100 < $clickPrice['realTradeAmount']) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '推广预算不能小于点击单价');
         }
         /** 点击单价不能小于当前系统内的单价 防止恶意操作 */
         if ($params['price'] < $clickPrice['realTradeAmount'] / 100) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '点击单价错误');
         }
     } catch (Exception $e) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统繁忙(code:-2000)');
     }
     /** 防并发 */
     if (false === self::rejectSameRequest(Bll_Plan_Bid_Choice::SITE_JP, $ajkBrokerId, $propId)) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统繁忙(code:-906)');
     }
     /** 往冻结队列里添加记录,获取request id*/
     $bidFreezeOrder = new Bll_Plan_BidFreezeOrderNum(date('Y'));
     $ajk_user_id = Bll_Broker_MainBusiness::getDataByEsfId($ajkBrokerId)->memberId;
     $requestId = $bidFreezeOrder->getRequestId(Bll_Plan_BidFreezeOrderNum::JP, $ajk_user_id, date('Y'), 0, $propId);
     /** 冻结金额 **/
     $freezeResult = self::bid_freeze($ajkBrokerId, $params['budget'] * 100, $requestId, sprintf('金铺精选房源冻结,房源ID是: %d', $propId), Const_PaymentApp::JP_CHOICE);
     /** 判断是否冻结成功 **/
     $freezeResponse = $freezeResult->getResponse();
     if (!$freezeResult->isSucceeded() || $freezeResponse['status'] == 'error') {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => isset($freezeResult['info']) ? $freezeResult['info'] . "code:" . $freezeResult['code'] : '冻结金额失败');
     }
     //检查是否有坑位 坑位+1
     $bucketStatus = Model_Choice_JPBidBucket::incrementUsedNum($blockArr['blockId'], $blockArr['newBlockId'], $propInfo['base']['houseType'], $arrPrice['price_id']);
     if (!$bucketStatus) {
         return array('err_no' => self::BID_WAIT_FAIL, 'err_msg' => '精选推广已满,请稍后再试');
     }
     /** 获取最小竞价单元的精选信息 **/
     $bucketInfo = Model_Choice_JPBidBucket::getBucketInfo($blockArr['blockId'], $blockArr['newBlockId'], $propInfo['base']['houseType'], $arrPrice['price_id']);
     /** 根据最小竞价单位里面的房源数判断当前的房源应该是排队还是推广中 **/
     /*
     if ($bucketInfo['usedNum'] > $bucketInfo['maxOnlineNum']) {
         $planStatus = Model_Plan_Jp::ENUM_STATUS_CHOICE_HOLD;
     } else {
         $planStatus = Model_Plan_Jp::ENUM_STATUS_ONLINE;
     }
     */
     $planStatus = Model_Plan_Jp::ENUM_STATUS_CHOICE_HOLD;
     /** 如果计划已经存在删除该计划**/
     if (isset($bidObj['status']) && $bidObj['status'] == 4) {
         Model_Plan_Jp::data_access()->set_field('isDelete', 1)->filter('id', $bidObj['id'])->update();
     }
     /** 构造计划数据 创建计划**/
     $planData = self::buildJpPlanData($cityId, $jpBrokerInfo['id'], $params['budget'], $freezeResult['data']['sn'], $propId, $blockArr['blockId'], $blockArr['newBlockId'], $arrPrice['price_id'], $propInfo['base']['houseType'], $planStatus);
     $planData['ajkBrokerId'] = $ajkBrokerId;
     $PlanObj = Model_Plan_Jp::create($planData);
     $PlanObj->save();
     if (empty($PlanObj->id)) {
         /** 坑位-1 **/
         Model_Choice_JPBidBucket::decrementUsedNum($blockArr['blockId'], $blockArr['newBlockId'], $propInfo['base']['houseType'], $arrPrice['price_id']);
         Model_Plan_Jp::data_access()->set_field('isDelete', 0)->filter('id', $bidObj['id'])->update();
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '创建计划失败');
     }
     /** 更新房源里面的竞价计划id **/
     $propInfo['base']->bidSpreadId = $PlanObj->id;
     $propInfo['base']->save();
     /** 更新房源分表信息 **/
     //$propInfo['info']->isList = 1;
     $propInfo['info']->spreadOffer = $clickPrice['realTradeAmount'];
     $propInfo['info']->spreadOfferTime = time();
     $propInfo['info']->save();
     /** 构建精选动作处理数据 **/
     $choiceData = self::buildJpChoiceData($ajkBrokerId, Model_Choice_ActionQueue::ENUM_BEGIN_BY_HAND, $PlanObj->id, '经纪人手动推广', $propId);
     /** 插入到精选动作处理队列表 **/
     Model_Choice_ActionQueue::create($choiceData, date('m'))->save();
     $bidFreezeOrder->updateRequestComplete($requestId, $freezeResult['data']['sn'], $PlanObj->id);
     if ($bucketInfo['usedNum'] > $bucketInfo['maxOnlineNum']) {
         $rank = $bucketInfo['usedNum'] - $bucketInfo['maxOnlineNum'];
         return array('err_no' => self::BID_WAIT_SUCCESS, 'err_msg' => '精选排队成功', 'rank' => $rank);
     } else {
         return array('err_no' => self::BID_SHOW_SUCCESS, 'err_msg' => '精选推广成功');
     }
 }
示例#11
0
 public static function checkList($list)
 {
     if (empty($list['planId'])) {
         return Bll_HzPropBll::build_return(0, array("planId 为空"));
     }
     if (empty($list['brokerId'])) {
         return Bll_HzPropBll::build_return(0, array("brokerId 为空"));
     }
     if (empty(Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($list['brokerId'])->id)) {
         return Bll_HzPropBll::build_return(0, array("获取金铺经纪人失败"));
     }
     return Bll_HzPropBll::build_return(1, array("success"));
 }
示例#12
0
 /**
  * 金铺精选推广 放弃排队 删除推广 放弃推广 动作
  * 2-推广中 4-结束 6排队中
  */
 public static function spreadOperation($act, $id)
 {
     $result = array('status' => 'error');
     $request = APF::get_instance()->get_request();
     $ajkBlockId = $request->getBrokerId();
     $jpBrokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBlockId);
     if (isset($act) && intval($id)) {
         $spreadInfo = Model_Plan_Jp::data_access()->filter('isDelete', 0)->filter('id', $id)->get_row();
         if (!empty($spreadInfo) && $spreadInfo['memberId'] == $jpBrokerInfo->id) {
             switch ($act) {
                 case 'delete':
                     if ($spreadInfo['status'] == 4) {
                         //删除计划ID
                         Model_Plan_Jp::data_access()->set_field('isDelete', 1)->set_field('updateTime', date('Y-m-d H:i:s'))->filter('id', $id)->update();
                         //设置房源bidSpreadId为0
                         Model_House_JpHouseIdx::data_access()->set_field('bidSpreadId', 0)->filter('id', $spreadInfo['houseId'])->update();
                         $result = array('status' => 'ok');
                     } elseif ($spreadInfo['status'] == 3) {
                         $result = array('status' => '该房源正在结算中,请稍后');
                     } else {
                         $result = array('status' => '该房源正在推广或排队中');
                     }
                     break;
                 case 'stopQueue':
                 case 'stopPlan':
                     if ($spreadInfo['status'] == 3) {
                         $result = array('status' => '该房源正在结算中,请稍后');
                     } elseif ($spreadInfo['status'] == 2 || $spreadInfo['status'] == 6) {
                         $choiceData = Bll_Plan_Bid_Choice::buildJpChoiceData($ajkBlockId, Model_Choice_ActionQueue::ENUM_STOP_BY_HAND, $id, '停止精品推广', $spreadInfo['houseId']);
                         if (1 != Model_Choice_ActionQueue::create($choiceData, date('m'))->save()) {
                             $result = array('status' => '系统繁忙');
                             break;
                         }
                         //更新计划状态为计算中
                         $updatePlanStatus = Model_Plan_Jp::data_access()->set_field('status', Model_Plan_Jp::ENUM_STATUS_HOLD)->set_field('updateTime', date('Y-m-d H:i:s'))->filter('id', $id)->update();
                         if ($updatePlanStatus == 0) {
                             $result = array('status' => '暂停计划失败');
                             break;
                         }
                         //设置房源bidSpreadId为0
                         $updateBidSpreadId = Model_House_JpHouseIdx::data_access()->set_field('bidSpreadId', 0)->filter('id', $spreadInfo['houseId'])->update();
                         if (1 != $updateBidSpreadId) {
                             $result = array('status' => '暂停计划失败');
                             break;
                         }
                         //坑位表减一
                         Model_Choice_JPBidBucket::decrementUsedNum($spreadInfo['blockId'], $spreadInfo['newBlockId'], $spreadInfo['houseType'], $spreadInfo['priceId']);
                         $result = array('status' => 'ok');
                         break;
                     }
                 default:
                     break;
             }
         }
     }
     return $result;
 }
示例#13
0
 public static function JpBidEffectRank($bidPlanIds, $ajkBrokerId)
 {
     if (empty($p_arrSpreadIDs)) {
         return array();
     }
     $arrRtn = $arrSpreadIDs = array();
     $objRankBll = BLL_Spread_SpreadRankBLL::get_instance();
     $objHp = new BLL_Spread_HpManage();
     $objClickBll = Bll_Pay_ClickLogBll::get_instance();
     $jpMemberId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
     $memberId = $jpMemberId->id;
     //取计划信息
     $objModelSp = Model_Plan_Jp::data_access();
     $objSpreads = $objModelSp->find_by_pks($bidPlanIds);
     if (!empty($objSpreads)) {
         foreach ($objSpreads as $objSp) {
             //要返回的数据
             $arrRtnEle = array('hid' => $objSp->house_id, 'spreadid' => $objSp->id, 'rank' => 0, 'click' => 0, 'cost' => 0, 'is_stop' => 0);
             $arrSpreadIDs[] = $objSp->id;
             //已经暂停的计划
             if ($objSp->status == 4) {
                 $arrRtnEle['is_stop'] = 1;
             } elseif ($objSp->status == 3) {
                 $arrRtnEle['is_stop'] = -1;
             }
             //依据计划id获取
             try {
                 $objModelH = Model_House_JpHouseIdx::data_access();
                 $objHouse = $objModelH->filter('member_id', $memberId)->filter('bid_spread_id', $objSp->id)->find_only();
                 unset($objModelH);
             } catch (Exception $e) {
                 $objHouse = null;
             }
             //若不在计划中,按房源id获取
             if (empty($objHouse) && $objSp->house_id) {
                 try {
                     $objModelH = Model_House_JpHouseIdx::data_access();
                     $objHouse = $objModelH->find_by_pk($objSp->house_id);
                     unset($objModelH);
                 } catch (Exception $e) {
                     $objHouse = null;
                 }
             } else {
                 $arrRtnEle['hid'] = $objHouse->id;
             }
             //根据房源信息获取竞价中房源的排名
             if (!empty($objHouse) && $objHouse->bidSpreadId) {
                 $objHouseInfo = Bll_House_JpHouseInfo::getHouseInfoById($objHouse->id);
                 $arrRtnEle['rank'] = Bll_Plan_JpRank::getRankingByHouse($objHouse->id, $objHouseInfo['info']->spreadOffer, $objHouse->houseType, false, 'rank_show');
                 if (!$arrRtnEle['rank'] && $objHouse->bidSpreadId) {
                     $arrRtnEle['rank'] = Bll_Plan_JpRank::getRankingByHouse($objHouse->id, $objHouseInfo['info']->spreadOffer, $objHouse->houseType, false, 'rank_pre');
                 }
             }
             //根据房源ID获取竞价计划的今日点击
             $arrRtnEle['click'] = 0;
             if (!empty($objHouse)) {
                 $arrClick_t = $objClickBll->get_today_click_info_by_house($objHouse->id, 2, date("Ymd"));
                 //当日数据
                 $arrRtnEle['click'] = $arrClick_t;
             }
             $arrRtn[] = $arrRtnEle;
         }
         //根据计划ID获取竞价中计划的总花费
         if (!empty($arrSpreadIDs)) {
             $arrPayLog = $objHp->getPayLogBySpreadIDs($arrSpreadIDs);
             foreach ($arrRtn as $key => $arrData) {
                 if (isset($arrPayLog[$arrData['spreadid']])) {
                     $arrData['cost'] = $arrPayLog[$arrData['spreadid']]['cost_sum'];
                 } else {
                     $arrData['cost'] = 0;
                 }
                 $arrRtn[$key] = $arrData;
             }
         }
     }
     return $arrRtn;
 }
示例#14
0
 public function checkInputValid($action)
 {
     switch ($action) {
         case 'deleteHouses':
             $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($this->brokerId)->id;
             if (!$jpBrokerId) {
                 $this->outPut(0, '金铺经纪人信息有误');
             }
             if (empty($this->params['houseIds'])) {
                 $this->outPut(0, '房源信息有误');
             }
             $this->jpBrokerId = $jpBrokerId;
             break;
         case 'houseCombo':
             $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($this->brokerId)->id;
             if (!$jpBrokerId) {
                 $this->outPut(0, '金铺经纪人信息有误');
             }
             //是否套餐经纪人
             $broker_info = Dao_Broker_BrokerInfo::get_broker_base_info($this->brokerId);
             if ($broker_info['PAYTYPE'] != 9999) {
                 $this->outPut(0, '经纪人信息有误');
             }
             if (empty($this->params['houseIds'])) {
                 $this->outPut(0, '房源信息有误');
             }
             $this->jpBrokerId = $jpBrokerId;
             break;
         case 'cancelHouseCombo':
             $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($this->brokerId)->id;
             if (!$jpBrokerId) {
                 $this->outPut(0, '金铺经纪人信息有误');
             }
             //是否套餐经纪人
             $broker_info = Dao_Broker_BrokerInfo::get_broker_base_info($this->brokerId);
             if ($broker_info['PAYTYPE'] != 9999) {
                 $this->outPut(0, '经纪人信息有误');
             }
             if (empty($this->params['houseIds'])) {
                 $this->outPut(0, '房源信息有误');
             }
             $this->jpBrokerId = $jpBrokerId;
             break;
         case 'getPropTemplate':
             $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($this->brokerId)->id;
             if (!$jpBrokerId) {
                 $this->outPut(0, '金铺经纪人信息有误');
             }
             $this->jpBrokerId = $jpBrokerId;
             break;
         case 'savePropTemplate':
             $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($this->brokerId)->id;
             if (!$jpBrokerId) {
                 $this->outPut(0, '金铺经纪人信息有误');
             }
             if (!isset($this->params['type']) || !in_array($this->params['type'], array(1, 2, 3, 4))) {
                 $this->outPut(0, '房源模板信息有误');
             }
             if (!isset($this->params['title']) || empty($this->params['title']) || mb_strlen($this->params['title'], 'UTF-8') > 30) {
                 $this->outPut(0, '房源模板标题不能超过30个字');
             }
             if (!isset($this->params['content']) || empty($this->params['content'])) {
                 $this->outPut(0, '房源模板内容不能为空');
             }
             $templateContent = strip_tags($this->params['content']);
             if (empty($templateContent) || mb_strlen($templateContent, 'UTF-8') < 30) {
                 $this->outPut(0, '房源模板内容不能小于30个字');
             }
             $this->jpBrokerId = $jpBrokerId;
             break;
         case 'deletePropTemplate':
             $jpBrokerId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($this->brokerId)->id;
             if (!$jpBrokerId) {
                 $this->outPut(0, '金铺经纪人信息有误');
             }
             $this->jpBrokerId = $jpBrokerId;
             break;
     }
 }
示例#15
0
 public static function broker_restitution($params)
 {
     $all_return[] = "队列(" . $params['id'] . ")开始处理";
     $all_return[] = '金铺系统返还';
     //todo 查询用户所有定价计划,开启计划,上线房源
     $ajk_broker_id = $params['broker_id'];
     //获取金铺经纪人broker_id
     $jpBrokerInfoObj = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($params['broker_id']);
     $params['broker_id'] = $jpBrokerInfoObj->id;
     //获取由于余额用完停止的计划
     $fixInfoObjs = Model_Plan_Jp::getNoBalancePlan($params['broker_id']);
     foreach ($fixInfoObjs as $fixInfoObj) {
         $plan_log = array();
         $plan_log['id'] = $params['id'];
         $plan_log['plan_id'] = $fixInfoObj->id;
         $plan_log['broker_id'] = $ajk_broker_id;
         $plan_log['city_id'] = $fixInfoObj->cityId;
         $plan_log['type'] = $params['type'];
         $plan_log = Bll_JpFixPlanBll::build_plan_log($plan_log, 8, "系统返还", 0);
         //写计划日志
         if (!Model_House_UpDown_PlanLog::create($plan_log, date('m'))->save()) {
             $all_return[] = "计划" . $plan_log['planId'] . "房源推广日志写入失败";
         } else {
             $all_return[] = "计划" . $plan_log['planId'] . "房源推广日志写入成功";
         }
         //计划开启
         $fixInfoObj->status = 2;
         $fixInfoObj->stopReason = 0;
         if (!$fixInfoObj->save()) {
             return array('status' => 0, 'msg' => array("定价计划" . $plan_log['planId'] . ",更新失败"));
         }
         //获取房源列表
         $houseInfoObjs = Model_House_JpHouseIdx::getHouseInfoByFixPlanId($plan_log['planId']);
         if ($houseInfoObjs) {
             foreach ($houseInfoObjs as $houseInfoObj) {
                 $prop_log['id'] = $params['id'];
                 $prop_log['pro_id'] = $houseInfoObj->id;
                 $prop_log['plan_id'] = $plan_log['planId'];
                 $prop_log['broker_id'] = $ajk_broker_id;
                 $prop_log['city_id'] = $houseInfoObj->cityId;
                 $prop_log['type'] = $params['type'];
                 $prop_log = Bll_JpPropBll::build_prop_log($prop_log, 5, "系统返还", 0);
                 //写房源日志
                 if (!Model_Log_HouseLogNew::create($prop_log, date('Ymd'))->save()) {
                     $all_return[] = "房源" . $houseInfoObj->id . "系统返还后房源推广日志写入失败";
                 } else {
                     $all_return[] = "房源" . $houseInfoObj->id . "系统返还后房源推广日志写入成功";
                 }
                 //获取房源分表信息
                 $houseClass = Model_House_JpHouseIdx::getHouseTypeModelClass($houseInfoObj->houseType);
                 $houseObj = $houseClass::getPropInfoByPk($houseInfoObj->id);
                 //更新展示房源状态
                 $houseObj->isList = 1;
                 if ($houseObj->save()) {
                     $all_return[] = "houseType=" . $houseInfoObj->houseType . ",更新分表isList=1成功";
                 } else {
                     $all_return[] = "houseType=" . $houseInfoObj->houseType . ",更新分表isList=1失败";
                 }
             }
         }
     }
     return Bll_JpPropBll::build_return(1, $all_return);
 }
示例#16
0
 public static function propCheck($houseId, $brokerId)
 {
     //获取房源信息
     $objModel = Model_House_JpHouseIdx::data_access();
     $objHouse = $objModel->find_by_pk($houseId, false);
     if (empty($objHouse)) {
         return array('flg' => false, 'data' => '房源为空');
     }
     $jpMemberId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($brokerId);
     if ($objHouse->memberId != $jpMemberId->id) {
         return array('flg' => false, 'data' => '没有权限操作房源');
     }
     if ($objHouse->isDelete == 1) {
         return array('flg' => false, 'data' => '删除房源无法操作');
     }
     $houseTypeClass = Model_House_JpHouseIdx::getHouseTypeModelClass($objHouse->houseType);
     $objHouseDetail = $houseTypeClass::getPropInfoByPk($houseId);
     if (empty($objHouseDetail)) {
         return array('flg' => false, 'data' => '房源不存在');
     }
     if ($objHouseDetail->isExpired) {
         return array('flg' => false, 'data' => '过期房源不能操作');
     }
     if ($objHouseDetail->isIllegal) {
         return array('flg' => false, 'data' => '违规房源不能操作');
     }
     return array('flg' => true, 'data' => '');
 }