コード例 #1
0
 /**
  * 获取经纪人微聊信息
  *
  * 如无微聊信息,尝试自动注册经纪人微聊账户
  *
  * @param $brokerId
  * @param $pushType
  * @return array|string
  */
 public function getChatInfo($brokerId, $pushType)
 {
     $chatInfo = Model_Mobile_BrokerChatInfo::getBrokerChatInfo($brokerId);
     if ($chatInfo) {
         $chatId = $chatInfo['chatId'];
         $response = $this->apiGetChatInfoByChatId($chatId);
         if (!$response || $response['data']['status'] == 'ERROR') {
             return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
             // TODO 获取信息失败
         }
         // 激活账户
         if ($pushType == 1 && $chatInfo['isActived'] == 0) {
             $this->activate($brokerId, $chatId);
         }
         $twoCodeIcon = $response['data']['result']['two_code_icon'];
     } else {
         $response = $this->register($brokerId, $pushType);
         if (!$response || $response['data']['status'] == 'ERROR') {
             return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
             // TODO 注册失败
         }
         $chatId = $response['data']['result']['user_id'];
         $twoCodeIcon = $response['data']['result']['two_code_icon'];
     }
     $result = array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('chatId' => $chatId, 'twoCodeIcon' => $twoCodeIcon));
     return $result;
 }
コード例 #2
0
ファイル: DelProps.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propIds = $this->_params['propIds'];
     $cityId = $this->_params['cityId'];
     $paramsApi['from'] = APF::get_instance()->get_config('java_api_from');
     $paramsApi['proids'] = $propIds;
     $paramsApi['proid'] = $propIds;
     $paramsApi['token'] = $this->_params['token'];
     $paramsApi['brokerId'] = $brokerId;
     $paramsApi['tradeType'] = 2;
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $paramsApi['isComboBroker'] = true;
         $api_url = 'rent/properties/deletes?json';
         $data = Util_CallAPI::callJavaInternalApi($api_url, $paramsApi, false);
         if ($data['data']['status'] === 'ok') {
             $ret = array('status' => 'ok', 'data' => array());
         } else {
             $ret = Util_MobileAPI::error(Const_APIStatus::E_PROP_DEL_FAILED);
         }
         return $ret;
     } else {
         $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
         $ret = Bll_HzProp::delete_prop($brokerId_hz, $cityId, $propIds);
         if ($ret) {
             $return = array('status' => 'ok', 'data' => array());
         } else {
             $return = Util_MobileAPI::error(Const_APIStatus::E_PROP_DEL_FAILED);
         }
         return $return;
     }
 }
コード例 #3
0
 public function before()
 {
     //防止端口城市对pp城市接口的访问
     //接受参数:判断是否是套餐经纪人,是报错,不是,继续执行
     $request_body = file_get_contents('php://input');
     if ($request_body) {
         $res = json_decode($request_body, true);
         if (is_array($res)) {
             foreach ($res as $k => $v) {
                 $_REQUEST[$k] = $v;
             }
         }
     }
     $params = $_REQUEST;
     $brokerId = $params['brokerId'];
     if (empty($brokerId)) {
         echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS));
         return self::STEP_EXIT;
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (empty($brokerInfo)) {
         echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS));
         return self::STEP_EXIT;
     }
     $isComboCity = Bll_Combo_HouseRelation::isComboCity($brokerInfo->cityId);
     if ($isComboCity['code'] == 200) {
         if ($isComboCity['data']) {
             echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_BROKER_ISNOT_PPC));
             return self::STEP_EXIT;
         }
     }
     return self::STEP_CONTINUE;
 }
コード例 #4
0
ファイル: Getplans.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId_ajk = $this->_params['brokerId'];
     if (empty($brokerId_ajk)) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId_ajk);
     $fixplans = Bll_HzFixPlan::get_broker_fixplans($brokerId_hz);
     $ret = array('status' => 'ok', 'data' => array());
     if ($fixplans) {
         $plan = array();
         $status_arr = array(1 => '有效', 2 => '计划上限', 3 => '手工结束', 4 => '暂停', 5 => '待推广', 6 => '删除', 7 => '余额上限', 9 => '手动停止');
         $city_id = $fixplans[0]['city_id'];
         if (empty($city_id)) {
             $user_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
             $city_id = $user_info['cityid'];
         }
         $cityTop = Bll_HzFixPlan::get_citytop($city_id);
         //播种城市
         foreach ($fixplans as $planInfo) {
             if (!empty($cityTop)) {
                 $fixPlanPropCeiling = round($cityTop['money'] / 100, 2);
                 $fixPlanPropCeiling = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0;
             } else {
                 $fixPlanPropCeiling = $planInfo['amount'] ? $planInfo['amount'] : 0;
             }
             $tmp = array('fixPlanId' => $planInfo['id'], 'fixPlanName' => $planInfo['plan_title'], 'fixPlanPropCeiling' => $fixPlanPropCeiling, 'fixPlanPropNum' => $planInfo['prop_count'] ? $planInfo['prop_count'] : 0, 'fixPlanState' => $planInfo['status'], 'fixPlanStateDesc' => $status_arr[$planInfo['status']]);
             $plan['planList'][] = $tmp;
         }
         $ret = array('status' => 'ok', 'data' => $plan);
     }
     return $ret;
 }
コード例 #5
0
 public function handle_request_internal()
 {
     //组织POST参数
     $params = array();
     if (!isset($this->_params["brokerId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     } else {
         $broker_id = $this->_params["brokerId"];
     }
     if (!isset($this->_params["cityId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     $return = array();
     $return["status"] = "ok";
     $recent_comm_count = 0;
     if ($recent_comm_count < Const_APIStatus::SEARCH_COMM_LIST_NUM) {
         $this->_params['page_size'] = Const_APIStatus::SEARCH_COMM_LIST_NUM - $recent_comm_count;
         apf_require_controller("V1_Comm_GetNearby");
         $nearby_comm = new V1_Comm_GetNearbyController();
         $nearby_comm = $nearby_comm->getNearbyComm($this->_params, 0);
         $nearby_comm_list = $nearby_comm['communities'];
     }
     if ($nearby_comm_list) {
         foreach ($nearby_comm_list as $list) {
             $return['data']['nearby'][] = array('commId' => $list['id'], 'commName' => $list['name'], 'address' => $list['address']);
         }
     }
     $return['data']['history'] = array();
     return $return;
 }
コード例 #6
0
ファイル: Update.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //检测title
     $checkRes = $this->checkTitle($this->_params);
     if (!$checkRes) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     //构造房源接口数据
     $params = Bll_Prop::gen_prop_info($this->_params);
     $params['proid'] = $this->_params['propId'];
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     //判断经纪人为ppc经纪人 & 套餐经纪人
     //根据不同类型判断调用不同的java接口
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $params['isComboBroker'] = true;
         $api_url = 'sale/properties/update?json';
     } else {
         $params['isComboBroker'] = false;
         $api_url = 'ppc/properties/update?json';
     }
     //调用房源编辑接口
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] !== 'ok') {
         return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     $return = array();
     $return["status"] = "ok";
     $return['data'] = array();
     return $return;
 }
コード例 #7
0
ファイル: AddImg.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (!isset($this->_params["propId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     $json = $this->_params['imageJson'];
     //$json = '[{"type":3,"commPicIds":12345}]';
     $imageJson = json_decode($json, true);
     if ($imageJson) {
         $proid = $this->_params["propId"];
         foreach ($imageJson as $img) {
             $api_url = 'image/addImg';
             $img_params['brokerId'] = $this->_params['brokerId'];
             $img_params['propId'] = $proid;
             $img_params['imageJson'] = json_encode($img);
             $img_params['from'] = APF::get_instance()->get_config('java_api_from');
             $img_params["token"] = $this->_params["token"];
             //token
             ksort($img_params);
             $img_params_json = json_encode($img_params);
             $img_return = Util_CallAPI::get_data_from_java_v3($api_url, $img_params_json, false);
             if ($img_return['data']['status'] != 'ok' && !$img_return['data']['id']) {
                 return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($img_return['data']['code']));
             }
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_IMAGEJSON_ERROR);
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']['id'] = $img_return['data']['id'];
     return $return;
 }
コード例 #8
0
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     if (!isset($this->_params['planId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $result = Bll_HzFixPlan::get_plan_detail($brokerId_hz, $this->_params['cityId'], $this->_params['planId'], true);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         if (!empty($result['property'])) {
             foreach ($result['property'] as $propertyList) {
                 foreach ($propertyList['props'] as $propinfo) {
                     $proprow["id"] = $propinfo['proid'];
                     $proprow["type"] = $propinfo['content_basic']['protype'];
                     $proprow["area"] = round($propinfo['content_basic']['areanum']);
                     $proprow["commId"] = $propinfo['content_basic']['commid'];
                     $proprow["commName"] = $propinfo['content_basic']['commname'];
                     $proprow["hallNum"] = $propinfo['content_basic']['hallnum'];
                     $proprow["price"] = round($propinfo['content_basic']['pricenum']);
                     $proprow["priceUnit"] = "元";
                     $proprow["roomNum"] = $propinfo['content_basic']['roomnum'];
                     $proprow["title"] = $propinfo['content_basic']['title'];
                     $proprow["toiletNum"] = $propinfo['content_basic']['toilnetnum'];
                     $proprow["clickNum"] = $propinfo['fix_click'];
                     $proprow["isBid"] = $propinfo['is_bid'];
                     if ($propinfo['content_basic']['quality']) {
                         $proprow["isMoreImg"] = 1;
                         //多图
                     } else {
                         $proprow["isMoreImg"] = 0;
                     }
                     $result['propertyList'][] = $proprow;
                     unset($proprow);
                 }
             }
             unset($result['property']);
         }
         $return['data'] = $result;
         $cityTop = Bll_HzFixPlan::get_citytop($this->_params['cityId']);
         //播种城市
         if (!empty($cityTop)) {
             $fixPlanPropCeiling = round($cityTop['money'] / 100, 2);
             $return['data']['plan']['fixPlanPropCeiling'] = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0;
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
コード例 #9
0
ファイル: Update.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (mb_strlen($this->_params['title'], 'UTF-8') < 5 || mb_strlen($this->_params['title'], 'UTF-8') > 30) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     $params = Bll_ZuProp::gen_prop_info($this->_params);
     $params['proid'] = $this->_params['propId'];
     //unset($params['style']);
     //获取租房房信息
     /*$propInfo       =  Bll_HzProp::get_prop($this->_params['propId']);
       $style = intval($propInfo['protype']) ? intval($propInfo['protype']) : 1;
       $change_style   = array(1=>1, 4=>2, 3=>3, 5=>4, 2=>5, 6=>6, 7=>7, 8=>8);
       $params['style'] = $change_style[$style];*/
     unset($params['year']);
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     $brokerId = $this->_params['brokerId'];
     if (isset($brokerId) && Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $params['isComboBroker'] = true;
         $api_url = 'rent/properties/update?json=1';
     } else {
         $params['isServiceInternal'] = 1;
         $params['isComboBroker'] = false;
         $api_url = '/service-internal/rest/properties/update?json=1';
     }
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] !== 'ok') {
         return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     $return = array();
     $return["status"] = "ok";
     $return['data'] = array();
     return $return;
 }
コード例 #10
0
ファイル: DelProps.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     //        @params proids :房源id 多个id以逗号间隔如22,33,44【必填】
     //        @params brokerId :经纪人id【必填】
     //        @params token :token【必填】
     //        @params from :请求来源【必填】
     $paramsApi['from'] = APF::get_instance()->get_config('java_api_from');
     $paramsApi['proids'] = $this->_params['propIds'];
     $paramsApi['token'] = $this->_params['token'];
     $paramsApi['brokerId'] = $this->_params['brokerId'];
     $brokerId = $this->_params['brokerId'];
     //判断经纪人为ppc经纪人 & 套餐经纪人
     //根据不同类型判断调用不同的java接口
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $paramsApi['isComboBroker'] = true;
         $api_url = 'sale/properties/deletes?json';
     } else {
         $paramsApi['isComboBroker'] = false;
         $api_url = 'ppc/properties/deletes?json';
     }
     $data = Util_CallAPI::callJavaInternalApi($api_url, $paramsApi, false);
     if ($data['data']['status'] === 'ok') {
         $ret = array('status' => 'ok', 'data' => array());
     } else {
         $errcode = $data['data']['code'];
         $translate_errcode = $this->my_err_code($errcode);
         return Util_MobileAPI::error($translate_errcode);
     }
     return $ret;
 }
コード例 #11
0
ファイル: Getplans.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     if (empty($brokerId)) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     $url = '/service-ppc/rest/ppc/getBrokerPpcPlans/' . $brokerId . '?tradeType=1&isNew=1';
     $data = Util_CallAPI::get_data_from_java_api($url);
     $ret = array('status' => 'ok', 'data' => array('planList' => array()));
     if ($data['data']['plan']) {
         $plan = array();
         foreach ($data['data']['plan'] as $planInfo) {
             if ($planInfo['statusDescrip'] == '推广中') {
                 $status = 1;
                 //推广中
             } else {
                 $status = 2;
                 //其它都是非推广
             }
             $tmp = array('fixPlanId' => $planInfo['id'], 'fixPlanName' => $planInfo['planName'], 'fixPlanPropCeiling' => $planInfo['ceiling'] / 100, 'fixPlanPropNum' => $planInfo['propSize'], 'fixPlanState' => $status, 'fixPlanStateDesc' => $planInfo['statusDescrip']);
             $plan['planList'][] = $tmp;
         }
         $ret = array('status' => 'ok', 'data' => $plan);
     }
     return $ret;
 }
コード例 #12
0
ファイル: SpreadStop.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $planId = $this->_params['planId'];
     // 获取定价计划
     $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId);
     if (!$fixPlan) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 暂停定价计划
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "stop");
     if (!$result['status']) {
         switch ($result['msg']) {
             case Const_HzErrorInfo::PLANSTOPING:
                 throw new Exception('计划已经停止', Const_APIStatus::E_PLAN_ALREADY_STOPPED);
                 break;
             default:
                 return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
         }
     }
     // 记录定价上下架日志
     $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_stop', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId);
     if ($result['status'] != 'ok') {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']);
     }
     return array('status' => 'ok', 'data' => array());
 }
コード例 #13
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $url = 'haopan/unRecommendProp/' . $brokerId . '/1';
     $data = Util_CallAPI::get_data_from_java_v3($url);
     mb_internal_encoding('UTF-8');
     if ($data['data']['status'] === 'ok') {
         if (!isset($data['data']['propBaseInfo'])) {
             $ret = array('status' => 'ok', 'data' => array('propertyList' => array()));
             return $ret;
         }
         $props = array();
         if (!empty($data['data']['propBaseInfo'])) {
             foreach ($data['data']['propBaseInfo'] as $info) {
                 list($room, $hall, $wc) = $this->get_house_unit($info['housUnits']);
                 $propInfo = Bll_Prop::get_ajk_prop_info($info['propId']);
                 $tmp = array('id' => $info['propId'], 'title' => $info['title'], 'commName' => $info['commName'], 'roomNum' => $room, 'hallNum' => $hall, 'toiletNum' => $wc, 'area' => $propInfo['AREANUM'], 'price' => $info['price'] / 10000, 'priceUnit' => '万', 'ImgNum' => $info['propImgNum'], 'isMoreImg' => $propInfo['ISHIGHQULITY']);
                 $props['propertyList'][] = $tmp;
             }
         }
         $ret = array('status' => 'ok', 'data' => $props);
     } else {
         $ret = Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     return $ret;
 }
コード例 #14
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propIds = $this->_params['propIds'];
     $planId = isset($this->_params['planId']) ? $this->_params['planId'] : null;
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $propIds = explode(',', $propIds);
     // 转换成数组
     // 判断定价推广房源数量
     $fixPlans = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId);
     if (empty($fixPlans)) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 定价房源总数不能超过50套
     $fixPropNum = 0;
     foreach ($fixPlans as $planInfo) {
         $fixPropNum = $fixPropNum + $planInfo['prop_count'];
     }
     if ($fixPropNum + count($propIds) > 50) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_ERR_3014);
     }
     // 房源加入定价计划组
     if (is_null($planId)) {
         $planId = $fixPlans[0]['id'];
     }
     $ret = Bll_HzFixPlan::batchprop_into_fix($hzBrokerId, $propIds, $planId);
     if (!$ret['status']) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return array('status' => 'ok', 'data' => array());
 }
コード例 #15
0
 public function handle_request_internal()
 {
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     if (!isset($this->_params['planId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1);
     }
     $planId = $this->_params['planId'];
     $brokerId = $this->_params['brokerId'];
     $api_url = '/service-ppc/rest/ppc/getPpcPlan/' . $planId . '?resType=1';
     $plan_info = Util_CallAPI::get_data_from_java_api($api_url);
     $return = array();
     if ($plan_info['data']['status'] == 'ok') {
         $status_info = $this->get_plan_status_info($brokerId, $planId);
         if ($status_info['data']['status'] == 'ok') {
             $props = $plan_info['data']['property'] ?: array();
             $return = array('status' => 'ok', 'data' => array('plan' => $this->gen_plan($plan_info, $status_info), 'propertyList' => $this->gen_props($props, $brokerId)));
         } else {
             return Util_MobileAPI::error(self::changeJavaAPICodeToSelfCode($status_info['data']['code']));
         }
     } else {
         return Util_MobileAPI::error(self::changeJavaAPICodeToSelfCode($plan_info['data']['code']));
     }
     return $return;
 }
コード例 #16
0
ファイル: GetRank.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     //组织POST参数
     $params = array();
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     } else {
         $broker_id = $this->_params["brokerId"];
     }
     if (!isset($this->_params["cityId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     if (!isset($this->_params["propId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     if (!isset($this->_params["offer"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_BID_PRICE_MISS);
     }
     if (!Bll_City::isBidCity($this->_params["cityId"])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $search = new Util_SearchUtil();
     $prop = Bll_HzProp::get_prop($this->_params["propId"]);
     $blockid = $prop['blockid'];
     $price = $prop['pricenum'];
     $price_block = Bll_HzBidPlan::get_price_block($this->_params["cityId"], $price);
     $ajkid = Bll_HzProp::get_subregion_id($prop['commId'], $this->_params["propId"]);
     $rank = $search->getHpRankByProp($this->_params["cityId"], $ajkid, $this->_params["propId"], $price_block['LOWER'], $price_block['UPPER'], $this->_params['offer']);
     $return = array();
     $return["status"] = "ok";
     $return["data"] = $rank;
     return $return;
 }
コード例 #17
0
ファイル: Editplan.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     $budget = $this->_params['budget'];
     $offer = $this->_params['offer'];
     $city_info = Dao_Broker_BrokerInfo::get_broker_base_info(intval($this->_params['brokerId']));
     if (!Bll_City::isBidCity($city_info['CITYID'])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $planInfo = $this->get_hpplan_info($propId);
     $post = array('brokerId' => $brokerId, 'propId' => $propId, 'budget' => $budget * 100 - $planInfo['budget'], 'offer' => $offer * 100, 'from' => APF::get_instance()->get_config('java_api_from'));
     $url = '/service-ppc/rest/hp/updHPlan';
     $data = Util_CallAPI::get_data_from_java_api($url, $post);
     if ($data['data']['status'] === 'ok') {
         $ret = array('status' => 'ok', 'data' => array());
     } else {
         $errcode = $data['data']['code'];
         $translate_errcode = $this->my_err_code($errcode);
         if ($translate_errcode === FALSE) {
             $ret = Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']);
         } else {
             $ret = Util_MobileAPI::error($translate_errcode);
         }
     }
     return $ret;
 }
コード例 #18
0
 public function handle_request_internal()
 {
     if ($this->_params['offer']) {
         $post = array('brokerId' => $this->_params['brokerId'], 'budget' => $this->_params['budget'] * 100, 'offer' => $this->_params['offer'] * 100, 'propId' => $this->_params['propId']);
     }
     $city_info = Dao_Broker_BrokerInfo::get_broker_base_info(intval($this->_params['brokerId']));
     if (!Bll_City::isBidCity($city_info['CITYID'])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     if (!empty($this->_params['offer'])) {
         $offerStr = (string) $this->_params['offer'];
         if (strpos($offerStr, ".") !== false) {
             $offerArr = explode('.', $offerStr);
             if (strlen($offerArr[1]) > 1) {
                 return Util_MobileAPI::error_tmp("3016", "竞价出价最小单位为角");
             }
         }
     }
     $api_url = '/service-ppc/rest/hp/createHPlan';
     $result = Util_CallAPI::get_data_from_java_api($api_url, $post);
     if ($result['data']['status'] == 'ok') {
         $return = array('status' => 'ok', 'data' => array());
     } else {
         $return = Util_MobileAPI::error(self::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     return $return;
 }
コード例 #19
0
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     if (!isset($this->_params['planId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $result = Bll_HzFixPlan::get_plan_detail($brokerId_hz, $this->_params['cityId'], $this->_params['planId'], true);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         $return['data'] = $result;
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
コード例 #20
0
ファイル: GetConfig.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (!isset($this->_params['cityId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     // 房屋类型 junyang
     $protype = APF::get_instance()->get_config('housetype', 'zu_house');
     $protype = isset($protype[$this->_params['cityId']]) ? $protype[$this->_params['cityId']] : $protype[0];
     // 装修类型
     $fitments = APF::get_instance()->get_config('ajk_fitment_unify', 'zu_house');
     $fitment = $fitments[$this->_params['cityId']];
     // 选择朝向
     $toward = APF::get_instance()->get_config('toward', 'zu_house');
     // 房屋配置
     $deployment = APF::get_instance()->get_config('b_deployment', 'zu_house');
     // 付款类型
     $paytype = APF::get_instance()->get_config('paytype', 'zu_house');
     // 合租类型
     $sharetype = APF::get_instance()->get_config('sharetype', 'zu_house');
     // 合租性别
     $sharesex = APF::get_instance()->get_config('sharesex', 'zu_house');
     //是否播种城市
     $isseed = 0;
     $cityTop = Bll_HzFixPlan::get_citytop($this->_params['cityId']);
     if (!empty($cityTop)) {
         $isseed = 1;
     }
     $return = array();
     $return["status"] = "ok";
     $return["data"] = array("protype" => $protype, "fitment" => $fitment, "toward" => $toward, "deployment" => $deployment, "paytype" => $paytype, "sharetype" => $sharetype, "sharesex" => $sharesex, 'isseed' => $isseed);
     return $return;
 }
コード例 #21
0
 public function handle_request_internal()
 {
     if (!isset($this->_params["brokerId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     if (!isset($this->_params["cityId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     $commProps = new V1_Anjuke_Chat_GetCommPropsController();
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $props = $commProps->getComboPropsInOneComm($brokerId, $cityId);
     } else {
         $props = $commProps->getPpcPropsInOneComm($brokerId, $cityId);
     }
     if (!empty($props)) {
         $i = 0;
         foreach ($props as $propArr) {
             $tmpArr = array_keys($propArr);
             $commList[$i]['commId'] = $propArr[$tmpArr[0]]['commId'];
             $commList[$i]['commName'] = $propArr[$tmpArr[0]]['commName'];
             $commList[$i]['propNums'] = count($propArr);
             $i++;
         }
     } else {
         $commList = array();
     }
     $return = array('status' => 'ok', 'data' => $commList);
     return $return;
 }
コード例 #22
0
ファイル: ComboPay.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $skuId = $this->_params['skuId'];
     $password = $this->_params['password'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $userId = $brokerInfo->userId;
     if ($brokerInfo->payType != 9999) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_IS_NOT_COMBO);
         //非套餐经纪人不能购买套餐
     }
     //购买
     $md5_password = md5($password);
     //密码加密
     $baseencode_password = base64_encode($md5_password);
     $userInfo = Model_Broker_Member::getAjkMembersByUserId($userId);
     //验证密码
     if ($userInfo->userPwd == $baseencode_password) {
         $result = Bll_Combo_Broker_BrokerComboInfo::brokerBuyCombo($userId, $skuId);
         if ($result['status'] == 'ok') {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '购买成功'));
         } else {
             switch ($result['code']) {
                 case '400539':
                 case '400015':
                 case '400540':
                 case '400545':
                 case '400498':
                 case '400541':
                 case '505008':
                 case '398489':
                 case '398491':
                 case '402205':
                 case '404086':
                     throw new Exception_JavaApiException($result['info']);
                     break;
                 case '398490':
                     throw new Exception_SameComboException('不支持再购买同类型套餐');
                     break;
                 case '402207':
                     throw new Exception_Account_BalanceNotEnough('余额不足');
                     break;
                 case '505007':
                     throw new Exception_Broker_NotPassCheck('您的双证审核未通过');
                     break;
                 default:
                     return Util_MobileAPI::error(Const_APIStatus::E_COMBO_BUY_COMBO_FAILED);
                     //购买失败
             }
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PASSWORD_DIFFERENT);
         //密码错误
     }
 }
コード例 #23
0
ファイル: Logout.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $token = $this->_params['token'];
     $result = Bll_TokenBiz::get_instance()->delete_by_token($token);
     $ret = array('status' => 'ok', 'data' => '');
     if (!$result) {
         $ret = Util_MobileAPI::error(Const_APIStatus::E_LOGOUT_FAILED);
     }
     return $ret;
 }
コード例 #24
0
ファイル: Minoffer.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $cityId = $this->_params['cityId'];
     $price = $this->_params['price'];
     $result = Bll_HzFixPlan::get_minoffer($price, $cityId);
     if ($result) {
         $ret = array('status' => 'ok', 'data' => array('price' => $result));
     } else {
         $ret = Util_MobileAPI::error(Const_APIStatus::E_PROP_PARAM_ERR);
     }
     return $ret;
 }
コード例 #25
0
ファイル: Publish.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     $ownerPropId = $this->_params['ownerPropId'];
     //检测title
     $checkRes = $this->checkTitle($this->_params);
     if (!$checkRes) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     //构造房源接口数据
     $params = Bll_Prop::gen_prop_info($this->_params);
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     //判断经纪人为ppc经纪人 & 套餐经纪人
     //根据不同类型判断调用不同的java接口
     $api_url = 'sale/properties/add?json';
     //调用房源发布接口
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] != 'ok') {
         return Util_MobileAPI::error_tmp($result['data']['code'], $result['data']['info']);
     }
     $imageJson = (array) json_decode($this->_params['imageJson']);
     if ($imageJson) {
         $proid = $result['data']['action']['proid'];
         foreach ($imageJson as $img) {
             $api_url = 'image/addImg';
             $img_params['brokerId'] = $brokerId;
             $img_params['propId'] = $proid;
             $img_params['imageJson'] = json_encode($img);
             $img_params['from'] = APF::get_instance()->get_config('java_api_from');
             $img_params["token"] = $this->_params["token"];
             //token
             ksort($img_params);
             $img_params_json = json_encode($img_params);
             $img_return = Util_CallAPI::get_data_from_java_v3($api_url, $img_params_json, false);
             if ($img_return['data']['status'] != 'ok' && !$img_return['data']['id']) {
                 return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($img_return['data']['code']));
             }
         }
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']['id'] = $proid = $result['data']['action']['proid'];
     if ($proid && isset($ownerPropId) && !empty($ownerPropId)) {
         //委托房源回写
         $entrustDynamicLog = new V1_Entrust_PropertyDynamicLogController();
         $entrustDynamicLog->addLog($cityId, $ownerPropId, $brokerId, $proid, 2, 2);
     }
     return $return;
 }
コード例 #26
0
 public function handle_request_internal()
 {
     //组织数据
     if (!isset($this->_params["commId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_COMMID_MISS);
     }
     if (isset($this->_params["rooms"])) {
         $rooms = explode(',', $this->_params["rooms"]);
         $rommNum = $rooms[0];
         $hallNum = $rooms[1];
         $toiletNum = $rooms[2];
     }
     $params['commId'] = $this->_params['commId'];
     $params['pageNo'] = isset($this->_params['pageNo']) ? trim($this->_params['pageNo']) : 1;
     $params['pageSize'] = isset($this->_params['pageSize']) ? trim($this->_params['pageSize']) : 10;
     $params['imgSize'] = isset($this->_params['imgSize']) ? trim($this->_params['imgSize']) : '420x315';
     $params['rommNum'] = $rommNum ? $rommNum : 2;
     $params['hallNum'] = $hallNum ? $hallNum : 1;
     $params['toiletNum'] = $toiletNum ? $toiletNum : 1;
     $params['forward'] = isset($this->_params['forward']) ? trim($this->_params['forward']) : '南';
     if (!in_array($params['forward'], array("东", "南", "西", "北", "南北", "东西", "东南", "西南", "东北", "西北"))) {
         $params['forward'] = '南';
     }
     $params['forward'] = urlencode($params['forward']);
     //通过java接口获取数据
     $api_url = "image/houseModuleImg/" . $params['commId'];
     $_params = array();
     foreach ($params as $key => $value) {
         $_params[] = "{$key}={$value}";
     }
     $api_url = $api_url . '?' . implode('&', $_params);
     $houseImg = Util_CallAPI::get_data_from_java_ga($api_url, '', false);
     if ($houseImg['data']['status'] == 'ok') {
         $houseImg = $houseImg['data'];
         if (!empty($houseImg['imgs'])) {
             foreach ($houseImg['imgs'] as $k => $img) {
                 $arr = explode('/', $img['fileName']);
                 $houseImg['imgs'][$k]['hash'] = $arr[1];
             }
         } else {
             $houseImg['imgs'] = array();
         }
         unset($houseImg['status']);
         unset($houseImg['count']);
     } else {
         return Util_MobileAPI::error(self::changeJavaAPICodeToSelfCode($houseImg['data']['code']));
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']['houseImg'] = $houseImg;
     return $return;
 }
コード例 #27
0
 public function handle_request_internal()
 {
     $planId = $this->_params['planId'];
     $result = Bll_HzFixPlan::get_fix_budget($planId);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         $return['data']['budget'] = $result;
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
コード例 #28
0
ファイル: Test.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     //组织POST参数
     if (!isset($this->_params["brokerId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     //$brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $return = array();
     $return["status"] = "ok";
     $return['data'] = APF::get_instance()->get_config('set_price', 'setpricelevel');
     //Dao_Broker_HzPlan::get_broker_plan($brokerId_hz);
     return $return;
 }
コード例 #29
0
ファイル: Cancelplan.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $post = array('brokerId' => $this->_params['brokerId'], 'proIds' => $this->_params['propId'], 'planId' => $this->_params['planId'], 'from' => APF::get_instance()->get_config('java_api_from'));
     $url = '/service-ppc/rest/ppc/planDelProperty';
     $data = Util_CallAPI::get_data_from_java_api($url, $post);
     if ($data['data']['status'] === 'ok') {
         $ret = array('status' => 'ok', 'data' => array());
     } else {
         $errcode = $data['data']['code'];
         $translate_errcode = $this->my_err_code($errcode);
         $ret = Util_MobileAPI::error($translate_errcode);
     }
     return $ret;
 }
コード例 #30
0
ファイル: Minoffer.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     $cityId = $this->_params['cityId'];
     $price = $this->_params['price'];
     $areaId = $this->_params['areaid'] ? $this->_params['areaid'] : 0;
     $coomId = $this->_params['coomId'] ? $this->_params['coomId'] : 0;
     $bll = new Bll_Fixedspread_AjkFixedSpread();
     $result = $bll->getPriceInterval($cityId, $price, $areaId, $coomId);
     if ($result['price']) {
         $ret = array('status' => 'ok', 'data' => array('price' => $result['price']));
     } else {
         $ret = Util_MobileAPI::error(Const_APIStatus::E_PROP_PRICE_ERR);
     }
     return $ret;
 }