コード例 #1
0
ファイル: Summary.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $cityId = $brokerInfo->cityId;
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_NOT_CHOICE_CITY, 'message' => '非精选城市');
     }
     $bllChoice = new Bll_Zufang_Choice();
     $today = date('Ymd');
     $choiceInfo = $bllChoice->get_choice_info($hzBrokerId, $today, $cityId);
     $todayClicks = intval($choiceInfo[0]['bidClicks']);
     $todayConsume = intval($choiceInfo[0]['bidConsume']) / 100;
     // 获取精选推广房源数(精选计划和房源一一对应)
     $plansIds = array();
     $plans = $bllChoice->get_active_choice_plans($hzBrokerId, array(1, 13, 2, 3, 7, 8));
     foreach ($plans as $plan) {
         $plansIds[] = $plan->id;
     }
     $props = array();
     if ($plansIds) {
         $props = $bllChoice->get_prop($plansIds);
     }
     $totalProps = count($props);
     //将精选状态变化数目归零
     $keyData = array('brokerId' => $brokerId, 'bizType' => Model_Mobile_PropRedDot::TYPE_CHOICE_STATUS);
     $data = array('num' => 0);
     Bll_Mobile_PropRedDot::getInstance()->updateData($keyData, $data);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume), 'todayConsumeUnit' => '元', 'totalProps' => $totalProps));
 }
コード例 #2
0
ファイル: HzPropView.php プロジェクト: emilymwang8/ajk-broker
 /**
  * init env
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $route_matches = $request->get_router_matches();
     $out['proId'] = trim($route_matches[2], "/ \t\n\r\v");
     if (!$out['proId']) {
         throw new Exception('缺少房源Id参数');
     }
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     //$out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
コード例 #3
0
ファイル: Choice.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         echo json_encode(array('error' => -5, 'msg' => '请先登入!'));
         return false;
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $cityId = $request->getBrokerCityId();
     if (!Bll_City::isChoiceCity($cityId)) {
         echo json_encode(array('error' => -1, 'msg' => '您所在城市未开通精选业务!'));
         return false;
     }
     $params = $request->get_parameters();
     if (!isset($params['act']) || empty($params['act'])) {
         echo json_encode(array('error' => -1, 'msg' => '参数错误!'));
         return false;
     }
     $action_method = 'do_' . $params['act'];
     if (!method_exists($this, $action_method)) {
         echo json_encode(array('error' => -1, 'msg' => '方法未实现。'));
         return false;
     }
     $result = call_user_func(array($this, $action_method), $params);
     APF::get_instance()->get_response()->set_content_type("application/json");
     echo json_encode($result);
     return false;
 }
コード例 #4
0
ファイル: JpPropView.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 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'] . ']');
     }
 }
コード例 #5
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     //二手房
     $ajk_ppc_info = Bll_BrokerInfoApp::get_broker_ppc_info($brokerId);
     //租房
     $hz_ppc_info = Bll_BrokerInfoApp::get_broker_ppc_info_hz($brokerId, $cityId);
     //经纪人基础信息
     $brokerBaseInfo = Bll_BrokerInfoApp::get_broker_baseinfo_simple($brokerId);
     try {
         $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->getChatInfo($brokerId, 1);
         $chatId = $chatInfo['data']['chatId'];
         $twoCodeIcon = $chatInfo['data']['twoCodeIcon'];
     } catch (Exception $e) {
         $chatId = '';
         $twoCodeIcon = '';
     }
     //get bid flg for city
     $choiceCityFlag = Bll_City::isChoiceCity($cityId);
     // chat_token
     $info = array('phone' => $brokerBaseInfo['phone'], 'user_id' => $chatInfo['data']['chatId'], 'device' => array('app_name' => APF::get_instance()->get_config('java_api_from'), 'os' => $this->_params["o"], 'macid' => $this->_params["macid"], 'udid2' => $this->_params["udid2"]));
     $privateKey = APF::get_instance()->get_config('aes_private_key', 'mobile_api');
     $iv = APF::get_instance()->get_config('aes_iv', 'mobile_api');
     $token3rd = Util_CryptUtil::aes_encode($privateKey, $iv, $info);
     $ajk_dic_info = array('ajkClick' => $ajk_ppc_info['ajkClick'], 'ajkConsume' => $ajk_ppc_info['ajkConsume'], 'ajkFixHouse' => $ajk_ppc_info['ajkFixHouse'], 'ajkBidHouseNum' => $ajk_ppc_info['ajkBidHouseNum'], 'ajkNotFixHouseNum' => $ajk_ppc_info['ajkNotFixHouseNum'], 'haveAjk' => intval($ajk_ppc_info['ajkNotFixHouseNum']) + intval($ajk_ppc_info['ajkFixHouse'][0]['fixNum']) > 0 ? 1 : 0);
     $hz_dic_info = array('hzClick' => $hz_ppc_info['hzClick'], 'hzConsume' => $hz_ppc_info['hzConsume'], 'hzFixHouse' => $hz_ppc_info['hzFixHouse'], 'hzBidHouseNum' => $hz_ppc_info['hzBidHouseNum'], 'hzNotFixHouseNum' => $hz_ppc_info['hzNotFixHouseNum'], 'haveHz' => intval($hz_ppc_info['hzNotFixHouseNum']) + intval($hz_ppc_info['hzFixHouse'][0]['fixNum']) > 0 ? 1 : 0);
     if ($choiceCityFlag) {
         $ajk_dic_info['ajkBidHouseNum'] = 0;
         $hz_dic_info['hzBidHouseNum'] = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('ajkDataDic' => $ajk_dic_info, 'hzDataDic' => $hz_dic_info, 'brokerName' => $brokerBaseInfo['brokerName'], 'phone' => $brokerBaseInfo['phone'], 'chatId' => $chatId, 'twoCodeIcon' => $twoCodeIcon, 'tokenChat' => $token3rd));
 }
コード例 #6
0
ファイル: ManageJp.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 public static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $brokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerIdEx($out['ajkBrokerId']);
     if (empty($brokerInfo)) {
         throw new Exception('获取金铺经纪人信息失败:ajkBrokerId [' . $out['ajkBrokerId'] . ']');
     }
     $out['brokerInfo'] = $brokerInfo;
     // 获取金铺brokerId
     $out['jpBrokerId'] = $brokerInfo['id'];
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::JINPU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::JINPU);
     $out['bidTip'] = '精选';
     //经纪人全部有效房源
     $out['houses'] = Bll_House_JpHouseInfo::getAllHouseInfoEx($out['ajkBrokerId']);
     $out['houseIds'] = array();
     foreach ($out['houses'] as $infoP) {
         $base = $infoP['base'];
         $info = $infoP['info'];
         $type = $infoP['houseType'];
         $propertyId = in_array($type, array(1, 2)) ? $info['buildingId'] : $info['propertyId'];
         $out['houseIds'][$type][$base['id']] = array('houseId' => $base['id'], 'propertyId' => $propertyId);
     }
     $out['publishUrl'] = Bll_Broker_Combo_ManageJp::buildHousePublishUrl();
 }
コード例 #7
0
ファイル: HzPropList.php プロジェクト: emilymwang8/ajk-broker
 /**
  * init env
  * @param $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();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     $balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
     if (!$balance['status']) {
         throw new Exception_BllErrorException($balance['msg']);
     }
     $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     $out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
コード例 #8
0
ファイル: Result.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     APF::get_instance()->get_response()->set_content_type('text/html', 'utf-8');
     $this->ctx = APF::get_instance()->get_request()->get_parameters();
     $this->ctx['ajkBrokerId'] = APF::get_instance()->get_request()->getBrokerId();
     $this->ctx['cityId'] = APF::get_instance()->get_request()->getBrokerCityId();
     // 入参校验
     if (!$this->ctx['code'] || !$this->ctx['site'] || !$this->ctx['act']) {
         $this->ctx['code'] = Const_PublishCode::HOUSE_PARAM_COMPLETE;
     }
     $msgs = APF::get_instance()->get_config('message', 'publishmessage');
     if (!$this->ctx['message']) {
         $this->ctx['message'] = $msgs[$this->ctx['code']];
     }
     // 头标题
     $this->ctx['titleMsg'] = in_array($this->ctx['code'], array(Const_PublishCode::HOUSE_SPREAD_SUCCESS, Const_PublishCode::SPREAD_PROP_HANDLE_STOP, Const_PublishCode::SPREAD_PROP_BALANCE_ERROR, Const_PublishCode::SPREAD_PROP_OUT_LIMIT, Const_PublishCode::SPREAD_PROP_AUDITED_ERROR, Const_PublishCode::SPREAD_PROP_PLAN_IN, Const_PublishCode::SPREAD_PROP_BUDGET_OVER, Const_PublishCode::SPREAD_PROP_NO_COMBO, Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE, Const_PublishCode::SPREAD_PROP_COMBO_LIMIT, Const_PublishCode::SPREAD_PROP_COMBO_FAIL, Const_PublishCode::PSEUDO_ERROR)) ? '推广' : '保存';
     $this->ctx['isSuccess'] = $this->ctx['code'] < 200;
     $this->ctx['titleMsg'] .= $this->ctx['isSuccess'] ? '成功' : '失败';
     $this->prepareMessage();
     $this->ctx['isChoiceCity'] = Bll_City::isChoiceCity(static::$intBrokerCityID);
     $this->ctx['isShowCaseCity'] = Bll_City::isShowCaseCity(static::$intBrokerCityID);
     if ($this->ctx['site'] == 'jp') {
         $this->ctx['isShowCaseCity'] = false;
     }
     $this->prepareOthers();
     //$this->ctx['debug'] && (print_r($this->ctx) && die);
     $this->setAttributes($this->ctx);
     return 'House_Result';
 }
コード例 #9
0
ファイル: HzBroker.php プロジェクト: emilymwang8/ajk-broker
 /**
  * init env
  * @param $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();
     // 获取好租brokerId
     //$out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['bidMessage'] = $out['isChoiceCity'] ? '精选' : '竞价';
 }
コード例 #10
0
 public function handle_request_internal()
 {
     $cityId = $this->_params['cityId'];
     $choiceCityFlag = Bll_City::isChoiceCity($cityId);
     if ($choiceCityFlag === false) {
         $return = array('business' => array(array('businessId' => V1_Common_GetMainBusinessController::RETURN_CODE_NUM_1, 'businessName' => V1_Common_GetMainBusinessController::RETURN_CODE_MSG_1)));
     } else {
         $return = array('business' => array(array('businessId' => V1_Common_GetMainBusinessController::RETURN_CODE_NUM_1, 'businessName' => V1_Common_GetMainBusinessController::RETURN_CODE_MSG_1), array('businessId' => V1_Common_GetMainBusinessController::RETURN_CODE_NUM_2, 'businessName' => V1_Common_GetMainBusinessController::RETURN_CODE_MSG_2)));
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return);
 }
コード例 #11
0
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId = $this->_params['brokerId'];
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $city_id = $this->_params['cityId'];
     //get bid flg for city
     $choiceCityFlag = Bll_City::isChoiceCity($city_id, Const_Site::HAOZU);
     if ($choiceCityFlag) {
         return array('status' => 'ok', 'data' => array('propertyList' => array(), 'codeNum' => Const_HzErrorInfo::NOBIDCITY));
     }
     $result = Bll_HzBidPlan::get_broker_bidprop($brokerId_hz, $city_id);
     if (!empty($result)) {
         $props = array();
         foreach ($result as $key => $prop) {
             $prop_basic['id'] = $prop['proid'];
             $prop_basic['title'] = $prop['prop']['content_basic']['title'];
             $prop_basic['commId'] = $prop['prop']['content_basic']['commid'];
             $prop_basic['commName'] = $prop['prop']['content_basic']['commname'];
             $prop_basic['roomNum'] = $prop['prop']['content_basic']['roomnum'];
             $prop_basic['hallNum'] = $prop['prop']['content_basic']['hallnum'];
             $prop_basic['toiletNum'] = $prop['prop']['content_basic']['toilnetnum'];
             $prop_basic['area'] = round($prop['prop']['content_basic']['areanum']);
             $prop_basic['price'] = round($prop['prop']['content_basic']['pricenum']);
             $prop_basic['priceUnit'] = "元";
             $prop_basic['bidStatus'] = $prop['plan']['status'];
             $prop_basic['index'] = $prop['rank'];
             $prop_basic['clickNum'] = $prop['clicks'];
             $prop_basic['offer'] = $prop['offer'];
             $prop_basic['budget'] = $prop['reconsume'];
             $prop_basic['yusuan'] = $prop['consume'];
             if ($prop['plan']['status'] != 1) {
                 $prop_basic['yusuan'] = 20;
                 $prop_basic['bidStatus'] = 3;
                 //@todo 此处是个坑,后续要改
             }
             //增加委托房源标签
             $isEntrust = Bll_Zufang_Choice::isCommissionHouse($prop['proid'], $brokerId, Model_House_Commission::TYPE_RENT);
             if ($isEntrust) {
                 $prop_basic['isEntrust'] = 1;
             } else {
                 $prop_basic['isEntrust'] = 0;
             }
             $prop_basic['planId'] = $key;
             $props['propertyList'][] = $prop_basic;
         }
     } else {
         $props['propertyList'] = array();
     }
     $ret = array('status' => 'ok', 'data' => $props);
     return $ret;
 }
コード例 #12
0
 public function handle_request_internal()
 {
     $app = $this->_params['app'];
     $cv = $this->_params['cv'];
     $cityId = $this->_params['cityId'];
     $brokerId = isset($this->_params['brokerId']) ? $this->_params['brokerId'] : 0;
     if ($app == 'i-broker2' && $cv == 4.3) {
         if (Bll_City::isBidCity($cityId)) {
             $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_BID, 'businessTypeName' => self::RETURN_CODE_MSG_BID);
         } else {
             if (Bll_City::isChoiceCity($cityId)) {
                 $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_CHOICE, 'businessTypeName' => self::RETURN_CODE_MSG_CHOICE);
             } else {
                 $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_NOTCHOICE_NOTBID, 'businessTypeName' => self::RETURN_CODE_MSG_NOTCHOICE_NOTBID);
             }
         }
     } else {
         if (Bll_City::isBidCity($cityId)) {
             $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_BID, 'businessTypeName' => self::RETURN_CODE_MSG_BID);
         } else {
             $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_CHOICE, 'businessTypeName' => self::RETURN_CODE_MSG_CHOICE);
         }
     }
     //查询房源库权限
     //$brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     //$fykStatus = V1_Fyk_User_PrivilegesController::getFykStatus($brokerInfo->userId,$cityId);
     $fykStatus = array('isOpen' => 0, 'status' => -1, 'message' => '房源库功能已关闭');
     $return['fykStatus'] = $fykStatus;
     //获取是否试套餐城市
     $timeBool = Model_Combo_BusinessUseConfig::getCityComboConfig($cityId);
     if (Bll_City::isComboCity($cityId) && !empty($timeBool) && time() > $timeBool['startTime']) {
         $return['comboBusinessType']['businessTypeId'] = self::RETURN_COMBO_CITY_NUM_YES;
         $return['comboBusinessType']['businessTypeName'] = self::RETURN_COMBO_CITY_MSG_YES;
         if ($brokerId) {
             $result = Bll_Broker_HzBroker::isComboBroker($brokerId);
             if ($result === false) {
                 $return['updateComboBusiness']['isUpdateToComboBusiness'] = 1;
                 $return['updateComboBusiness']['updateMessage'] = '移动经纪人由定价模式升级为套餐模式,立即切换使用吧!';
             } else {
                 $return['updateComboBusiness']['isUpdateToComboBusiness'] = 0;
                 $return['updateComboBusiness']['updateMessage'] = '';
             }
         }
     } else {
         $return['comboBusinessType'] = array('businessTypeId' => self::RETURN_COMBO_CITY_NUM_NO, 'businessTypeName' => self::RETURN_COMBO_CITY_MSG_NO);
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return);
 }
コード例 #13
0
ファイル: ManageHz.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 public static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
       if (!$balance['status'])
           throw new Exception_BllErrorException($balance['msg']);
       $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
       */
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     $out['bidTip'] = '精选';
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取该经纪人房源
     $out['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']);
     // 获取改经纪人所有房源质量
     //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props']));
     $out['propsQuality'] = static::getHzPropsQuality($out['props']);
     if (count($out['props']) > 0) {
         foreach ($out['props'] as $proId => $prop) {
             $out['props'][$proId]['proId'] = $proId;
             // 获取剩余时间
             $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']);
             // 是否手机房源
             $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : '');
         }
     }
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
コード例 #14
0
 public function handle_request_internal()
 {
     $this->brokerId = $this->_params['brokerId'];
     $this->propId = $this->_params['propId'];
     // 获取经纪人映射
     $mapping = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($this->brokerId);
     if (!$mapping) {
         throw new Exception_BrokerNotFoundException();
     }
     $hzBrokerId = $mapping['hzBrokerid'];
     $this->broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($this->brokerId);
     $cityId = $this->broker['cityId'];
     // 非精选城市
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         throw new Exception('非精选城市', Const_APIStatus::E_NOT_CHOICE_CITY);
     }
     // 获取房源信息
     $this->prop = Model_House_HzProp::findByPropId($this->propId);
     if (!$this->prop) {
         throw new Exception_PropertyNotFoundException('房源不存在', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     // 检查房源是否属于当前经纪人
     if (!$this->prop->belongToBroker($hzBrokerId)) {
         throw new Exception('房源不属于经纪人', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     $price = $this->prop->getContentBasic('pricenum');
     $blockId = $this->prop->getContentBasic('blockid');
     // 获取精选推广位
     $this->bucket = Bll_Choice_HzBidBucket::get_bucket_info($blockId, $cityId, $price);
     $this->bucketId = $this->bucket['id'];
     // 检查房源是否可以添加精选推广位订阅
     if (($result = $this->hasAddChoiceRemindPermission()) !== true) {
         throw new Exception($result['msg'], intval($result['code']));
     }
     // 创建订阅
     $subscription = Model_Choice_Subscription::data_access()->filter('site', Model_Choice_Subscription::SITE_RENT)->filter('brokerId', $this->brokerId)->filter('propId', $this->propId)->filter('bucketId', $this->bucketId)->find_only();
     if (!$subscription) {
         Model_Choice_Subscription::create(array(Model_Choice_Subscription::SITE => Model_Choice_Subscription::SITE_RENT, Model_Choice_Subscription::BROKER_ID => $this->brokerId, Model_Choice_Subscription::PROP_ID => $this->propId, Model_Choice_Subscription::BUCKET_ID => $this->bucketId, Model_Choice_Subscription::STATUS => Model_Choice_Subscription::SUBSCRIPTION_START, Model_Choice_Subscription::CREATE_TIME => date('Y-m-d H:i:s'), Model_Choice_Subscription::UPDATE_TIME => date('Y-m-d H:i:s')))->save();
     } else {
         $subscription->status = Model_Choice_Subscription::SUBSCRIPTION_START;
         $subscription->save();
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('remindStatus' => 1, 'remindStatusMsg' => '取消推广位提醒'));
 }
コード例 #15
0
ファイル: IndexBase.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) {
         $this->redirect('/user/combo/brokerhome');
         exit;
     }
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $this->type = $this->getType();
     $this->brokerId = $this->getBrokerId();
     $this->userId = self::$BrokerInfo['BaseInfo']['USERID'];
     $this->cityId = self::$BrokerInfo['BaseInfo']['CITYID'];
     //存在橱窗订单信息,直接跳转至管理页面
     $brokerAdInfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders(array('brokerId' => $this->brokerId), $this->type);
     if (!empty($brokerAdInfo)) {
         $this->toManage();
     }
     //橱窗价格
     $tmp = array('cityId' => $this->cityId, 'status' => 1, 'startDate' => date('Ymd'));
     $cityPriceInfo = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, $this->type);
     $cityPrice = empty($cityPriceInfo->discountPrice) ? 8 : round($cityPriceInfo->discountPrice / 100, 2);
     $this->request->set_attribute('cityPrice', $cityPrice);
     $this->params = $this->request->get_parameters();
     //表单提交
     if ($this->request->is_post_method() && intval($this->params['days'])) {
         $this->formAction($cityPrice);
     }
     if ($this->type == Const_ShowcaseOrders::SALE_DB) {
         $type = 'ajk';
     } else {
         $type = 'hz';
     }
     $this->request->set_attribute('type', $type);
     $this->request->set_attribute('index', 2);
     //精选推广开关
     $isChoice = !Bll_City::isChoiceCity($this->cityId) ? 0 : 1;
     $this->request->set_attribute('isChoice', $isChoice);
     $this->request->set_attribute('broker', self::$BrokerInfo);
     return $this->handle_request_index();
 }
コード例 #16
0
 public function handle_request_internal()
 {
     $app = $this->_params['app'];
     $cv = $this->_params['cv'];
     $cityId = $this->_params['cityId'];
     // 基础业务类型 • 老端口
     $isDuankou = Bll_City::isDuankouCity($cityId);
     // 基础业务类型 • 定价
     $isFix = Bll_City::isFixCity($cityId);
     // 基础业务类型 • 新套餐
     $isCombo = Bll_City::isComboCity($cityId);
     // 增值业务类型 • 竞价
     $isBid = Bll_City::isBidCity($cityId);
     // 增值业务类型 • 精选
     $isChoice = Bll_City::isChoiceCity($cityId);
     if ($app == 'i-broker2' && $cv == 4.3) {
         if (!$isBid) {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('isDuankou' => intval($isDuankou), 'isFix' => intval($isFix), 'isCombo' => intval($isCombo), 'isChoice' => intval($isChoice)));
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('isDuankou' => intval($isDuankou), 'isFix' => intval($isFix), 'isCombo' => intval($isCombo), 'isBid' => intval($isBid), 'isChoice' => intval($isChoice)));
 }
コード例 #17
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //上海不让竞价
     $city_info = Dao_Broker_BrokerInfo::get_broker_base_info(intval($this->_params['brokerId']));
     //get bid flg for city
     $choiceCityFlag = Bll_City::isChoiceCity($city_info['CITYID']);
     if ($choiceCityFlag) {
         return array('status' => 'ok', 'data' => array('propertyList' => array(), 'codeNum' => Const_HzErrorInfo::NOBIDCITY));
     }
     $url = '/service-ppc/rest/hp/brokerHPlans?brokerId=' . $brokerId . '&resType=1&tradeType=1';
     $data = Util_CallAPI::get_data_from_java_api($url);
     if ($data['data']['status'] === 'ok') {
         $props = array();
         if (is_array($data['data']['planProp'])) {
             $proids = $props_info = array();
             foreach ($data['data']['planProp'] as $prop) {
                 $proids[$prop['propId']] = $prop['propId'];
                 $props_info[$prop['propId']] = $prop;
             }
             $proid_str = implode(',', $proids);
             $props['propertyList'] = $this->get_prop_info_new($proid_str, $brokerId, $props_info);
             $a = function ($a, $b) {
                 if ($a['id'] == $b['id']) {
                     return 0;
                 }
                 return $a['id'] < $b['id'] ? -1 : 1;
             };
             usort($props['propertyList'], $a);
         } else {
             $props['propertyList'] = array();
         }
         $ret = array('status' => 'ok', 'data' => $props);
     } else {
         $ret = Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']);
     }
     return $ret;
 }
コード例 #18
0
ファイル: ComboPlot.php プロジェクト: emilymwang8/ajk-broker
 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;
 }
コード例 #19
0
ファイル: AjkBroker.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @param User_Statistics_BrokerStatisticsController $controller
  * @param AJKRequest $request
  * @param AJKResponse $response
  *
  * @return array
  */
 public static function getBrokerStatistics($controller, $request, $response)
 {
     $brokerId = $request->getBrokerId();
     $cityId = $request->getBrokerCityId();
     $params = $request->get_parameters();
     $pageParams = static::setSearchDay($params);
     $isChoiceCity = Bll_City::isChoiceCity($cityId);
     $isBidCity = Bll_City::isChoiceCity($cityId);
     $isShowCaseCity = Bll_City::isShowCaseCity($cityId);
     $pageParams['isChoiceCity'] = $isChoiceCity;
     $pageParams['isBidCity'] = $isBidCity;
     $pageParams['isShowCaseCity'] = $isShowCaseCity;
     $startDate = date('Ymd', $pageParams['beginDateUnix']);
     $endDate = date('Ymd', $pageParams['endDateUnix']);
     if ($startDate > $endDate) {
         return $pageParams;
     }
     /** 非精选城市 */
     if ($isBidCity) {
         $pageParams['bidMessage'] = '竞价';
     }
     if ($isChoiceCity) {
         $pageParams['bidMessage'] = '精选';
     }
     $tempBrokerStatisticsInfoList = Model_Broker_AjkComboBrokerDay::getBrokerStatistics($brokerId, $startDate, $endDate);
     if (empty($tempBrokerStatisticsInfoList)) {
         return $pageParams;
     }
     $total = array('TotalPropNum' => 0, 'TotalClickNum' => 0, 'TotalAmount' => 0, 'saleProp' => 0, 'saleGoodProp' => 0, 'saleNewProp' => 0, 'saleNewGoodProp' => 0, 'saleVppv' => 0, 'saleBidProp' => 0, 'saleBidGoodProp' => 0, 'saleBidNewProp' => 0, 'saleBidNewGoodProp' => 0, 'saleBidCost' => 0, 'saleBidVppv' => 0);
     $dateList = static::getDateList($pageParams['beginDateUnix'], $pageParams['endDateUnix']);
     if ($isShowCaseCity) {
         $adPriceInfo = static::getBrokerPriceInfo($brokerId, $startDate, $endDate);
         $adClickInfo = static::getBrokerAdClickInfo($brokerId, $startDate, $endDate);
     }
     $brokerStatisticsInfoList = array();
     foreach ($dateList as $key => $date) {
         $brokerStatisticsInfoList[$key] = array('_DayDate' => $date);
     }
     foreach ($tempBrokerStatisticsInfoList as $brokerStatisticsInfo) {
         $date = $brokerStatisticsInfo['dayDate'];
         $brokerStatisticsInfo['_DayDate'] = $dateList[$date];
         $brokerStatisticsInfo['TotalPropNum'] = $brokerStatisticsInfo['saleProp'];
         $brokerStatisticsInfo['TotalClickNum'] = $brokerStatisticsInfo['saleVppv'];
         $brokerStatisticsInfo['TotalAmount'] = $brokerStatisticsInfo['saleBidCost'];
         if ($isBidCity || $isChoiceCity) {
             $brokerStatisticsInfo['TotalPropNum'] += $brokerStatisticsInfo['saleBidProp'];
             $brokerStatisticsInfo['TotalClickNum'] += $brokerStatisticsInfo['saleBidVppv'];
         }
         /**
          * 总计
          */
         $total['TotalPropNum'] += $brokerStatisticsInfo['TotalPropNum'];
         $total['TotalClickNum'] += $brokerStatisticsInfo['TotalClickNum'];
         $total['TotalAmount'] += $brokerStatisticsInfo['TotalAmount'];
         $total['saleProp'] += $brokerStatisticsInfo['saleProp'];
         $total['saleGoodProp'] += $brokerStatisticsInfo['saleGoodProp'];
         $total['saleNewProp'] += $brokerStatisticsInfo['saleNewProp'];
         $total['saleNewGoodProp'] += $brokerStatisticsInfo['saleNewGoodProp'];
         $total['saleVppv'] += $brokerStatisticsInfo['saleVppv'];
         if ($isBidCity || $isChoiceCity) {
             $total['saleBidProp'] += $brokerStatisticsInfo['saleBidProp'];
             $total['saleBidVppv'] += $brokerStatisticsInfo['saleBidVppv'];
             $total['saleBidCost'] += $brokerStatisticsInfo['saleBidCost'];
             $total['saleBidNewProp'] += $brokerStatisticsInfo['saleBidNewProp'];
             $total['saleBidGoodProp'] += $brokerStatisticsInfo['saleBidGoodProp'];
             $total['saleBidNewGoodProp'] += $brokerStatisticsInfo['saleBidNewGoodProp'];
         }
         /**
          * 橱窗
          */
         if ($isShowCaseCity) {
             $brokerStatisticsInfo['props_sum'] = $adPriceInfo[$date]['propsSum'];
             $brokerStatisticsInfo['quantity_count'] = $adClickInfo[$date]['quantity_count'];
             $brokerStatisticsInfo['price'] = $adPriceInfo[$date]['price'];
             $total['props_sum'] += $adPriceInfo[$date]['propsSum'];
             $total['quantity_count'] += $adClickInfo[$date]['quantity_count'];
             $total['price'] += $adPriceInfo[$date]['price'];
         }
         $brokerStatisticsInfoList[$date] = $brokerStatisticsInfo;
     }
     $BrokerWorkLogInfo = array('data' => array_reverse($brokerStatisticsInfoList), 'total' => $total);
     $pageParams['BrokerWorkLogInfo'] = $BrokerWorkLogInfo;
     return $pageParams;
 }
コード例 #20
0
ファイル: Ppc.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     //check param
     $checkParamMessage = $this->checkParames($this->_params);
     if ($checkParamMessage !== true) {
         return $checkParamMessage;
     }
     //params
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     //get anjuke data
     $data = $this->getAnjukeData($brokerId, $cityId);
     //get bid flg for city
     $choiceCityFlag = Bll_City::isChoiceCity($cityId);
     if ($data['data']['status'] === 'ok') {
         $output = array();
         //竞价计划信息
         $bidPlanNum = 0;
         if (!empty($data['data']['bidPlan'])) {
             $bidPlanNum = $data['data']['bidPlan'][0]['bidPlanNum'];
             if ($choiceCityFlag) {
                 $bidPlanNum = 0;
             }
         }
         //定价计划信息
         if (empty($data['data']['pricPlan'])) {
             $fixPlan = array();
         } else {
             $fixPlan = array();
             foreach ($data['data']['pricPlan'] as $info) {
                 $status = 1;
                 switch (trim($info['pricPlanStateDesc'])) {
                     case '计划推广中':
                         $status = 1;
                         break;
                     case '手动暂停':
                         $status = 2;
                         break;
                     case '待推广':
                         $status = 2;
                         break;
                     case '余额不足已结束':
                         $status = 2;
                         break;
                         //                        case '余额不足暂停':
                         //                            $status = 3;
                         //                            break;
                     //                        case '余额不足暂停':
                     //                            $status = 3;
                     //                            break;
                     default:
                         break;
                 }
                 $tmp = array('fixPlanId' => $info['pricPlanId'], 'fixPlanName' => $info['pricPlanName'], 'fixPlanPropNum' => $info['pricPlanPropNum'], 'fixPlanState' => $status, 'fixPlanStateDesc' => $info['pricPlanStateDesc']);
                 $fixPlan[] = $tmp;
             }
             $a = function ($a, $b) {
                 if ($a['fixPlanId'] == $b['fixPlanId']) {
                     return 0;
                 }
                 return $a['fixPlanId'] < $b['fixPlanId'] ? -1 : 1;
             };
             usort($fixPlan, $a);
         }
         $output['fixPlan'] = $fixPlan;
         //未推广房源列表
         $props = Bll_BrokerInfoApp::get_outline_prop($brokerId, $cityId);
         $output['unRecommendPropNum'] = count($props);
         $output['bidPlan'] = array('bidPlanPropNum' => $bidPlanNum);
         $ret = array('status' => 'ok', 'data' => $output);
     } else {
         $ret = Util_MobileAPI::error(Const_APIStatus::RETURN_CODE_ERROR);
     }
     return $ret;
 }
コード例 #21
0
 /**
  * @param Manage_ProplistController $controller
  * @param AJKRequest $request
  * @param AJKResponse $response
  *
  * @return array
  */
 public static function getBrokerSpreadInfo($controller, $request, $response)
 {
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $query = trim($request->get_parameter('q'));
     $pageParams = array('query' => $query);
     if (!empty($query)) {
         $pageParams['searchByCommunity'] = !is_numeric($query);
     }
     $bidPropIds = array();
     $fixPropIds = array();
     /**
      * 速度优化阶段一
      * $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId);
      */
     $brokerCheckState = $controller->getBrokerCheckState();
     $isChoiceCity = Bll_City::isChoiceCity($cityId);
     /** 精选城市 */
     if ($isChoiceCity) {
         $pageParams['bidTip'] = '精选';
     }
     $pageParams['isChoiceCity'] = $isChoiceCity;
     $pageParams['isBidCity'] = false;
     $pageParams['isShowCaseCity'] = Bll_City::isShowCaseCity($cityId, Const_Site::ANJUKE);
     if ($isChoiceCity) {
         /** 获取竞价计划信息 */
         $pageParams['bidPlanList'] = static::getBrokerBidPlanList($brokerId, $cityId, $bidPropIds, $isChoiceCity);
         $pageParams['bidPropIds'] = $bidPropIds;
         $pageParams['bidClickCount'] = Bll_Plan_Bid_AjkPlan::getBrokerBidClick($brokerId, date('Ymd'), $cityId);
         $pageParams['bidCost'] = Bll_Plan_Bid_AjkPlan::getBrokerBidCost($brokerId, date('Ymd'), $cityId);
     }
     /** 获取定价计划信息 */
     $pageParams['fixPlanPropList'] = static::getBrokerFixPlanList($brokerId, $cityId, $fixPropIds, $brokerCheckState);
     $pageParams['fixPropIds'] = $fixPropIds;
     if (!empty($pageParams['fixPlanPropList'])) {
         $pageParams['effectURL'] = Bll_Plan_Fix_AjkPlan::GetPlanFixedPriceDetailUri($pageParams['fixPlanPropList'][0]['planInfo']['id'], 0, 1);
     }
     $houseInfoList = static::getBrokerAllPropInfoList($brokerId, $cityId, $fixPropIds, $bidPropIds, $pageParams['isChoiceCity'], $query);
     /** 房源数量 > 0 没有计划就创建计划 创建失败的话应该是API 错误 */
     if (!empty($houseInfoList) && empty($pageParams['fixPlanPropList'])) {
         Bll_Ppc_ServiceAPI::createFixPlan($brokerId, '定价', 100000, 1, 21181);
     }
     $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId);
     if (empty($ppcLimitInfo)) {
         echo '<script type="text/javascript"> alert("服务器繁忙,请重试!"); </script>';
         exit;
     }
     $pageParams['ppcLimitInfo'] = $ppcLimitInfo;
     /** 房源质量信息 */
     $pageParams['houseSolly'] = static::getHouseSollyResult($houseInfoList['houseIdList']);
     $pageParams['selectLimitTempAvailable'] = static::checkSelectLimitTempAvailable($cityId);
     $pageParams['fixPropIds'] = array_values(array_intersect($fixPropIds, array_keys($houseInfoList['fixSpreadHouseList'])));
     //$pageParams['bidPropIds'] = array_values(array_intersect($bidPropIds, $pageParams['fixPropIds']));
     if ($isChoiceCity) {
         $houseBidInfoList = array();
         $houseBidStatus = array();
         foreach ($pageParams['bidPlanList'] as $bidInfo) {
             $houseBidInfoList[$bidInfo['propId']] = $bidInfo;
             $houseBidStatus[$bidInfo['propId']] = $bidInfo['status'];
         }
         $pageParams['houseBidStatus'] = $houseBidStatus;
         $houseInfoList['fixSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['fixSpreadHouseList'], $houseBidInfoList, $cityId);
     }
     /** 精选引导优化 */
     $choiceFunctionOptimizationGuide = false;
     /*
     if ($isChoiceCity && count($houseInfoList['fixSpreadHouseList']) > 0) {
         if (Bll_Broker_AjkBrokerGuideNew::getGuideStatus($brokerId, 'Choice_Function_Optimization') == 0) {
             $choiceFunctionOptimizationGuide = true;
         }
     }
     */
     $pageParams['choiceFunctionOptimizationGuide'] = $choiceFunctionOptimizationGuide;
     return array_merge($pageParams, $houseInfoList);
 }
コード例 #22
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $houseId = $this->_params['propId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $cityId = $brokerInfo->cityId;
     $isDisplaySummary = 0;
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         $data = array('totalClicks' => 0, 'balance' => 0, 'balanceUnit' => '元', 'todayClicks' => 0, 'todayConsume' => 0, 'todayConsumeUnit' => '元', 'clickPrice' => 0, 'clickPriceUnit' => '元', 'maxBucketNum' => 0, 'usedBucketNum' => 0, 'bucketId' => '', 'status' => bll_choice_EsfAPPAPIChoice::PROP_ACTIONTYPE_CHOICE_NOTFIT, 'statusMsg' => '你所在城市未开通精选业务', 'remindStatus' => -1, 'remindStatusMsg' => '不符合精选订阅条件', 'minChoicePrice' => 0, 'minChoicePriceUnit' => '元', 'maxChoicePrice' => 0, 'maxChoicePriceUnit' => '元', 'isDisplaySummary' => $isDisplaySummary);
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
     }
     $isDisplaySummary = 1;
     //获取该房子的精选计划
     $bllChoice = new Bll_Zufang_Choice();
     $planInfo = $bllChoice->get_plan_by_proid($houseId);
     $amount = 0;
     $totalConsume = 0;
     if ($planInfo) {
         $planId = $planInfo->plan_id;
         $planBasicInfo = $bllChoice->get_plan($planId);
         $amount = $planBasicInfo[0]->amount;
         $totalConsume = $planBasicInfo[0]->total_consume;
     }
     //获取 blockId, priceId
     $propInfo = $bllChoice->get_prop_content($houseId);
     if (empty($propInfo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '房源不存在');
     }
     $content = json_decode($propInfo[0]->contentBasic, true);
     $price = intval($content['pricenum']);
     $blockId = $content['blockid'];
     $priceInfo = Bll_Choice_HzBidBucket::getPriceIntervalInfo($cityId, $price);
     $priceId = $priceInfo['id'];
     //获取坑位信息
     $bucketInfo = Bll_Choice_HzBidBucket::getBucketInfo($blockId, $priceId);
     // 获取点击单价
     try {
         $clickPriceInfo = Bll_Service_Choice::hzClickPrice(array('cityId' => $cityId, 'price' => (int) $price, 'blockId' => $blockId, 'brokerId' => $brokerId));
         if ($clickPriceInfo['status'] == 'error') {
             return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '系统繁忙(code:-33)');
         }
     } catch (Exception $e) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '系统繁忙(code:-33)');
     }
     $clickPrice = $clickPriceInfo['realTradeAmount'] / 100;
     $remindStatus = -1;
     // -1 不符合精选订阅条件
     $remindStatusMsg = '不符合精选订阅条件';
     if ($planInfo && $planInfo->is_valid == 1) {
         $date = date('Ymd');
         $propChoice = $bllChoice->get_prop_choice_info($houseId, $date, $cityId);
         $todayClicks = intval($propChoice[0]['bidClicks']);
         $todayConsume = intval($propChoice[0]['bidConsume']) / 100;
         $totalClicksInfo = $bllChoice->get_prop_choice_clicks($houseId, $cityId);
         $totalClicks = intval($totalClicksInfo[0]['bidClicks']);
         $balance = $amount - $totalConsume;
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'todayConsume' => round($todayConsume, 2), 'todayConsumeUnit' => '元', 'totalClicks' => $totalClicks, 'balance' => round($balance, 2), 'balanceUnit' => '元', 'clickPrice' => round($clickPrice, 2), 'clickPriceUnit' => '元', 'maxBucketNum' => 20, 'usedBucketNum' => $bucketInfo['usedNum'], 'minChoicePrice' => 20, 'minChoicePriceUnit' => '元', 'maxChoicePrice' => 50, 'maxChoicePriceUnit' => '元', 'status' => '1-1', 'statusMsg' => '推广中', 'remindStatus' => $remindStatus, 'remindStatusMsg' => $remindStatusMsg, 'isDisplaySummary' => $isDisplaySummary));
     } else {
         if ($planInfo && $planInfo->is_valid == 13) {
             $totalClicksInfo = $bllChoice->get_prop_choice_clicks($houseId, $cityId);
             $totalClicks = intval($totalClicksInfo[0]['bidClicks']);
             $rank = Bll_Plan_Bid_HzBid::getChoiceWaitPosition($planInfo->plan_id, $cityId, $blockId, $priceId);
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('clickPrice' => round($clickPrice, 2), 'clickPriceUnit' => '元', 'totalClicks' => $totalClicks, 'balance' => round($amount, 2), 'balanceUnit' => '元', 'maxBucketNum' => 20, 'usedBucketNum' => $bucketInfo['usedNum'], 'minChoicePrice' => 20, 'minChoicePriceUnit' => '元', 'maxChoicePrice' => 50, 'maxChoicePriceUnit' => '元', 'status' => '1-2', 'statusMsg' => "{$rank}", 'remindStatus' => $remindStatus, 'remindStatusMsg' => $remindStatusMsg, 'isDisplaySummary' => $isDisplaySummary));
         } else {
             //判断是否符合精选条件 多图 + 新发15天
             if (false == $content['quality'] || date('Ymd', strtotime('-16 days')) > date('Ymd', $content['created'])) {
                 return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('clickPrice' => round($clickPrice, 2), 'clickPriceUnit' => '元', 'maxBucketNum' => 20, 'usedBucketNum' => $bucketInfo['usedNum'], 'minChoicePrice' => 20, 'minChoicePriceUnit' => '元', 'maxChoicePrice' => 50, 'maxChoicePriceUnit' => '元', 'status' => '3-2', 'statusMsg' => '精选推广条件:多图+新发15天', 'remindStatus' => $remindStatus, 'remindStatusMsg' => $remindStatusMsg, 'isDisplaySummary' => $isDisplaySummary));
             }
         }
     }
     if ($bucketInfo['usedNum'] >= $bucketInfo['totalNum']) {
         $status = '2-1';
         $statusMsg = '推广位已满';
     } else {
         if ($bucketInfo['usedNum'] >= $bucketInfo['maxOnlineNum']) {
             $status = '2-2';
             $statusMsg = '可立即排队';
         } else {
             $status = '2-3';
             $statusMsg = '可立即推广';
         }
     }
     // 如果推广位已满,判断推广位是否已订阅
     if ($status == '2-1') {
         $subscription = Model_Choice_Subscription::data_access()->filter('site', Model_Choice_Subscription::SITE_RENT)->filter('brokerId', $brokerId)->filter('propId', $houseId)->filter('bucketId', $bucketInfo['id'])->filter('status', Model_Choice_Subscription::SUBSCRIPTION_START)->find_only();
         if ($subscription) {
             $remindStatus = 1;
             // 1 已订阅
             $remindStatusMsg = '取消推广位提醒';
         } else {
             $remindStatus = 0;
             // 0 未订阅
             $remindStatusMsg = '有推广位了提醒我';
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('clickPrice' => round($clickPrice, 2), 'clickPriceUnit' => '元', 'bucketId' => $bucketInfo['id'], 'maxBucketNum' => $bucketInfo['totalNum'], 'usedBucketNum' => $bucketInfo['usedNum'], 'minChoicePrice' => 20, 'minChoicePriceUnit' => '元', 'maxChoicePrice' => 50, 'maxChoicePriceUnit' => '元', 'status' => $status, 'statusMsg' => $statusMsg, 'remindStatus' => $remindStatus, 'remindStatusMsg' => $remindStatusMsg, 'isDisplaySummary' => $isDisplaySummary));
 }
コード例 #23
0
 /**
  * 页面删除推广操作封装
  *
  * @param $planId
  * @return array
  */
 public static function delete_plan($planId, $brokerId)
 {
     $rstArr = array('status' => 'ok');
     //获取计划信息
     $planInfo = Model_Plan_EsfAjkPropSpread::data_access()->filter('id', $planId)->find_only();
     if (empty($planInfo)) {
         return array('status' => 'fail', 'info' => 'empty plan');
     }
     if ($planInfo->status == Model_Plan_EsfAjkPropSpread::ONLINE) {
         return array('status' => 'fail', 'info' => '计划正在推广中');
     }
     if ($planInfo->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
         return array('status' => 'fail', 'info' => '计划正在排队中');
     }
     if ($planInfo->tradestatus != Model_Plan_EsfAjkPropSpread::COMPLETETTRADESTATU) {
         return array('status' => 'fail', 'info' => '计划正在结算中');
     }
     if ($planInfo->status == Model_Plan_EsfAjkPropSpread::DELETE) {
         return array('status' => 'ok', 'info' => '计划已经被删除');
     }
     if ($brokerId != $planInfo->brokerId) {
         return array('status' => 'fail', 'info' => 'invalid broker');
     }
     if (Model_Plan_EsfAjkPropSpread::COMM_CHOICE != $planInfo->model) {
         return array('status' => 'fail', 'info' => 'invalid house');
     }
     //验证choice城市
     $cityId = $planInfo->cityId;
     if (!Bll_City::isChoiceCity($cityId)) {
         return array('status' => 'fail', 'info' => 'starttime not achieved ');
     }
     //更新状态
     $oldStatus = $planInfo->status;
     $planInfo->status = Model_Plan_EsfAjkPropSpread::DELETE;
     if (!$planInfo->save()) {
         return array('status' => 'fail', 'info' => 'update plan status fail');
     }
     //记录日志
     $remark = sprintf("STATUS:%d=>%d", $oldStatus, Model_Plan_EsfAjkPropSpread::DELETE);
     Model_Plan_LogAjkPropspread::addNewLog($planId, $brokerId, Model_Plan_LogAjkPropspread::DEL, $remark);
     return $rstArr;
 }
コード例 #24
0
ファイル: PropsList.php プロジェクト: emilymwang8/ajk-broker
 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);
     }
     $rstList = array();
     if (empty($comboInfos)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('list' => $rstList, '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('list' => $rstList, '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;
                     //精选状态
                     if ($plan['status'] == 1) {
                         $propertyList[$propId]['choiceStatus'] = 3;
                         $propertyList[$propId]['choiceStatusName'] = '精选中';
                     } elseif ($plan['status'] == 13) {
                         $propertyList[$propId]['choiceStatus'] = 4;
                         $propertyList[$propId]['choiceStatusName'] = '排队中';
                     }
                 } 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);
     //城市是否开通精选
     $cityIsChoice = Bll_City::isChoiceCity($cityId, Const_Site::HAOZU);
     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']);
         //是否委托
         $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $ajkBrokerId, Model_House_Commission::TYPE_RENT);
         $row['isEntrust'] = $isEntrust ? 1 : 0;
         if (isset($list['choiceStatus']) && isset($list['choiceStatusName']) && $cityIsChoice) {
             $row['choiceStatus'] = $list['choiceStatus'];
             $row['choiceStatusName'] = $list['choiceStatusName'];
         } else {
             $choiceStatus = Bll_HzProp::getZuFangChoiceStatus($list, $cityId, $cityIsChoice);
             $row['choiceStatus'] = $choiceStatus['choiceStatus'];
             $row['choiceStatusName'] = $choiceStatus['choiceStatusName'];
         }
         $rstList[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('list' => $rstList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo));
 }
コード例 #25
0
 /**
  *  判断城市是否开启精选
  *
  * @param $cityId
  * @return bool
  */
 public function checkChoiceOpen($cityId)
 {
     //验证choice城市
     return Bll_City::isChoiceCity($cityId);
 }
コード例 #26
0
ファイル: PropsList.php プロジェクト: emilymwang8/ajk-broker
 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'] + $comboInfo['rentPropNum'] > 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('list' => 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('list' => 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);
     // 获取城市价格段信息
     $priceSegmentList = Model_House_EsfPrice::getAllPriceInterval($cityId, Model_House_EsfPrice::TRADE_TYPE_SALE);
     //是否是精选城市,是否精选分离
     $cityIsChoice = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE);
     $cityIsChoiceIndependent = Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE);
     //拼接房源列表中房源数据
     $list = 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;
             }
         }
         $choiceStatusRecommend = Bll_House_EsfHouse::getEsfChoiceStatusAndRecommend($priceSegmentList, $propSpreadInfo, $prop, $cityIsChoice, $cityIsChoiceIndependent);
         $row['choiceStatus'] = $choiceStatusRecommend['choiceStatus'];
         $row['choiceStatusName'] = $choiceStatusRecommend['choiceStatusName'];
         $row['choiceRecommend'] = $choiceStatusRecommend['choiceRecommend'];
         $list[] = $row;
     }
     // 排序
     usort($list, 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('list' => $list, 'surplus' => $surplus > 0 ? $surplus : 0, 'hasCombo' => $hasCombo));
 }
コード例 #27
0
ファイル: BlockSet.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $response = APF::get_instance()->get_response();
     $params = $this->getParameters();
     $route_matches = $request->get_router_matches();
     $brokerId = $request->getBrokerId();
     $cityId = $request->getBrokerCityId();
     $userId = $request->getUserId();
     $business = trim($route_matches[1]);
     $prop_id = $route_matches[2];
     if (empty($brokerId)) {
         $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '请登陆操作', 'from' => 'bid_blockset'))));
         return false;
     }
     $isChoiceCity = false;
     $isChoiceCityTwo = false;
     switch ($business) {
         case 'ajk':
             $isChoiceCity = Bll_City::isBlockChoice($cityId, Const_Site::ANJUKE);
             //修改表city_biz_types 的type还有配置
             $isChoiceCityTwo = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE);
             break;
     }
     if (!$isChoiceCity) {
         $response->redirect('/user/combo/brokerhome?from=not_choice_city');
         return false;
     }
     //return 'Choice_BlockSet';
     //验证choice城市
     $config = Model_Config_CommonCity::getConfig(Model_Config_CommonCity::CHOICENAME, $cityId);
     /** 判断精选计划开启时间是否到了 */
     //$request->set_attribute('choiceStarted', time()<$config['startTime']);
     $request->set_attribute('choiceStarted', !$this->getCityOpenTimeBegin($config['startTime']));
     $request->set_attribute('choiceStartTimeMsg', sprintf('%d点准时开放', date('H', $config['startTime'])));
     /*if(time()<$config['startTime']){
           $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no'=>Bll_Plan_Bid_Choice::BID_FAIL_OTHER, 'err_msg'=>'还未到精选房源开始时间。', 'from'=>'bid_blockset'))));
           return false;
       }*/
     if (empty($route_matches) || count($route_matches) < 3) {
         $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '请从精选房源管理页设置精选房源计划', 'from' => 'bid_blockset'))));
         return false;
     }
     if (!is_numeric($route_matches[2])) {
         $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '房源ID必须是数字', 'from' => 'bid_blockset'))));
         return false;
     }
     $params['ip'] = $request->get_client_ip();
     //        var_dump($business);exit;
     if ($request->is_post_method()) {
         switch ($business) {
             case 'ajk':
                 try {
                     $result = Bll_Plan_Bid_BlockChoice::esf_setting_post($brokerId, $cityId, $prop_id, $userId, $params);
                 } catch (Exception $e) {
                     $result = array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试');
                 }
                 break;
             default:
                 $result = http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '参数错误。', 'from' => 'bid_blockset'));
                 break;
         }
         $result = array_merge($result, array('act' => $business, 'propId' => $prop_id));
         $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query($result)));
         return false;
     }
     switch ($business) {
         case 'ajk':
             try {
                 $pageAttributes = Bll_Plan_Bid_BlockChoice::esf_setting($brokerId, $cityId, $prop_id, $userId, $params);
             } catch (Exception $e) {
                 $pageAttributes = array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试');
             }
             break;
         default:
             $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '参数错误。', 'from' => 'bid_blockset'))));
             break;
     }
     if (isset($pageAttributes['err_no'])) {
         $result = array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => $pageAttributes['err_msg'], 'from' => 'bid_blockset');
         $result = array_merge($result, array('act' => $business, 'propId' => $prop_id));
         $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query($result)));
         return false;
     }
     $request->set_attribute('isChoiceCityTwo', $isChoiceCityTwo);
     $request->set_attribute('isChoiceCity', $isChoiceCity);
     $request->set_attribute('business', $business);
     $request->set_attribute('prop_id', $prop_id);
     $this->set_attributes($pageAttributes);
     /**
      * 2015 年关精选打折 预计时间2.1 ~ 3.5
      * TODO 2015.4.1 删除这部分代码
      */
     $isChoiceRebate = Bll_Onoff_Choice::getChoiceRebateByBroekrId($brokerId);
     $this->setAttribute('isChoiceRebate', $isChoiceRebate);
     switch ($business) {
         case 'jp':
             return 'Choice_BlockSetJP';
             break;
         default:
             return 'Choice_BlockSet';
     }
 }
コード例 #28
0
ファイル: ZfManage.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) {
         $this->redirect('/user/combo/brokerhome');
         exit;
     }
     //获取经纪人id
     $objRequest = APF::get_instance()->get_request();
     $cityid = self::$BrokerInfo['BaseInfo']['CITYID'];
     $objRequest->set_attribute('PayType', self::$BrokerInfo['BaseInfo']['PAYTYPE']);
     $isCombo = Bll_Combo_HouseRelation::isComboCity($cityid);
     $tmp = array('cityId' => $cityid, 'status' => 1, 'startDate' => date('Ymd'));
     $cityPrice = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, Const_ShowcaseOrders::RENT_DB);
     $todayPrice = round($cityPrice->discountPrice / 100, 2);
     $intBrokerID = $objRequest->getBrokerId();
     //好租经纪人ID
     $hzBrokerId = Bll_Broker_BrokerCheckInfo::getHzBrokerIdByAjkBrokerId($intBrokerID);
     $userId = $objRequest->getUserId();
     $data = array('brokerId' => $intBrokerID);
     $orderinfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders($data, $this->db);
     //判断经纪人是否有订单
     if (!$orderinfo) {
         $this->toManage('/ajkbroker/showcase/zf/');
     }
     $lavedays = ceil((strtotime($orderinfo->endDate) - strtotime(date('Ymd'))) / 3600 / 24);
     if ($orderinfo->isStop == 1 || $lavedays < 0) {
         $order_status = 'stop';
     } else {
         $objRequest->set_attribute('lavedays', $lavedays);
         $objRequest->set_attribute('lastday', date('Y-m-d', strtotime($orderinfo->endDate)));
         $order_status = 'open';
     }
     //获取参数值
     $params = APF::get_instance()->get_request()->get_parameters();
     $days = intval($params['days']);
     //status=2是停止,status=1是续费
     if ($params['status'] == 2) {
         if ($orderinfo->isStop == 0) {
             $stopstatus = Bll_Broker_ShowcaseOrders::getInstance()->stopBrokerOthers($orderinfo, $cityPrice->discountPrice, $this->db);
             if ($stopstatus['status']) {
                 $this->toManage();
             } else {
                 $this->toError($stopstatus['msg']);
             }
         } else {
             $msg = '订单类型不能操作';
             $this->toError($msg);
         }
     } elseif ($params['status'] == 1 && $days >= 1) {
         $BrokerMoney = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerMoney($userId);
         if ($BrokerMoney < $todayPrice) {
             $this->toError(Const_ShowcaseOrders::MONEY_NOT_ENOUGH);
         }
         $Continueorder = Bll_Broker_ShowcaseOrders::getInstance()->continueBrokerOthers($orderinfo, $days, $cityPrice->discountPrice, $this->db);
         if ($Continueorder['status']) {
             $this->toManage();
         } else {
             $this->toError($Continueorder['msg']);
         }
     } elseif ($params['status'] == 3) {
         if (!empty($params['rooms'])) {
             $proIds = explode(';', $params['rooms']);
             $filterProIds = Bll_Broker_ShowcaseAdSetPro::getInstance()->filterProIds($intBrokerID, $cityid, $this->db, $proIds);
             //有些房源不在线上展示
             if (count($filterProIds) != count($proIds)) {
                 $this->toError('有些房源没在线上推广,操作失败!');
             }
             $res = Bll_Broker_ShowcaseAdSetPro::getInstance()->insertAdProsInfo($intBrokerID, $cityid, $proIds, $this->db);
             if (!$res['status']) {
                 $this->toError($res['msg']);
             } else {
                 //插入成功,跳转至管理页面
                 if ($orderinfo->isStop == 0) {
                     $log = array();
                     $log['brokerId'] = $orderinfo->brokerId;
                     $log['cityId'] = $orderinfo->cityId;
                     $log['endDate'] = $orderinfo->endDate;
                     $log['startDate'] = $orderinfo->startDate;
                     $log['opType'] = Const_ShowcaseOrders::OPTYPE_6;
                     $log['totalDays'] = ceil((strtotime($orderinfo->endDate) - strtotime($orderinfo->startDate)) / 3600 / 24) + 1;
                     $log['createTime'] = time();
                     Bll_Broker_ShowcaseOrders::getInstance()->insertSetLog($log, $this->db);
                 }
                 $this->toManage();
             }
         }
     }
     $orderCreated = date('Ymd', $orderinfo->createTime);
     if ($orderCreated < date('Ymd')) {
         $click = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerClick($intBrokerID, date('Ymd', strtotime('-1 days')), $this->db);
         if (!$click->quantityCount) {
             $objRequest->set_attribute('YClick', 0);
         } else {
             $objRequest->set_attribute('YClick', $click->quantityCount);
         }
         $objRequest->set_attribute('IS_YClick', true);
     }
     if ($isCombo['data']) {
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($intBrokerID, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         if (!empty($comboList)) {
             if (count($comboList) >= Const_ShowcaseOrders::SALE_PRO_MAX_COUNT) {
                 $fixedProInfosCnt = Const_ShowcaseOrders::SALE_PRO_MAX_COUNT;
             } else {
                 $fixedProInfosCnt = count($comboList);
             }
         } else {
             $fixedProInfosCnt = 0;
         }
         $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($intBrokerID);
         $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId');
         $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid);
         $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds);
         $propMianNew = array();
         foreach ($propMianInfo as $propMianVal) {
             $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true);
             $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true);
         }
         $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initComboZfProData($proInfos, $propMianNew, $comboList);
     } else {
         $fixedProInfos = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProInfo($hzBrokerId);
         if (!empty($fixedProInfos)) {
             $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($fixedProInfos, 'proid');
             $proInfos_tmp = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid);
             $proIdsc = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfos_tmp, 'proid');
             $proInfosc = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIdsc, $cityid);
             if (!empty($proInfosc)) {
                 if (count($proInfosc) >= Const_ShowcaseOrders::RENT_PRO_MAX_COUNT) {
                     $fixedProInfosCnt = Const_ShowcaseOrders::RENT_PRO_MAX_COUNT;
                 } else {
                     $fixedProInfosCnt = count($proInfosc);
                 }
             } else {
                 $fixedProInfosCnt = 0;
             }
         } else {
             $fixedProInfosCnt = 0;
         }
         $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($intBrokerID);
         $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId');
         $proStatus = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProStatus($proIds);
         $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid);
         $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds);
         $propMianNew = array();
         foreach ($propMianInfo as $propMianVal) {
             $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true);
             $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true);
         }
         $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initZfProData($proInfos, $propMianNew, $proStatus);
     }
     if (count($proList) > $fixedProInfosCnt) {
         $fixedProInfosCnt = count($proList);
     }
     $objRequest->set_attribute('type', 'hz');
     $objRequest->set_attribute('index', 2);
     //精选推广开关
     $isChoice = Bll_City::isChoiceCity($cityid, Const_Site::HAOZU);
     $objRequest->set_attribute('isChoice', $isChoice);
     $objRequest->set_attribute('proList', $proList);
     $objRequest->set_attribute('fixedProInfosCnt', $fixedProInfosCnt);
     $objRequest->set_attribute('order_status', $order_status);
     $objRequest->set_attribute('todayPrice', $todayPrice);
     return 'Showcase_ZfManage';
 }
コード例 #29
0
ファイル: JpPublish.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @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);
 }
コード例 #30
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $houseId = $this->_params['propId'];
     $budget = $this->_params['budget'];
     if ($budget < 20 || $budget > 50) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '请输入20~50之间的整数');
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $cityId = $brokerInfo->cityId;
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_NOT_CHOICE_CITY, 'message' => '非精选城市');
     }
     // 获取房源基本信息
     $propInfo = Model_House_HzProp::get_prop_info_by_prop_id($houseId);
     $block_id = $propInfo['contentBasic']['blockid'];
     // 获取点击单价
     try {
         $clickPriceInfo = Bll_Service_Choice::hzClickPrice(array('cityId' => $cityId, 'price' => (int) $propInfo['contentBasic']['pricenum'], 'blockId' => $block_id, 'brokerId' => $brokerId));
         if ($clickPriceInfo['status'] == 'error') {
             return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '系统繁忙(code:-33)');
         }
     } catch (Exception $e) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '系统繁忙(code:-33)');
     }
     $params = array();
     $params['price'] = $clickPriceInfo['realTradeAmount'] / 100;
     // 点击单价单位转换:分 -> 元;
     $params['show'] = 0;
     $params['budget'] = $budget;
     $params['ip'] = $this->_request->get_client_ip();
     // 判断是否是重新推广
     $bllChoice = new Bll_Zufang_Choice();
     $planInfo = $bllChoice->get_plan_by_proid($houseId);
     //planning表中查找精选计划
     if (!empty($planInfo)) {
         $planId = $planInfo->plan_id;
         $basicPlanInfo = $bllChoice->get_plan($planId);
         if (!empty($basicPlanInfo)) {
             if ($basicPlanInfo[0]->status == 1 || $basicPlanInfo[0]->status == 13) {
                 return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => '该房源已做精选推广!');
             }
             if ($basicPlanInfo[0]->status != Const_HzPlan::DELETE) {
                 $params['plan_id'] = $planInfo->plan_id;
             }
         }
     }
     // 开始精选推广
     $result = Bll_Plan_Bid_Choice::hz_setting_post($brokerId, $cityId, $houseId, $params);
     if ($result['err_no'] != Bll_Plan_Bid_Choice::BID_WAIT_SUCCESS) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '', 'message' => $result['err_msg']);
     }
     if ($result['rank'] > 10) {
         $status = 2;
         $msg = "排在第{$result['rank']}位";
     } else {
         $status = 1;
         $msg = "精选推广成功";
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => $status, 'statusMsg' => $msg));
 }