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; }
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; }
public function handle_request_internal() { $post = array('brokerId' => $this->_params["brokerId"], 'planId' => $this->_params["planId"], 'from' => APF::get_instance()->get_config('java_api_from')); $url = '/service-ppc/rest/ppc/pausePpc'; $data = Util_CallAPI::get_data_from_java_api($url, $post); if ($data['data']['status'] === 'ok') { $ret = array('status' => 'ok', 'data' => array()); } else { return Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']); } return $ret; }
public function handle_request_internal() { //根据图片ID删除该图片 $this->_params['from'] = APF::get_instance()->get_config('java_api_from'); $api_url = 'image/dels'; $result = Util_CallAPI::get_data_from_java_v3($api_url, $this->_params, false); if ($result['data']['status'] != 'ok') { return Util_MobileAPI::error_tmp($result['data']['code'], $result['data']['info']); } $r = array('status' => 'ok', 'data' => array()); return $r; }
public function handle_request_internal() { $propId = $this->_params['propId']; $url = '/service-ppc/rest/hp/hplanOnlineInfo?propId=' . $propId; $data = Util_CallAPI::get_data_from_java_api($url); if ($data['http_code'] == 200) { $ret = array('status' => 'ok', 'data' => round($data['data']['planOnlineInfo']['minOffer'] / 100, 2)); } else { $ret = Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']); } return $ret; }
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; }
public function handle_request_internal() { $planid = $this->_params['planid']; $url = '/service-ppc/rest/ppc/getPpcPlan/' . $planid . '?resType=1'; $data = Util_CallAPI::get_data_from_java_api($url); if ($data) { unset($data['data']['status']); $ret = array('status' => 'ok', 'data' => $data['data']); } else { $ret = Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']); } return $ret; }
public function handle_request_internal() { header("Content-type:text/html;charset=utf-8"); 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); if (isset($params['status']) and $params['status'] === 'error') { return $params; } //$api_url = '/service-ppc/rest/ppc/properties/add'; $brokerId = $this->_params['brokerId']; $api_url = 'rent/properties/add?json=1'; $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']); $proid = $result['data']['id']; if (empty($proid)) { $proid = $result['data']['action']['proid']; } if ($imageJson) { foreach ($imageJson as $img) { $api_url = 'image/addImg'; $img_params['brokerId'] = $brokerId; $img_params['propId'] = $proid; //type:1-室内图 2-房型图 3-小区图 $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; return $return; }
public function handle_request_combo() { $brokerId = $this->brokerId; $propIds = $this->_params['propIds']; $cityId = $this->cityId; if (!is_array($propIds)) { $propIds = strstr($propIds, ",") === false ? array($propIds) : explode(',', $propIds); } // 房源有效性验证等 $prop = Model_House_HzProp::getPropsByPropIds($propIds); if (empty($prop)) { throw new Exception('房源不存在'); } if (!Bll_Combo_HouseRelation::houseStopComboSpread($brokerId, $cityId, $propIds, Bll_Combo_HouseRelation::SITE_TYPE_HZ)) { Util_MobileAPI::error_tmp('-1', '套餐推广取消失败'); } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('msg' => '套餐推广取消成功')); }
public function handle_request_internal() { $brokerId = $this->_params["brokerId"]; $planId = $this->_params["planId"]; if (empty($planId)) { $planInfo = Model_Plan_EsfFixedPlan::getValidPlan($brokerId); $planId = $planInfo['id']; } $post = array('brokerId' => $brokerId, 'planId' => $planId, 'from' => APF::get_instance()->get_config('java_api_from')); $url = '/service-ppc/rest/ppc/restartPpc'; $data = Util_CallAPI::get_data_from_java_api($url, $post); if ($data['data']['status'] === 'ok') { $ret = array('status' => 'ok', 'data' => array()); } else { return Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']); } return $ret; }
public function handle_request_combo() { $propIds = $this->_params['propIds']; $brokerId = $this->brokerId; $cityId = $this->cityId; if (!is_array($propIds)) { $propIds = strstr($propIds, ",") === false ? array($propIds) : explode(',', $propIds); } // 房源有效性验证等 $prop = Model_House_HzProp::getPropsByPropIds($propIds); $newPropIds = array(); // 验证房源是否已经被删除 foreach ($prop as $propId => $value) { if ($value['status'] > 0 && !in_array($value['status'], array(6, 99, 100))) { $newPropIds[$propId] = $propId; } } if (empty($newPropIds)) { throw new Exception('房源不存在'); } $result = Bll_Combo_HouseRelation::houseStartComboSpreadV2($brokerId, $cityId, $newPropIds, Bll_Combo_HouseRelation::SITE_TYPE_HZ); if ($result['status'] == 1) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('msg' => '套餐立即推广成功')); } else { switch ($result['status']) { case -1: $msg = '尚未购买套餐,请购买套餐'; break; case -2: $msg = '尚未购买套餐,请购买套餐'; break; case -4: $msg = '推广房源数超过上限'; break; case -5: $msg = '推广房源数超过上限'; break; default: $msg = $result['msg']; } return Util_MobileAPI::error_tmp($result['status'], $msg); } }
public function handle_request_internal() { if (!$this->ip_check()) { return Util_MobileAPI::error_tmp('ip_invalid', $this->error_map('ip_invalid')); } if (!isset($this->_params['user_id'])) { return Util_MobileAPI::error_tmp('user_id_miss', $this->error_map('user_id_miss')); } if (!$this->check_msg_code($this->_params['msg_code'])) { return Util_MobileAPI::error_tmp('msg_code_invalid', $this->error_map('msg_code_invalid')); } $user_id = $this->_params['user_id']; $msg_code = $this->_params['msg_code']; $addon = $this->_params['addon'] ?: ''; $from = $this->_params['from'] ?: ''; $msg = $this->gen_msg($user_id, $msg_code, $addon, $from); $redis = $this->get_redis(); try { //添加逻辑判断待发送信息的经纪人是否开通微聊 $activeBorker = Model_Mobile_BrokerChatInfo::getActiveBroker($user_id, array('chatId')); if (empty($activeBorker)) { $redis->lPush($this->queue_name, $msg); } else { //添加发送公众号信息逻辑 //发送公众号信息 if ($activeBorker['chatId']) { $msg_map = APF::get_instance()->get_config('msg_conf', 'mobile_api'); $text = $msg_map[$msg_code]; if ($msg_code === 'BROKER_PLAN_LIMIT') { //定价计划限额到达需要特殊处理。 $text = $addon . $text; } apf_require_class('Bll_Chat'); $result = Bll_Chat::sendPublicMsg($activeBorker['chatId'], $text); } } } catch (RedisException $e) { return Util_MobileAPI::error_tmp('push_failed', $e->getMessage()); } return array('status' => 'ok', 'data' => '操作成功'); }
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; }
private function write_redis($user_id, $msg_code, $addon = '', $from = '') { $redis = $this->get_redis(); $msg = $this->gen_msg($user_id, $msg_code, $addon, $from); try { $redis->lPush('ajk-broker-mobile-msg', $msg); } catch (RedisException $e) { return Util_MobileAPI::error_tmp('push_failed', $e->getMessage()); } }