コード例 #1
0
 /**
  * 更新e_commission表
  * @param $dataoh
  * add by xiongjianxu
  */
 private function _updataECommission($data)
 {
     $commissionInfo = Model_House_Commission::data_access()->filter('houseId', $data['houseId'])->filter('brokerId', $data['brokerId'])->find_only();
     if (!$commissionInfo) {
         return false;
     }
     switch ($data['status']) {
         case Model_House_CommissionSaleLog::STATUS_ROB:
             break;
         case Model_House_CommissionSaleLog::STATUS_PUBLISH:
             $commissionInfo->brokerHouseId = $data['brokerHouseId'];
             $commissionInfo->publishTime = date('Y-m-d h-i-s', $data['createTime']);
             break;
         case Model_House_CommissionSaleLog::STATUS_ALTER:
             break;
         case Model_House_CommissionSaleLog::STATUS_DELETE_HOUSE:
             $commissionInfo->deleteTime = date('Y-m-d h-i-s', $data['createTime']);
             break;
         case Model_House_CommissionSaleLog::STATUS_DELETE_RELATION:
             $commissionInfo->isDelete = Model_House_Commission::DELETE_YES;
             break;
         default:
     }
     return $commissionInfo->save();
 }
コード例 #2
0
ファイル: Propview.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 查询房东信息
  * @param $proId
  * @param $brokerId
  * @return bool
  * add by xiongjianxu
  */
 private function getCommissionHouseInfo($proId, $brokerId)
 {
     $commissionInfo = Model_House_Commission::data_access()->filter('brokerHouseId', $proId)->filter('brokerId', $brokerId)->load_field('houseId')->find_only();
     if (!$commissionInfo) {
         return false;
     }
     $houseId = $commissionInfo->houseId;
     $houseInfo = Model_House_CommissionHouse::data_access()->filter('id', $houseId)->find_only();
     return $houseInfo;
 }
コード例 #3
0
ファイル: Delete.php プロジェクト: emilymwang8/ajk-broker
 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 替换为其他的方式
     try {
         // 必须使用POST请求
         if (!$this->request->is_post_method()) {
             throw new Exception('请使用POST请求。');
         }
         // 判断委托ID
         $id = isset($params['id']) & intval($params['id']) > 0 ? intval($params['id']) : 0;
         if ($id <= 0) {
             throw new Exception('非法的委托编号。');
         }
         // 判断委托是否存在
         $commission = Model_House_Commission::data_access()->filter('id', $id)->find_only();
         if (!$commission) {
             throw new Exception('委托不存在。');
         }
         // 确认委托的经纪人和当前经纪人是同一人
         if ($commission->brokerId != $brokerId) {
             throw new Exception('非法的委托编号。');
         }
         // 删除委托
         $commission->isDelete = Model_House_Commission::DELETE_YES;
         $commission->deleteTime = date('Y-m-d H:i:s');
         $commission->save();
         // 如果是出售,记录到commission_sale_log日志表
         if (Model_House_CommissionHouse::COMMISSION_TYPE_SALE == $commission->type) {
             $this->insertCommissionSaleLog($commission);
         }
         // 返回结果
         $result = array('code' => 0, 'message' => 'Delete successfully.');
     } catch (Exception $e) {
         $result = array('code' => $e->getCode() ? $e->getCode() : 1, 'message' => $e->getMessage());
     }
     $this->response->add_header('Content-type', 'application/json');
     // $response->add_header(); // todo no cache
     echo json_encode($result);
     die;
 }
コード例 #4
0
ファイル: Phone.php プロジェクト: emilymwang8/ajk-broker
 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 替换为其他的方式
     try {
         // 必须使用POST请求
         if (!$this->request->is_post_method()) {
             throw new Exception('请使用POST请求。');
         }
         // 判断委托ID
         $id = isset($params['id']) & intval($params['id']) > 0 ? intval($params['id']) : 0;
         if ($id <= 0) {
             throw new Exception('非法的委托编号。');
         }
         // 判断委托是否存在
         $commission = Model_House_Commission::data_access()->filter('id', $id)->find_only();
         if (!$commission) {
             throw new Exception('委托不存在。');
         }
         // 确认委托的经纪人和当前经纪人是同一人
         if ($commission->brokerId != $brokerId) {
             throw new Exception('非法的委托编号。');
         }
         // 获取委托房源信息
         $house = Model_House_CommissionHouse::data_access()->filter('id', $commission->houseId)->find_only();
         if (!$house) {
             throw new Exception('房源不存在');
         }
         // 返回结果
         $result = array('code' => 0, 'data' => array('phone' => $house->getPhone()));
     } catch (Exception $e) {
         $result = array('code' => $e->getCode() ? $e->getCode() : 1, 'message' => $e->getMessage());
     }
     $this->response->add_header('Content-type', 'application/json');
     // $response->add_header(); // todo no cache
     echo json_encode($result);
     die;
 }
コード例 #5
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $maxId = isset($this->_params['maxId']) ? $this->_params['maxId'] : null;
     $sinceId = isset($this->_params['sinceId']) ? $this->_params['sinceId'] : null;
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $per = $per + 1;
     //判断是否有下一页
     $moreFlag = 1;
     $allData = array();
     $cacheCursorKey = md5($brokerId . 'commission');
     //游标key
     $cacheCommissionKey = md5($cacheCursorKey . $brokerId);
     //commissionInfo key
     $cache = APF_Cache_Factory::get_instance()->get_memcache();
     $cacheCursor = $cache->get($cacheCursorKey);
     $maxCommissionInfo = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('isDelete', Model_House_Commission::DELETE_NO)->sort('id', 'desc')->limit(1)->find_only();
     if ($maxCommissionInfo['id'] == $cacheCursor) {
         //没新数据则读缓存
         $allData = $cache->get($cacheCommissionKey);
     } elseif (!empty($maxCommissionInfo)) {
         //如果有新数据
         // 获取经纪人的所有委托
         $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('isDelete', Model_House_Commission::DELETE_NO)->sort('id', 'desc');
         $commissions = $daCommissions->find_all();
         // 获取委托关联的房源
         $houses = array();
         if (!empty($commissions)) {
             $houseIds = array();
             foreach ($commissions as $commission) {
                 $houseIds[] = $commission->houseId;
                 $brokerHouseIds[] = $commission->brokerHouseId;
             }
             // 获取房源信息
             $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
             // 索引
             $indexedHouses = array();
             foreach ($houses as $house) {
                 $indexedHouses[$house['id']] = $house;
             }
             $houses = $indexedHouses;
             // 是否存在实拍图片
             $imagesInfos = Model_Image_SaleEntrustImage::getImagesByProIds($houseIds);
             $isImages = array();
             foreach ($imagesInfos as $imagesInfo) {
                 $isImages[$imagesInfo->proId] = 1;
             }
             $BrokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
             //房源推广状态(定价&套餐)
             $isOnLine = Bll_House_EsfHouse::getHouseOnLineInfo($BrokerInfo['BaseInfo']['CITYID'], $brokerId, $brokerHouseIds);
         }
         $houseAction = array();
         //可操作房源
         $houseUnAction = array();
         //不可操作房源
         foreach ($commissions as $commission) {
             if (!isset($houses[$commission['houseId']])) {
                 continue;
             }
             $house = $houses[$commission['houseId']];
             $row = array();
             $row['id'] = $commission['id'];
             $row['propertyId'] = $house['id'];
             $row['commName'] = $house['commName'];
             $row['type'] = $house['commissionType'];
             $row['room'] = $house['roomNum'];
             $row['hall'] = $house['hallNum'];
             $row['toilet'] = $house['toiletNum'];
             $row['area'] = $house['areaNum'];
             $row['price'] = $house['proPrice'];
             switch ($house['commissionType']) {
                 case Model_House_CommissionHouse::COMMISSION_TYPE_RENT:
                     $row['priceUnit'] = '元/月';
                     break;
                 case Model_House_CommissionHouse::COMMISSION_TYPE_SALE:
                     $row['priceUnit'] = '万元';
                     break;
             }
             $row['publishTime'] = date('Y-m-d H:i:s', $house['created']);
             $row['status'] = $house['proStatus'];
             $row['statusInfo'] = $this->statusMapping[$house['proStatus']];
             $row['ownerName'] = $house['userName'];
             $row['ownerPhone'] = $house->getPhone();
             $row['callable'] = intval($house['proStatus'] == Model_House_CommissionHouse::STATUS_ONGOING);
             $row['isRealityPats'] = $isImages[$house['id']] ? 1 : 0;
             $row['timestate'] = Bll_Common_Format::formatTime($house['created']);
             list($isExtension, $isExtensionInfo) = $this->isExtension($commission, $isOnLine, $house);
             if ($isExtension == 5 || $isExtension == 6) {
                 $row['isExtension'] = 7;
             } else {
                 $row['isExtension'] = $isExtension;
             }
             $row['isExtensionInfo'] = $isExtensionInfo;
             //1-违规已删除 2-已过期 5-待发布 6-待推广 7-已推广 8-房东删除
             if (in_array($isExtension, array(1, 2, 8))) {
                 //不可操作房源
                 $houseUnAction[] = $row;
             } else {
                 $houseAction[] = $row;
             }
         }
         $cacheCursorValue = $houseAction[0]['id'] > $houseUnAction[0]['id'] ? $houseAction[0]['id'] : $houseUnAction[0]['id'];
         $cache->set($cacheCursorKey, $cacheCursorValue, 0, 10);
         $allData = array_merge($houseAction, $houseUnAction);
         $cache->set($cacheCommissionKey, $allData, 0, 10);
     }
     $data = array();
     if ($allData) {
         $countAllCommissions = count($allData);
         $segmentation = array();
         //供分页用
         foreach ($allData as $value) {
             $segmentation[] = $value['id'];
         }
         /**
          * 以下是分页处理代码 略坑,勿踩
          *  add by xiongjianxu
          */
         if (isset($maxId)) {
             $max = array();
             $max = array_keys($segmentation, $maxId);
             if (!empty($max)) {
                 $offset = $countAllCommissions - $max[0];
                 krsort($allData);
                 $data = array_slice($allData, $offset, $per, false);
             }
         } elseif (isset($sinceId)) {
             $since = array();
             $since = array_keys($segmentation, $sinceId);
             if (!empty($since)) {
                 $offset = $since[0] + 1;
                 $data = array_slice($allData, $offset, $per, false);
             }
         } else {
             // maxId和sinceId均不存在时,返回当前最新的记录
             $data = array_slice($allData, 0, $per, false);
         }
         //判断有无下一页
         $countCommissions = count($data);
         if ($countCommissions < $per) {
             $moreFlag = 0;
         } else {
             unset($data[$countCommissions - 1]);
         }
     } else {
         $moreFlag = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data, 'nextPage' => $moreFlag);
 }
コード例 #6
0
ファイル: Choice.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 查询该房源是否为委托房源
  * @param $proId
  * @param $brokerId
  * @return mixed
  * add by xiongjianxu
  */
 public static function isCommissionHouse($proId, $brokerId, $type = Model_House_Commission::TYPE_SALE)
 {
     $res = Model_House_Commission::data_access()->filter('brokerHouseId', $proId)->filter('brokerId', $brokerId)->filter('type', $type)->count();
     return $res;
 }
コード例 #7
0
ファイル: MySale.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $type = "sale";
     $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 : '';
     $baseUrl = "http://my.{$baseDomain}";
     $commissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     $myCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/mysale";
     $myRentCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     $cityId = $this->request->getBrokerCityId();
     if ($cityId == 11) {
         $this->request->set_attribute('propCheck', 0);
     } else {
         $this->request->set_attribute('propCheck', 1);
     }
     $params = $this->request->get_parameters();
     $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;
     // 获取经纪人的委托
     $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('type', 1)->filter('isDelete', Model_House_Commission::DELETE_NO);
     $daTotal = clone $daCommissions;
     $commissions = $daCommissions->limit($per)->offset(($page - 1) * $per)->sort('id', 'desc')->find_all();
     // 获取委托关联的房源
     if (!empty($commissions)) {
         $houseIds = array();
         $brokerHouseIds = array();
         foreach ($commissions as $commission) {
             $houseIds[] = $commission->houseId;
             if (!empty($commission->brokerHouseId)) {
                 $brokerHouseIds[] = $commission->brokerHouseId;
             }
         }
         $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
         $this->request->set_attribute('houses', $houses);
         // 获取小区默认图片 和 区域板块名称
         $communityIds = array();
         $areaCodes = array();
         foreach ($houses as $house) {
             $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);
         // 是否推广数据
         $staticPro = Bll_House_EsfHouse::getHouseOnLineInfo(self::$BrokerInfo['BaseInfo']['CITYID'], $brokerId, $brokerHouseIds);
         if (!empty($brokerHouseIds)) {
             $publishedProInfo = Bll_House_EsfHouse::getHouseInfo($brokerHouseIds, self::$BrokerInfo['BaseInfo']['CITYID']);
         }
         // 分页
         $total = $daTotal->count();
         $pager = Util_MultiPage::multiPage($params, '', $total, $per, 10, $myCommissionsPageUrl);
         $this->request->set_attribute('page', $page);
         $this->request->set_attribute('pager', $pager);
         $this->request->set_attribute('showPager', $total > $per);
     }
     $proSpreadUrl1 = "http://my." . $baseDomain . "/user/ajax/ppclimit";
     $proSpreadUrl2 = "http://my." . $baseDomain . "/user/ajax/sale/staticplan/";
     // 立即推广地址
     $isCombo = Bll_Combo_HouseRelation::ifComboCity(self::$BrokerInfo['BaseInfo']['CITYID']);
     if ($isCombo == true) {
         $tgUrl = $baseUrl . "/ajkbroker/combo/broker/manage/ajk";
     } else {
         $tgUrl = $baseUrl . "/user/broker/sale/homepage";
     }
     $this->request->set_attribute('commissions', $commissions);
     $this->request->set_attribute('commissionsPageUrl', $commissionsPageUrl);
     $this->request->set_attribute('myCommissionsPageUrl', $myCommissionsPageUrl);
     $this->request->set_attribute('type', $type);
     $this->request->set_attribute('staticPro', $staticPro);
     $this->request->set_attribute('publishedProInfo', $publishedProInfo);
     $this->request->set_attribute('myRentCommissionsPageUrl', $myRentCommissionsPageUrl);
     $this->request->set_attribute('proSpreadUrl1', $proSpreadUrl1);
     $this->request->set_attribute('proSpreadUrl2', $proSpreadUrl2);
     $this->request->set_attribute('baseUrl', $baseUrl);
     $this->request->set_attribute('tgUrl', $tgUrl);
     return 'House_Commission_MySale';
 }
コード例 #8
0
 /**
  *该经济人该区域下的可抢房源数
  */
 private function getCanCommissionNum($brokerId, $cityId, $areaCode, $type)
 {
     // 獲取本區域下所有可搶房源
     $commissions = $this->getCommissionsByAreaCode($cityId, $areaCode, $type);
     if (empty($commissions)) {
         return 0;
     }
     $houseIds = array();
     foreach ($commissions as $val) {
         $houseIds[] = $val['id'];
     }
     // 判斷房源经纪人是否已经抢过
     $res = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('houseId', $houseIds);
     if (!empty($type)) {
         $res->filter('type', $type);
     }
     $data = $res->load_field('houseId')->load_field('brokerId')->find();
     $tmpHouseIds = array();
     if (empty($data)) {
         return count($houseIds);
     } else {
         foreach ($data as $val) {
             if (!in_array($val->houseId, $tmpHouseIds)) {
                 $tmpHouseIds[] = $val->houseId;
             }
         }
         $num = count($houseIds) - count($data);
         return $num > 0 ? $num : 0;
     }
 }
コード例 #9
0
ファイル: Arrearage.php プロジェクト: emilymwang8/ajk-broker
 protected function getCommissionDataById($id)
 {
     $id = intval($id);
     if (!$id) {
         return array();
     }
     return Model_House_Commission::data_access()->filter('id', $id)->find_only();
 }
コード例 #10
0
ファイル: All.php プロジェクト: emilymwang8/ajk-broker
 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';
 }
コード例 #11
0
ファイル: Proplist.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @param $brokerId
  * @param null $type
  * @return array
  */
 private function getPublishButNotFixHouse($brokerId, $type = null)
 {
     $result = array();
     if (empty($brokerId)) {
         return array();
     }
     $startTimeStr = strtotime('-60 day');
     $endTimeStr = strtotime("-150 day");
     $startTime = date('Y-m-d H:i:s', $startTimeStr);
     $endTime = date('Y-m-d H:i:s', $endTimeStr);
     $res = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter_by_op('brokerHouseId', '>', 0);
     if (!empty($type)) {
         $res->filter('type', $type);
     }
     $data = $res->filter('isDelete', Model_House_Commission::DELETE_NO)->filter_by_op('createTime', '>', $endTime)->filter_by_op('createTime', '<', $startTime)->load_field('houseId')->load_field('brokerHouseId')->find();
     foreach ($data as $key => $value) {
         $result[$value->houseId] = $value;
     }
     return $result;
 }
コード例 #12
0
ファイル: Rush.php プロジェクト: emilymwang8/ajk-broker
 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;
 }
コード例 #13
0
 /**
  * 抢委托操作流程
  * @param $houseId 房源id
  * @param $brokerId 二手房经纪人Id
  * @param $brokerName 二手房经纪人真实姓名
  * @param $brokerPhone 经纪人手机电话
  * @param $cityId 经纪人城市id
  * @param $comeFrom 来源
  * @param $isConsume 是否扣费
  * @return array
  */
 public function rentRush($houseId, $brokerId, $brokerName, $brokerPhone, $cityId, $comeFrom = Const_Entrust::RUSH_FROM_PC, $isConsume = true)
 {
     $result = array('status' => 0, 'data' => array(), 'errorMsg' => "");
     if (empty($houseId) || empty($brokerId) || empty($cityId)) {
         $result['status'] = 99;
         $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_RENT) {
         $result['status'] = 4;
         $result['errorMsg'] = "房源类型不是租房";
         return $result;
     }
     // 判断委托房源状态
     if ($house->proStatus != Model_House_CommissionHouse::STATUS_ONGOING) {
         $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;
     }
     // 更新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();
     // 更新推送房源状态
     $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();
     }
     //给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;
 }
コード例 #14
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $per = $per + 1;
     //判断是否有下一页
     $moreFlag = 1;
     //读取经纪人信息
     $BrokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
     //城市是否开通房源库
     $cityInfo = Bll_Fyk_Prop_Manage::getInstance()->getCityConfig($BrokerInfo['BaseInfo']['CITYID']);
     if ($cityInfo) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array(), 'nextPage' => 0);
     }
     //是否收费
     $isToll = Bll_Broker_EntrustPrice::getInstance()->checkCityConsumeStatus($BrokerInfo['BaseInfo']['CITYID']);
     if ($isToll) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_PROMPT_UPDATE, 'message' => '你的版本太老了,快更新到新版本吧!');
     }
     // 获取已推送委托
     $daPushedCommissionHouses = Model_House_CommissionHousePushed::data_access()->filter('brokerId', $brokerId)->filter('propertyStatus', Model_House_CommissionHouse::STATUS_ONGOING)->limit($per);
     if (isset($this->_params['maxId'])) {
         $daPushedCommissionHouses->filter_by_op('id', '>', $this->_params['maxId'])->sort('id', 'asc');
     } elseif (isset($this->_params['sinceId'])) {
         $daPushedCommissionHouses->filter_by_op('id', '<', $this->_params['sinceId'])->sort('id', 'desc');
     } else {
         // maxId和sinceId均不存在时,返回当前最新的记录
         $daPushedCommissionHouses->sort('id', 'desc');
     }
     $pushedCommissionHouses = $daPushedCommissionHouses->find_all();
     $countPushedCommissionHouses = count($pushedCommissionHouses);
     if ($countPushedCommissionHouses < $per) {
         $moreFlag = 0;
     } else {
         unset($pushedCommissionHouses[$countPushedCommissionHouses - 1]);
     }
     // 排序(按ID倒序)
     uasort($pushedCommissionHouses, function ($a, $b) {
         return $a['id'] < $b['id'];
     });
     // 获取房源数据
     $houses = array();
     $rushedHouses = array();
     if (!empty($pushedCommissionHouses)) {
         // 获取房源ID
         $houseIds = array();
         foreach ($pushedCommissionHouses as $pushedCommissionHouse) {
             $houseIds[] = $pushedCommissionHouse['propertyId'];
         }
         // 获取房源信息
         $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->find_all();
         // 索引
         $indexedHouses = array();
         foreach ($houses as $house) {
             $indexedHouses[$house['id']] = $house;
         }
         $houses = $indexedHouses;
         // 获取已抢房源数据
         $rushedCommissions = Model_House_Commission::data_access()->filter('houseId', $houseIds)->filter('brokerId', $brokerId)->find_all();
         foreach ($rushedCommissions as $rushedCommission) {
             $rushedHouses[$rushedCommission->houseId] = $rushedCommission->id;
         }
     }
     // 拼装结果
     $data = array();
     foreach ($pushedCommissionHouses as $pushedCommissionHouse) {
         if (!isset($houses[$pushedCommissionHouse['propertyId']])) {
             continue;
         }
         $house = $houses[$pushedCommissionHouse['propertyId']];
         $row = array();
         $row['id'] = $pushedCommissionHouse['id'];
         $row['propertyId'] = $house['id'];
         $row['commName'] = $house['commName'];
         $row['type'] = $house['commissionType'];
         $row['room'] = $house['roomNum'];
         $row['hall'] = $house['hallNum'];
         $row['toilet'] = $house['toiletNum'];
         $row['area'] = $house['areaNum'];
         $row['price'] = $house['proPrice'];
         switch ($house['commissionType']) {
             case Model_House_CommissionHouse::COMMISSION_TYPE_RENT:
                 $row['priceUnit'] = '元/月';
                 break;
             case Model_House_CommissionHouse::COMMISSION_TYPE_SALE:
                 $row['priceUnit'] = '万元';
                 break;
         }
         $row['publishTime'] = date('Y-m-d H:i:s', $house['created']);
         $row['rushable'] = 1;
         $row['rushableInfo'] = '抢委托';
         $row['rushed'] = 0;
         if (!($house['proStatus'] == Model_House_CommissionHouse::STATUS_ONGOING && $house['openBrokerCnt'] < Model_House_CommissionHouse::allowedMaxCommissionCount())) {
             $row['rushable'] = 0;
             $row['rushableInfo'] = '抢完了';
         }
         if (isset($rushedHouses[$house['id']])) {
             $row['rushable'] = 0;
             $row['rushableInfo'] = '抢过了';
             $row['rushed'] = 1;
         }
         $data[] = $row;
     }
     // 重置可抢房源数
     $daCommissionHousePushedCount = Model_House_CommissionHousePushedCount::data_access()->filter('brokerId', $brokerId)->find_only();
     if (!empty($daCommissionHousePushedCount)) {
         $daCommissionHousePushedCount->resetCommissionHousePushedCount();
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data, 'nextPage' => $moreFlag);
 }
コード例 #15
0
ファイル: My.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $type = "rent";
     $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/my";
     $commissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     $myCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/mysale";
     $myRentCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     // *** *** *** *** *** *** ***
     $params = $this->request->get_parameters();
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $per = 5;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     $cityId = $this->request->getBrokerCityId();
     if ($cityId == 11) {
         $this->request->set_attribute('propCheck', 0);
     } else {
         $this->request->set_attribute('propCheck', 1);
     }
     // 获取经纪人的所有委托
     $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('type', 2)->filter('isDelete', Model_House_Commission::DELETE_NO);
     $daTotal = clone $daCommissions;
     $commissions = $daCommissions->limit($per)->offset(($page - 1) * $per)->sort('id', 'desc')->find_all();
     // 获取委托关联的房源
     if (!empty($commissions)) {
         $houseIds = array();
         foreach ($commissions as $commission) {
             $houseIds[] = $commission->houseId;
         }
         $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
         $this->request->set_attribute('houses', $houses);
         // 获取小区默认图片 和 区域板块名称
         $communityIds = array();
         $areaCodes = array();
         foreach ($houses as $house) {
             $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);
         // 分页
         $total = $daTotal->count();
         $pager = Util_MultiPage::multiPage($params, '', $total, $per, 5, $pageUrl);
         $this->request->set_attribute('page', $page);
         $this->request->set_attribute('pager', $pager);
         $this->request->set_attribute('showPager', $total > $per);
     }
     $this->request->set_attribute('commissions', $commissions);
     $this->request->set_attribute('commissionsPageUrl', $commissionsPageUrl);
     $this->request->set_attribute('myCommissionsPageUrl', $myCommissionsPageUrl);
     $this->request->set_attribute('type', $type);
     $this->request->set_attribute('myRentCommissionsPageUrl', $myRentCommissionsPageUrl);
     return 'House_Commission_My';
 }
コード例 #16
0
ファイル: Rush.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propertyId = $this->_params['propertyId'];
     //读取经纪人信息
     $BrokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
     //城市是否开通房源库
     $cityInfo = Bll_Fyk_Prop_Manage::getInstance()->getCityConfig($BrokerInfo['BaseInfo']['CITYID']);
     if ($cityInfo) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => '已开通房源库,不可抢~', 'errcode' => Const_APIStatus::E_COMMISSION_INVALID);
     }
     //是否收费
     $isToll = Bll_Broker_EntrustPrice::getInstance()->checkCityConsumeStatus($BrokerInfo['BaseInfo']['CITYID']);
     if ($isToll) {
         // 不能再抢了请升级
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_PROMPT_UPDATE, 'message' => '你的版本太老了,快更新到新版本吧!');
     }
     // 判断是否是推送房源
     $pushedHouse = Model_House_CommissionHousePushed::data_access()->filter('brokerId', $brokerId)->filter('propertyId', $propertyId)->filter('propertyStatus', array(Model_House_CommissionHouse::STATUS_ONGOING, Model_House_CommissionHousePushed::STATUS_RUSHED))->find_only();
     if (!$pushedHouse) {
         throw new Exception('来晚了,房源已删除', Const_APIStatus::E_COMMISSION_INVALID);
     }
     // 判断委托房源是否存在
     $house = Model_House_CommissionHouse::data_access()->filter('id', $propertyId)->find_only();
     if (!$house || $house->proStatus != Model_House_CommissionHouse::STATUS_ONGOING) {
         throw new Exception('来晚了,房源已删除', Const_APIStatus::E_COMMISSION_INVALID);
     }
     // 判断是否已抢过委托
     $commission = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('houseId', $propertyId)->find_only();
     if ($commission) {
         // 更新推送房源状态
         if ($pushedHouse->propertyStatus != Model_House_CommissionHousePushed::STATUS_RUSHED) {
             $this->pushedHouseRushed($pushedHouse);
         }
         // 如果已抢,仍然返回成功状态
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'message' => '抢过了!去“我的委托”里看看');
     }
     if ($house->openBrokerCnt >= Model_House_CommissionHouse::allowedMaxCommissionCount()) {
         throw new Exception('抢完了~', Const_APIStatus::E_COMMISSION_FULL);
     }
     // 防并发(先插入,再检测(超出,删除),最后更新)
     // TODO 该方案层使用在2013圣诞活动“找锤子,砸金蛋”,并导致数据库多次TMC,但是在该业务场景中瞬时并发并没有那么多,暂定使用 by 胡言言 2014.02.28
     $commission = Model_House_Commission::create(array('type' => $house->commissionType, 'ownerId' => $house->userId, 'houseId' => $house->id, 'brokerId' => $brokerId, 'origin' => Model_House_Commission::ORIGIN_APP, '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('抢完了~', Const_APIStatus::E_COMMISSION_FULL);
     }
     // 更新房源的委托数量
     $house->incrCommissionCount();
     // 更新推送房源状态
     $this->pushedHouseRushed($pushedHouse);
     // 通知到API用户端提示信息(消息推送)
     try {
         $userCheckInPushUrl = 'http://api.anjuke.com/mobile/v5/broker/checkin/notice?is_nocheck=1';
         $curl = new Util_Http_Curl();
         $curl->setDefaults()->post($userCheckInPushUrl, array('broker_id' => $brokerId, 'prop_id' => $propertyId, 'updated' => time(), 'owner_id' => $house['userId'], 'owner_name' => $house['userName']));
     } catch (Exception $e) {
         // 暂时忽略请求
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'message' => '抢成功!快去联系业主吧');
 }