예제 #1
0
 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;
 }
예제 #2
0
 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;
 }