예제 #1
0
 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;
 }
예제 #2
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;
 }
예제 #3
0
 /**
  * 获得计划的推广信息。
  * @param type $brokerId
  * @param type $planId
  * @return array
  */
 private function get_plan_status_info($brokerId, $planId)
 {
     $api_url = '/service-ppc/rest/ppc/planCost';
     $params['plan_id'] = $planId;
     $params['start_time'] = strtotime(date("Ymd"));
     $params['end_time'] = time();
     $params['type'] = 'daily';
     $status_info = Util_CallAPI::get_data_from_java_api($api_url, $params);
     return $status_info;
 }
예제 #4
0
 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;
 }
예제 #5
0
 public function handle_request_internal()
 {
     $planId = $this->_params['planId'];
     $url = '/service-ppc/rest/ppc/getPpcPlan/' . $planId . '?resType=0';
     $data = Util_CallAPI::get_data_from_java_api($url);
     if ($data['data']['status'] === 'ok') {
         $ret = array('status' => 'ok', 'data' => array('ceiling' => $data['data']['plan']['ceiling']));
     } else {
         //@todo
     }
     return $ret;
 }
예제 #6
0
 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;
 }
예제 #7
0
 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;
 }
예제 #8
0
 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;
 }
예제 #9
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params["brokerId"];
     $planId = $this->_params["planId"];
     if (empty($planId) && !empty($brokerId)) {
         $planInfo = Model_Plan_EsfFixedPlan::getValidPlan($brokerId);
         $planId = $planInfo['id'];
     }
     $post = array('brokerId' => $brokerId, 'planId' => $planId, 'proIds' => $this->_params['propIds']);
     $api_url = '/service-ppc/rest/ppc/planAddProperty';
     $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;
 }
예제 #10
0
 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;
 }
예제 #11
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $plans = Model_Plan_EsfFixedPlan::getValidPlan($brokerId);
     $props = 0;
     $result['status'] = 'ok';
     if (!empty($plans)) {
         $planId = $plans['id'];
         $cityId = $plans['cityid'] ?: 0;
         $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($planId, $cityId);
         if (!empty($relations)) {
             $propIds = array();
             foreach ($relations as $row) {
                 $propIds[] = $row['proId'];
             }
             $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
             $props = count($houseInfo);
         }
         $planBll = new DAO_My_Ppc_PlanOpe();
         $clicks = $planBll->planTodayNewCost($planId);
         $data['planId'] = $planId;
         $data['todayClicks'] = $clicks['allclick'];
         $data['todayConsume'] = Util_Formatter::formatTodayConsume($clicks['allamount']);
         $data['todayConsumeUnit'] = '元';
         $data['totalProps'] = $props;
         //获取计划状态
         $api_url = '/service-ppc/rest/ppc/getPpcPlan/' . $planId . '?resType=1';
         $plan_info = Util_CallAPI::get_data_from_java_api($api_url);
         $data['planStatus'] = $plan_info['data']['plan']['statusDescrip'] == '推广中' ? 1 : 0;
         $limitInfo = Bll_Fixedspread_AjkFixedSpread::getLimitInfo($brokerId);
         $data['budget'] = !empty($limitInfo) ? round($limitInfo['amountLimit'] / 100, 2) : 0;
         $data['budgetUnit'] = '元';
     } else {
         $brokerInfo = Model_Broker_AjkBrokerExtend::getDataByBrokerId($brokerId);
         $planId = Model_Plan_EsfFixedPlan::addPlan('定价推广组', 1, $brokerInfo->cityId, $brokerInfo->userId, $brokerInfo->brokerId);
         $data['planId'] = $planId;
         $data['todayClicks'] = $data['todayConsume'] = $data['totalProps'] = $data['planStatus'] = 0;
         $data['todayConsumeUnit'] = $data['budgetUnit'] = '元';
         $limitInfo = Bll_Fixedspread_AjkFixedSpread::getLimitInfo($brokerId);
         $data['budget'] = !empty($limitInfo) ? round($limitInfo['amountLimit'] / 100, 2) : 0;
     }
     $result['data'] = $data;
     return $result;
 }
예제 #12
0
 /**
  * @return array|string
  * 入参:brokerId/经纪人ID
  * 出参:标准返参
  */
 public function handle_request_internal()
 {
     $brokerId = (int) $this->_params['brokerId'];
     $planId = (int) $this->_params['planId'];
     $ceiling = $this->_params['ceiling'];
     //计划名称。这个名称将会更新为计划的新名称,所以如果不想改名的话务必把计划的本来名字传过来。
     $planname = $this->_params['planname'];
     $post = array('brokerId' => $brokerId, 'planId' => $planId, 'ceiling' => $ceiling * 100, 'planName' => $planname, 'from' => APF::get_instance()->get_config('java_api_from'));
     $url = '/service-ppc/rest/ppc/changeCeiling';
     $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);
         return Util_MobileAPI::error($translate_errcode);
     }
     return $ret;
 }
예제 #13
0
 public function handle_request_internal()
 {
     //上海不让竞价
     $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));
     }
     $post = array('brokerId' => $this->_params["brokerId"], 'propId' => $this->_params["propId"], 'budget' => (int) ($this->_params["budget"] * 100), 'offer' => (int) ($this->_params["offer"] * 100), 'from' => APF::get_instance()->get_config('java_api_from'));
     $url = '/service-ppc/rest/hp/refOpenHPlan';
     $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);
         return Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']);
     }
     return $ret;
 }
예제 #14
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;
 }
예제 #15
0
 public static function get_broker_clicks($city_id, $broker_id, $date = 0)
 {
     $date = empty($date) ? date('Ymd') : $date;
     $api = new Uri_JavaAPI();
     $data = array("cityId" => $city_id, "brokerId" => $broker_id, "startDate" => $date, 'endDate' => $date, 'tradeType' => 3, 'productType' => 3);
     $url = '/service-ppc/rest/ppcbroker/brokerInfoStatistic';
     $result = Util_CallAPI::get_data_from_java_api($url, $data);
     if ($result['data']['status'] != 'ok') {
         $result = Util_CallAPI::get_data_from_java_api($url, $data);
     }
     $total_click = 0;
     $total_consume = 0;
     $total_invalid_click = 0;
     if (!empty($result['data']['statisticInfo']) && $result['data']['status'] == "ok") {
         foreach ($result['data']['statisticInfo'] as $statisticInfo) {
             $total_click = $total_click + $statisticInfo['cnum'];
             $total_consume = $total_consume + $statisticInfo['amount'];
             $total_invalid_click = $total_invalid_click + $statisticInfo['icnum'];
         }
     }
     $return = array("total_click" => $total_click, "total_consume" => round($total_consume / 100, 2), "total_invalid_click" => $total_invalid_click);
     return $return;
 }
예제 #16
0
 public function handle_request_internal()
 {
     $params["j_username"] = trim($this->_params["username"]);
     $params["j_password"] = trim($this->_params["password"]);
     $params["channel"] = 3;
     $api_url = '/service-internal/rest/brokers/login';
     $broker = Util_CallAPI::get_data_from_java_api($api_url, $params);
     if ($broker['data']['status'] != 'ok') {
         if ($broker['data']['code'] == 398213) {
             return Util_MobileAPI::error(Const_APIStatus::E_BROKER_USERPWD_ERR);
         } else {
             return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
         }
     }
     $broker_id = $broker['data']['broker']['brokerId'];
     //获取经纪人信息
     $api_url = "/service-internal/rest/brokers/{$broker_id}";
     $broker_info = Util_CallAPI::get_data_from_java_api($api_url);
     if (empty($broker_info)) {
         $broker_info = array();
     }
     if ($broker_info['data']['status'] == 'error') {
         return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     $broker_info = $broker_info['data'];
     $cityId = isset($broker_info['broker']['cityId']) ? $broker_info['broker']['cityId'] : "";
     if ($cityId > 229) {
         return array('status' => 'error', 'errcode' => "", 'message' => "您所在的城市暂不支持APP服务");
     }
     $broker_return = array('id' => isset($broker_info['broker']['brokerId']) ? $broker_info['broker']['brokerId'] : "", 'city_id' => isset($broker_info['broker']['cityId']) ? $broker_info['broker']['cityId'] : "", 'email' => isset($broker_info['broker']['userEmail']) ? $broker_info['broker']['userEmail'] : "", 'last_log_date' => isset($broker_info['broker']['lastLogDate']) ? $broker_info['broker']['lastLogDate'] : "", 'name' => isset($broker_info['broker']['trueName']) ? $broker_info['broker']['trueName'] : "", 'username' => isset($broker_info['broker']['userName']) ? $broker_info['broker']['userName'] : "", 'phone' => isset($broker_info['broker']['userMobile']) ? $broker_info['broker']['userMobile'] : "", 'use_photo' => isset($broker_info['broker']['userPhoto']) ? $broker_info['broker']['userPhoto'] : "", 'user_type' => isset($broker_info['broker']['userType']) ? $broker_info['broker']['userType'] : "", 'user_id' => isset($broker_info['broker']['userId']) ? $broker_info['broker']['userId'] : "");
     $sid = APF::get_instance()->get_config("sid", "login");
     //单点登录
     $registerBll = new Bll_Register();
     $registerBll->singleSignon($broker_return['user_id'], $broker_return['username'], $sid, $broker_return['user_type']);
     // 生成token
     $token = self::createToken(array($broker_return["id"], $broker_return['username'], time()));
     $broker_return['use_photo'] = Util_ImageUtils::get_broker_photo_url($broker_return['use_photo']);
     $insert_data["token"] = $token;
     $insert_data["user_id"] = $broker_return["id"];
     $insert_data["expired"] = Bll_TokenBiz::get_instance()->get_expire_time();
     $insert_data["app"] = APF::get_instance()->get_config('java_api_from');
     Bll_TokenBiz::get_instance()->insert($insert_data);
     $device_data = array();
     $device_data["user_id"] = $broker_return["id"];
     $device_data["app"] = APF::get_instance()->get_config('java_api_from');
     $device_data["device"] = "";
     $device_data["ismi"] = trim(@$this->_params["imsi"]);
     $device_data["ip"] = APF::get_instance()->get_request()->get_client_ip();
     $device_data["i"] = "";
     $device_data["m"] = "";
     $device_data["o"] = "";
     $device_data["v"] = "";
     $device_data["cv"] = "";
     $device_data["cid"] = "";
     $device_data["pm"] = "";
     $device_data["created"] = date("Y-m-d H:i:s");
     Bll_DeviceBiz::get_instance()->save($device_data);
     $dwStatsBiz = new Bll_DwStatsBiz();
     if (!empty($this->_params["macid"])) {
         $guid = md5(trim($this->_params["macid"]));
         $dwStatsBiz->saveGuid($guid);
     }
     if (!empty($this->_params["uuid"])) {
         $guid = md5(trim($this->_params["uuid"]));
         $dwStatsBiz->saveGuid($guid);
     }
     if (!empty($this->_params["i"])) {
         $guid = md5(trim($this->_params["i"]));
         $dwStatsBiz->saveGuid($guid);
     }
     if (!empty($this->_params["uuid2"])) {
         //ios7兼容
         $guid = md5(trim($this->_params["uuid2"]));
         $dwStatsBiz->saveGuid($guid);
     }
     if (!empty($this->_params["udid2"])) {
         //ios7兼容
         $guid = md5(trim($this->_params["udid2"]));
         $dwStatsBiz->saveGuid($guid);
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']["token"] = $token;
     $return['data']['broker'] = $broker_return;
     //缓存信息到redis
     $redisInfo = array('brokerId' => $broker_info['broker']['brokerId'], 'username' => $broker_info['broker']['trueName'], 'userPhoto' => $broker_return['use_photo'], 'cityId' => $broker_info['broker']['cityId']);
     Bll_Commsign::redisBrokerInfo($broker_info['broker']['brokerId'], $redisInfo);
     return $return;
 }
예제 #17
0
 /**
  * 获得竞价计划信息。
  * @param int $propId
  * @return array
  */
 private function get_hpplan_info($propId)
 {
     $url = '/service-ppc/rest/hp/hplanInfo?propId=' . $propId . '&resType=0';
     $data = Util_CallAPI::get_data_from_java_api($url);
     return $data['data']['planProp'][0];
 }
예제 #18
0
 /**
  * 获得房源的竞价计划相关信息。
  * @param int $propId
  * @return array
  */
 public static function get_ajk_prop_hplan($propId)
 {
     $api_url = '/service-ppc/rest/hp/hplanInfo?propId=' . $propId . '&resType=1';
     $plan_info = Util_CallAPI::get_data_from_java_api($api_url);
     if ($plan_info['data']['status'] == 'ok') {
         $ret = $plan_info['data']['planProp'][0];
     } else {
         $ret = array();
     }
     return $ret;
 }