Commit 6b5ec2b5 authored by yanghui's avatar yanghui

Merge branch 'dev_yh' into release_dev_107

parents 91283eb8 1db0e3f4
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Esf_center_api extends MY_Controller { class Esf_center_api extends MY_Controller {
var $newrent_host = 'http://newrent.house365.com';
function __construct() function __construct()
{ {
...@@ -17,6 +18,13 @@ class Esf_center_api extends MY_Controller { ...@@ -17,6 +18,13 @@ class Esf_center_api extends MY_Controller {
$this->load->model('rent_coupon_model'); $this->load->model('rent_coupon_model');
$this->city = ''; $this->city = '';
$this->user_id = 0; $this->user_id = 0;
//根据ip是否是127开头判断是否是测试环境
if( substr($_SERVER['REMOTE_ADDR'],0,3) == '127' )
{
$this->newrent_host = 'http://newrentlocal.house365.com';
}
} }
...@@ -113,6 +121,25 @@ class Esf_center_api extends MY_Controller { ...@@ -113,6 +121,25 @@ class Esf_center_api extends MY_Controller {
$telno = $this->input->get('telno'); $telno = $this->input->get('telno');
$uid = $this->user_model->yztelno($telno); $uid = $this->user_model->yztelno($telno);
} }
$url = $this->newrent_host.'/api/tf-app-ext/add-house-collect';
$postData = array(
'house_id' => $this->input->get('rowid'),
'tbl' => $this->input->get('kind') == 3 ? 'sell' : 'rent',
'city' => $this->input->get('city'),
'uid' => $uid,
);
$result = SendDataByCurl($url,$postData);
$result = $result ? json_decode($result,true) : array();
$return = array('result' => 0,'msg' => '收藏失败');
if(!empty($result)){
$return['result'] = $result['code'] == 0 ? 1 : 0;
//utf8转gbk
$msg = $result['msg'] ? mb_convert_encoding($result['msg'], 'gbk', 'utf-8') : '';
$return['msg'] = $msg ? $msg : ($return['result'] == 1 ? '收藏成功' : '收藏失败');
}
echo serialize($return);
die();
$flag = $this->input->get('flag'); $flag = $this->input->get('flag');
if(empty($flag)) if(empty($flag))
{ {
...@@ -127,12 +154,15 @@ class Esf_center_api extends MY_Controller { ...@@ -127,12 +154,15 @@ class Esf_center_api extends MY_Controller {
$city = $this->input->get('city'); $city = $this->input->get('city');
$city = $city?$city:'nj'; $city = $city?$city:'nj';
$tbl=$kind==3?'sell':'rent'; $tbl=$kind==3?'sell':'rent';
$result = $this->user_model->getusercollectid($uid,$rowid,$city); if($uid){
//已关注此房源 $result = $this->user_model->getusercollectid($uid,$rowid,$city);
if($result['id']>0) //已关注此房源
{ if($result['id']>0)
$return = 'N_COL'; {
$return = 'N_COL';
}
} }
if($tbl == 'sell'){ if($tbl == 'sell'){
$houseinfo = $this->house_model->get_data(array('form_name' => $tbl,'where'=>array('id'=>$rowid,'esta'=>'1'),'select'=>array('infotype','infofrom','id','district','address','streetid','blockshowname','room','hall','buildarea','forward','fitment','buildyear','floor','totalfloor','subfloor','price','uid','telno','pic1','contactor','uid','averprice'),'limit'=>1),'esfhousebak'); $houseinfo = $this->house_model->get_data(array('form_name' => $tbl,'where'=>array('id'=>$rowid,'esta'=>'1'),'select'=>array('infotype','infofrom','id','district','address','streetid','blockshowname','room','hall','buildarea','forward','fitment','buildyear','floor','totalfloor','subfloor','price','uid','telno','pic1','contactor','uid','averprice'),'limit'=>1),'esfhousebak');
}else{ }else{
...@@ -968,8 +998,9 @@ class Esf_center_api extends MY_Controller { ...@@ -968,8 +998,9 @@ class Esf_center_api extends MY_Controller {
public function api_getsaveblock() public function api_getsaveblock()
{ {
$telno = $this->input->get('telno'); $telno = $this->input->get('telno');
$base_id = $this->input->get('base_id'); $uid = $this->user_model->yztelno($telno);
if(!$base_id)
if($uid==0)
{ {
echo serialize(array());exit; echo serialize(array());exit;
} }
...@@ -981,8 +1012,8 @@ class Esf_center_api extends MY_Controller { ...@@ -981,8 +1012,8 @@ class Esf_center_api extends MY_Controller {
$page = $page ? $page:1; $page = $page ? $page:1;
$pagesize = $pagesize?$pagesize : 20; $pagesize = $pagesize?$pagesize : 20;
$offset = $pagesize * ($page-1); $offset = $pagesize * ($page-1);
$collect_array = $this->user_model->getcollectByBaseId($kind,$base_id,$offset,$pagesize,$city);
$collect_array = $this->user_model->getcollect($kind,$uid,$offset,$pagesize,$city);
if(!empty($collect_array) && is_array($collect_array)) if(!empty($collect_array) && is_array($collect_array))
{ {
foreach($collect_array as $key=>$value) foreach($collect_array as $key=>$value)
...@@ -1258,36 +1289,56 @@ class Esf_center_api extends MY_Controller { ...@@ -1258,36 +1289,56 @@ class Esf_center_api extends MY_Controller {
$blockid = $this->input->get('id'); $blockid = $this->input->get('id');
$city = $this->input->get('city'); $city = $this->input->get('city');
$city = $city ? $city : 'nj'; $city = $city ? $city : 'nj';
$result = $this->user_model->getusercollectid($uid,$blockid,$city);
//已关注此房源
if( $result > 0 )
{
$msg="已经收藏此小区";
$return_array = array('result'=>'0','data'=>'2','msg'=>$msg);
echo serialize($return_array);
}else{
$url ="http://newrent.house365.com/server-task/agent-crm-insert-record?phone={$_GET['telno']}&city={$city}&activefrom=487&block_name=$blockid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$rs = curl_exec($ch);
curl_close($ch);
}
$blockinfo = $this->user_model->get_data(array('form_name' => 'block','where'=>array('id'=>$blockid,'esta'=>'2'),'limit'=>1),'esfhousebak'); $url = $this->newrent_host.'/api/tf-app-ext/add-block-collect';
$searchcond = serialize($blockinfo[0]); $postData = array(
$this->user_model->addcollect($uid,$blockid,$kind,$searchcond,$city,2); 'bid' => $blockid,
'city' => $city,
$msg="收藏成功"; 'uid' => $uid,
);
//收藏成功,调用接口刷新 $result = SendDataByCurl($url,$postData);
$url = 'http://newrent.house365.com/api/tf-app/refresh-block-list?uid='.$uid.'&city='.$city.'&id='.$blockid; $result = $result ? json_decode($result,true) : array();
curl_get_contents($url); $return = array('result' => 0,'msg' => '收藏失败');
$return_array = array('result'=>'1','data'=>'1','msg'=>$msg); if(!empty($result)){
echo serialize($return_array); $return['result'] = $result['code'] == 0 ? 1 : 0;
//utf8转gbk
$msg = $result['msg'] ? mb_convert_encoding($result['msg'], 'gbk', 'utf-8') : '';
$return['msg'] = $msg ? $msg : ($return['result'] == 1 ? '收藏成功' : '收藏失败');
}
echo serialize($return);
die();
// $result = $this->user_model->getusercollectid($uid,$blockid,$city,$kind);
//
// //已关注此房源
// if( $result > 0 )
// {
// $msg="已经收藏此小区";
// $return_array = array('result'=>'0','data'=>'2','msg'=>$msg);
// echo serialize($return_array);
// }else{
// $url ="http://newrent.house365.com/server-task/agent-crm-insert-record?phone={$_GET['telno']}&city={$city}&activefrom=487&block_name=$blockid";
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_TIMEOUT, 1);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_HEADER, 0);
// $rs = curl_exec($ch);
// curl_close($ch);
// }
//
// $blockinfo = $this->user_model->get_data(array('form_name' => 'block','where'=>array('id'=>$blockid,'esta'=>'2'),'limit'=>1),'esfhousebak');
// $searchcond = serialize($blockinfo[0]);
// $this->user_model->addcollect($uid,$blockid,$kind,$searchcond,$city,2);
//
// $msg="收藏成功";
//
// //收藏成功,调用接口刷新
// $url = 'http://newrent.house365.com/api/tf-app/refresh-block-list?uid='.$uid.'&city='.$city.'&id='.$blockid;
// curl_get_contents($url);
// $return_array = array('result'=>'1','data'=>'1','msg'=>$msg);
// echo serialize($return_array);
} }
/** /**
...@@ -3480,4 +3531,18 @@ class Esf_center_api extends MY_Controller { ...@@ -3480,4 +3531,18 @@ class Esf_center_api extends MY_Controller {
return true; return true;
} }
public function test(){
$transactionId = $_GET['trans_id'];
if(!$transactionId){
echo 'error';exit;
}
$this->load->model("package_model");
$orderInfo = $this->package_model->getOrderInfoByTransactionId($transactionId);
if(empty($orderInfo)){
echo 'no order';exit;
}
$this->sendMsg($orderInfo);
echo 'ok';exit;
}
} }
\ No newline at end of file
...@@ -1868,12 +1868,9 @@ class User extends MY_Controller ...@@ -1868,12 +1868,9 @@ class User extends MY_Controller
}else{ }else{
if($item['property_type'] == $infoType && $item['day'] == $day){ if($item['property_type'] == $infoType && $item['day'] == $day){
$price = $originalPrice = floatval($item['price']); $price = $originalPrice = floatval($item['price']);
//处理折扣
if(GB_CITY == 'wh' && $packageType == 2){ if(isset($item['discount']) && $item['discount'] >0){
//处理折扣 $price = $originalPrice = $this->pirceDiscount($price,$item['discount']);
if(isset($item['discount']) && $item['discount'] >0){
$price = $originalPrice = $this->pirceDiscount($price,$item['discount']);
}
} }
// 列表套餐8折券使用 20200507 // 列表套餐8折券使用 20200507
// 优惠券修改为 6折 // 优惠券修改为 6折
...@@ -2408,19 +2405,22 @@ class User extends MY_Controller ...@@ -2408,19 +2405,22 @@ class User extends MY_Controller
$data['conf_where'] = 'myorder'; $data['conf_where'] = 'myorder';
$data['title'] = '我的订单'; $data['title'] = '我的订单';
$data['qrImg'] = $this->user_model->getBuyQrImg($this->user_id);
$data['pagesize'] = 10;//记录每页的条数 if(1==2) {
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数 $data['pagesize'] = 10;//记录每页的条数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) : 1; // 获取当前页数
$data['totalsize'] = $this->user_model->myorder_count($this->user_id);//记录总数 $data['totalsize'] = $this->user_model->myorder_count($this->user_id);//记录总数
$data['totalpage'] = ceil($data['totalsize']/$data['pagesize']); $data['totalpage'] = ceil($data['totalsize'] / $data['pagesize']);
$orderdata = $this->user_model->myorder_list($this->user_id,$data['page'],$data['pagesize']); $orderdata = $this->user_model->myorder_list($this->user_id, $data['page'], $data['pagesize']);
$invoiceUrlArr = $this->user_model->getInvoiceUrlArr( $orderdata ); $invoiceUrlArr = $this->user_model->getInvoiceUrlArr($orderdata);
$data['orders'] = $orderdata; $data['orders'] = $orderdata;
$data['invoice_url_arr'] = $invoiceUrlArr; $data['invoice_url_arr'] = $invoiceUrlArr;
}
$this->load->view('myorder',$data); $this->load->view('myorder',$data);
} }
......
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
.user-nav a.nav7 {background-position: 13px -695px;} .user-nav a.nav7 {background-position: 13px -695px;}
.user-nav-mod.on a.nav7{background-position: 13px -763px;background-color: #fff;} .user-nav-mod.on a.nav7{background-position: 13px -763px;background-color: #fff;}
.mt10{ margin-top: 10px;} .mt10{ margin-top: 10px;}
/** 二维码 **/
.qr_code{width: 100%;text-align: center;margin-top: 20px;}
.qr_code .title{font-size: 15px;color: #333333;margin-bottom: 30px;font-weight: bold;}
.qr_code .content img{width: 210px;}
</style> </style>
<div class="w960 clearfix mt10 pepcenterBox"> <div class="w960 clearfix mt10 pepcenterBox">
<?php require APPPATH_MVC.'views/left.php'; ?> <?php require APPPATH_MVC.'views/left.php'; ?>
...@@ -21,6 +26,13 @@ ...@@ -21,6 +26,13 @@
<div class="user-main user-main03 mt10"> <div class="user-main user-main03 mt10">
<div class="mod-list statistical"> <div class="mod-list statistical">
<div class="qr_code">
<div class="title">请使用微信扫描下方二维码</div>
<div class="content">
<img src="<?=$qrImg?>"/>
</div>
</div>
<?php if(1==2){?>
<?php if(count($orders)>0){ ?> <?php if(count($orders)>0){ ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-style-a acenter"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-style-a acenter">
<tr> <tr>
...@@ -66,6 +78,7 @@ ...@@ -66,6 +78,7 @@
<div class="no-result">目前您还没有订单哦。</div> <div class="no-result">目前您还没有订单哦。</div>
</div> </div>
<?php }?> <?php }?>
<?php } ?>
</div> </div>
</div> </div>
</form> </form>
......
...@@ -135,7 +135,8 @@ class MY_Model extends CI_Model ...@@ -135,7 +135,8 @@ class MY_Model extends CI_Model
public function findAll() { public function findAll() {
$list = array(); $list = array();
$query = $this->db->get($this->form_name); $query = $this->db->get($this->form_name);
$result = $query->result_array(); // $result = $query->result_array();
$result = $query->num_rows > 0 ? $query->result_array() : array();
$sqls = $this->db->last_query(); $sqls = $this->db->last_query();
//echo "<!--$sqls-->"; //echo "<!--$sqls-->";
//echo $this->db->last_query();exit; //echo $this->db->last_query();exit;
......
...@@ -2,43 +2,43 @@ ...@@ -2,43 +2,43 @@
/** /**
* sendsms($mobile,$msg) * sendsms($mobile,$msg)
* *
* 发送短信 * 发送短信
* @param none * @param none
* @global none * @global none
* @return void * @return void
* @update 2011-10-25 * @update 2011-10-25
*/ */
function sendsms($mobile,$msg,$type='ad',$yzm="") function sendsms($mobile,$msg,$type='ad',$yzm="")
{ {
get_api(API_ESF_SENDSMS."?conf_cityflag=nj&mobile=".$mobile."&msg=".urlencode($msg)."&type=".$type."&ymz=".$yzm); get_api(API_ESF_SENDSMS."?conf_cityflag=nj&mobile=".$mobile."&msg=".urlencode($msg)."&type=".$type."&ymz=".$yzm);
} }
/** /**
* get_api($url, $nocache = 0) * get_api($url, $nocache = 0)
* *
* 接口函数 Fisher 2013-1-12 * 接口函数 Fisher 2013-1-12
*/ */
if(!function_exists('get_api')) if(!function_exists('get_api'))
{ {
function get_api($url,$nocache = 0) function get_api($url,$nocache = 0)
{ {
return curl_get_contents($url,$nocache); return curl_get_contents($url,$nocache);
} }
} }
function curl_get_contents($str,$t_url="") function curl_get_contents($str,$t_url="")
{ {
$ch = curl_init(); $ch = curl_init();
$t_url = $t_url ? $t_url : "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $t_url = $t_url ? $t_url : "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
curl_setopt($ch, CURLOPT_URL, $str); curl_setopt($ch, CURLOPT_URL, $str);
curl_setopt($ch, CURLOPT_REFERER, $t_url); curl_setopt($ch, CURLOPT_REFERER, $t_url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$str = curl_exec($ch); $str = curl_exec($ch);
curl_close($ch); curl_close($ch);
return $str; return $str;
} }
function curl_get_contents_new($str,$t_url="", $cookie = '') function curl_get_contents_new($str,$t_url="", $cookie = '')
{ {
...@@ -61,43 +61,43 @@ function curl_get_contents_new($str,$t_url="", $cookie = '') ...@@ -61,43 +61,43 @@ function curl_get_contents_new($str,$t_url="", $cookie = '')
/** /**
* random($length) * random($length)
* *
* 产生随机数函数 * 产生随机数函数
* @param none * @param none
* @global none * @global none
* @return void * @return void
* @update 2011-10-25 * @update 2011-10-25
*/ */
function random($length) { function random($length) {
$hash = ''; $hash = '';
$chars = '123456789'; $chars = '123456789';
$max = strlen($chars) - 1; $max = strlen($chars) - 1;
for($i = 0; $i < $length; $i++) { for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)]; $hash .= $chars[mt_rand(0, $max)];
} }
return $hash; return $hash;
} }
if(!function_exists('jumpto')) if(!function_exists('jumpto'))
{ {
function jumpto($url, $sec = 1000) function jumpto($url, $sec = 1000)
{ {
echo "<script>setTimeout(function(){window.location.href='".$url."';}, ".$sec.");</script>"; echo "<script>setTimeout(function(){window.location.href='".$url."';}, ".$sec.");</script>";
exit; exit;
} }
} }
if(!function_exists('jumptotk')) if(!function_exists('jumptotk'))
{ {
function jumptotk($url, $message = "执行完毕!", $sec = 3000, $template = "tips") function jumptotk($url, $message = "执行完毕!", $sec = 3000, $template = "tips")
{ {
if($template == 'tips') if($template == 'tips')
{ {
echo '<div class="pop" style="width:390px;height:160px; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;border:1px solid #ccc;"> echo '<div class="pop" style="width:390px;height:160px; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;border:1px solid #ccc;">
<div class="hd" style="height:40px;background:#FF8400"> <div class="hd" style="height:40px;background:#FF8400">
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2> <h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">关闭</a> <a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">关闭</a>
</div> </div>
<div class="bd" style="background:#fff;height:120px"> <div class="bd" style="background:#fff;height:120px">
<div style="width:70px;height:80px;background:url('.USER_CENTER.'images/pop-ico.gif) no-repeat; position:absolute;left:70px;top:60px"></div> <div style="width:70px;height:80px;background:url('.USER_CENTER.'images/pop-ico.gif) no-repeat; position:absolute;left:70px;top:60px"></div>
...@@ -105,25 +105,25 @@ if(!function_exists('jumptotk')) ...@@ -105,25 +105,25 @@ if(!function_exists('jumptotk'))
</div> </div>
</div>'; </div>';
}elseif($template == 'tipswaring'){ }elseif($template == 'tipswaring'){
echo '<div class="pop" style="width:390px;height:160px;border:1px solid #ccc; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;"> echo '<div class="pop" style="width:390px;height:160px;border:1px solid #ccc; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;">
<div class="hd" style="height:40px;background:#FF8400"> <div class="hd" style="height:40px;background:#FF8400">
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2> <h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">关闭</a> <a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('.USER_CENTER.'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''.$url.'\'">关闭</a>
</div> </div>
<div style="width:70px;height:80px;background:url('.USER_CENTER.'images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div> <div style="width:70px;height:80px;background:url('.USER_CENTER.'images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div>
<p style="position:absolute;left:160px;top:85px;font-size:14px">'.$message.'</p> <p style="position:absolute;left:160px;top:85px;font-size:14px">'.$message.'</p>
</div> </div>
</div>'; </div>';
} }
echo "<script>setTimeout(function(){window.location.href='".$url."';}, ".$sec.");</script>"; echo "<script>setTimeout(function(){window.location.href='".$url."';}, ".$sec.");</script>";
exit; exit;
} }
} }
function tel_yc($tel) function tel_yc($tel)
{ {
//隐藏手机号部分数字 //隐藏手机号部分数字
$pattern = "/(1\d{1,2})\d\d(\d{0,3})/"; $pattern = "/(1\d{1,2})\d\d(\d{0,3})/";
$replacement = "\$1****\$3"; $replacement = "\$1****\$3";
...@@ -131,33 +131,33 @@ function tel_yc($tel) ...@@ -131,33 +131,33 @@ function tel_yc($tel)
} }
/*设置登录cookie*/ /*设置登录cookie*/
function vbsetcookie($name,$value="",$permanent=1) { function vbsetcookie($name,$value="",$permanent=1) {
$cookiedomain=".house365.com"; $cookiedomain=".house365.com";
$cookiepath="/"; $cookiepath="/";
if ($permanent) { if ($permanent) {
$expire=time() + 60*60*24*365; $expire=time() + 60*60*24*365;
} else { } else {
$expire = 0; $expire = 0;
} }
setcookie($name, $value, $expire, $cookiepath, $cookiedomain, 0); setcookie($name, $value, $expire, $cookiepath, $cookiedomain, 0);
} }
/*设置cookie,session*/ /*设置cookie,session*/
function setcoandsess($name,$value="",$permanent=1) { function setcoandsess($name,$value="",$permanent=1) {
$cookiedomain=".house365.com"; $cookiedomain=".house365.com";
$cookiepath="/"; $cookiepath="/";
if ($permanent) { if ($permanent) {
$expire=time() + 60*60*24*365; $expire=time() + 60*60*24*365;
} else { } else {
$expire = 0; $expire = 0;
} }
setcookie($name, $value, $expire, $cookiepath, $cookiedomain, 0); setcookie($name, $value, $expire, $cookiepath, $cookiedomain, 0);
$_SESSION[$name] = $value; $_SESSION[$name] = $value;
...@@ -179,11 +179,11 @@ function StrCode($string,$action='ENCODE'){ ...@@ -179,11 +179,11 @@ function StrCode($string,$action='ENCODE'){
/** /**
* GetIP - 获取客户端IP地址 * GetIP - 获取客户端IP地址
* *
* @access public * @access public
* @param none * @param none
* @return string IP地址 * @return string IP地址
*/ */
if ( ! function_exists('get_ip')) if ( ! function_exists('get_ip'))
{ {
...@@ -205,234 +205,234 @@ if ( ! function_exists('get_ip')) ...@@ -205,234 +205,234 @@ if ( ! function_exists('get_ip'))
//南京站根据表名和房源ID获取房源图片存储的表名称 //南京站根据表名和房源ID获取房源图片存储的表名称
if ( ! function_exists('get_upload_tblname')) if ( ! function_exists('get_upload_tblname'))
{ {
function get_upload_tblname($tbl,$id){ function get_upload_tblname($tbl,$id){
if(GB_CITY == 'wh'){ if(GB_CITY == 'wh'){
if($tbl == 'sell' && $id < 10310000) return 'upload'; if($tbl == 'sell' && $id < 10310000) return 'upload';
if($tbl == 'rent' && $id < 1577000) return 'upload'; if($tbl == 'rent' && $id < 1577000) return 'upload';
if($tbl == 'sell' && ($id >= 10310000 && $id < 15591000)) return 'upload1'; if($tbl == 'sell' && ($id >= 10310000 && $id < 15591000)) return 'upload1';
if($tbl == 'rent' && ($id >= 1577000 && $id < 1809000)) return 'upload1'; if($tbl == 'rent' && ($id >= 1577000 && $id < 1809000)) return 'upload1';
return 'upload2'; return 'upload2';
} }
if(GB_CITY !='nj') return 'upload'; if(GB_CITY !='nj') return 'upload';
if($tbl == 'sell' && $id < 23972101) return 'upload0'; if($tbl == 'sell' && $id < 23972101) return 'upload0';
if($tbl == 'rent' && $id < 11907211) return 'upload0'; if($tbl == 'rent' && $id < 11907211) return 'upload0';
if($tbl == 'sell' && ($id >= 23972101 && $id < 27029364)) return 'upload1'; if($tbl == 'sell' && ($id >= 23972101 && $id < 27029364)) return 'upload1';
if($tbl == 'rent' && ($id >= 11907211 && $id < 13224200)) return 'upload1'; if($tbl == 'rent' && ($id >= 11907211 && $id < 13224200)) return 'upload1';
if($tbl == 'sell' && ($id >= 27029364 && $id < 31695721)) return 'upload2'; if($tbl == 'sell' && ($id >= 27029364 && $id < 31695721)) return 'upload2';
if($tbl == 'rent' && ($id >= 13224200 && $id < 14495163)) return 'upload2'; if($tbl == 'rent' && ($id >= 13224200 && $id < 14495163)) return 'upload2';
if($tbl == 'sell' && ($id >= 31695721 && $id < 34963370)) return 'upload3'; if($tbl == 'sell' && ($id >= 31695721 && $id < 34963370)) return 'upload3';
if($tbl == 'rent' && ($id >= 14495163 && $id < 15172611)) return 'upload3'; if($tbl == 'rent' && ($id >= 14495163 && $id < 15172611)) return 'upload3';
if($tbl == 'sell' && ($id >= 34963370 && $id < 38640564)) return 'upload4'; if($tbl == 'sell' && ($id >= 34963370 && $id < 38640564)) return 'upload4';
if($tbl == 'rent' && ($id >= 15172611 && $id < 15871631)) return 'upload4'; if($tbl == 'rent' && ($id >= 15172611 && $id < 15871631)) return 'upload4';
if($tbl == 'sell' && ($id >= 38640564 && $id < 42138930)) return 'upload5'; if($tbl == 'sell' && ($id >= 38640564 && $id < 42138930)) return 'upload5';
if($tbl == 'rent' && ($id >= 15871631 && $id < 16675751)) return 'upload5'; if($tbl == 'rent' && ($id >= 15871631 && $id < 16675751)) return 'upload5';
if($tbl == 'sell' && ($id >= 42138930 && $id < 45947999)) return 'upload'; if($tbl == 'sell' && ($id >= 42138930 && $id < 45947999)) return 'upload';
if($tbl == 'rent' && ($id >= 16675751 && $id < 43871899)) return 'upload'; if($tbl == 'rent' && ($id >= 16675751 && $id < 43871899)) return 'upload';
if($tbl == 'sell' && ($id >= 45947999 && $id < 49830000)) return 'upload6'; if($tbl == 'sell' && ($id >= 45947999 && $id < 49830000)) return 'upload6';
//49825505 //49825505
if($tbl == 'rent' && ($id >= 43871899 && $id < 45040000)) return 'upload6'; if($tbl == 'rent' && ($id >= 43871899 && $id < 45040000)) return 'upload6';
//45038726 //45038726
if($tbl == 'sell' && ($id >= 49830000 && $id < 54705651)) return 'upload7'; if($tbl == 'sell' && ($id >= 49830000 && $id < 54705651)) return 'upload7';
//54703651 //54703651
if($tbl == 'rent' && ($id >= 45040000 && $id < 45788862)) return 'upload7'; if($tbl == 'rent' && ($id >= 45040000 && $id < 45788862)) return 'upload7';
//45787862 //45787862
if($tbl == 'sell' && ($id >= 54705651 && $id < 58020733)) return 'upload8'; if($tbl == 'sell' && ($id >= 54705651 && $id < 58020733)) return 'upload8';
//58018737 //58018737
if($tbl == 'rent' && ($id >= 45788862 && $id < 46230598)) return 'upload8'; if($tbl == 'rent' && ($id >= 45788862 && $id < 46230598)) return 'upload8';
//46229598 //46229598
if($tbl == 'sell' && ($id >= 58020733 && $id < 61223139)) return 'upload9'; if($tbl == 'sell' && ($id >= 58020733 && $id < 61223139)) return 'upload9';
//61221139 //61221139
if($tbl == 'rent' && ($id >= 46230598 && $id < 46633747)) return 'upload9'; if($tbl == 'rent' && ($id >= 46230598 && $id < 46633747)) return 'upload9';
//46633347 //46633347
if($tbl == 'sell' && ($id >= 61223139 && $id < 63983200)) return 'upload10'; if($tbl == 'sell' && ($id >= 61223139 && $id < 63983200)) return 'upload10';
//63981991 //63981991
if($tbl == 'rent' && ($id >= 46633747 && $id < 46923000)) return 'upload10'; if($tbl == 'rent' && ($id >= 46633747 && $id < 46923000)) return 'upload10';
//46922654 //46922654
if($tbl == 'sell' && ($id >= 63983200 && $id < 66893902)) return 'upload11'; if($tbl == 'sell' && ($id >= 63983200 && $id < 66893902)) return 'upload11';
//66892902 //66892902
if($tbl == 'rent' && ($id >= 46923000 && $id < 47264784)) return 'upload11'; if($tbl == 'rent' && ($id >= 46923000 && $id < 47264784)) return 'upload11';
//47264284 //47264284
if($tbl == 'sell' && ($id >= 66893902 && $id < 71182067)) return 'upload12'; if($tbl == 'sell' && ($id >= 66893902 && $id < 71182067)) return 'upload12';
//71181067 //71181067
if($tbl == 'rent' && ($id >= 47264784 && $id < 47951200)) return 'upload12'; if($tbl == 'rent' && ($id >= 47264784 && $id < 47951200)) return 'upload12';
//47950659 //47950659
if($tbl == 'sell' && ($id >= 71182067 && $id < 76015831)) return 'upload13'; if($tbl == 'sell' && ($id >= 71182067 && $id < 76015831)) return 'upload13';
//76014531 //76014531
if($tbl == 'rent' && ($id >= 47951200 && $id < 48556731)) return 'upload13'; //48556231 if($tbl == 'rent' && ($id >= 47951200 && $id < 48556731)) return 'upload13'; //48556231
if($tbl == 'sell' && ($id >= 76015831 && $id < 81507192)) return 'upload14'; if($tbl == 'sell' && ($id >= 76015831 && $id < 81507192)) return 'upload14';
//81506192 //81506192
if($tbl == 'rent' && ($id >= 48556731 && $id < 49140972)) return 'upload14'; //49140466 if($tbl == 'rent' && ($id >= 48556731 && $id < 49140972)) return 'upload14'; //49140466
if($tbl == 'sell' && ($id >= 81507192 && $id < 88723014)) return 'upload15'; if($tbl == 'sell' && ($id >= 81507192 && $id < 88723014)) return 'upload15';
//88722131 //88722131
if($tbl == 'rent' && ($id >= 49140972 && $id < 49884209)) return 'upload15'; if($tbl == 'rent' && ($id >= 49140972 && $id < 49884209)) return 'upload15';
//49883609 //49883609
if($tbl == 'sell' && ($id >= 88723014 && $id < 95316101)) return 'upload16'; if($tbl == 'sell' && ($id >= 88723014 && $id < 95316101)) return 'upload16';
//95314101 //95314101
if($tbl == 'rent' && ($id >= 49884209 && $id < 50532293)) return 'upload16'; if($tbl == 'rent' && ($id >= 49884209 && $id < 50532293)) return 'upload16';
//50531293 //50531293
if($tbl == 'sell' && ($id >= 95316101 && $id < 103859999)) return 'upload17'; if($tbl == 'sell' && ($id >= 95316101 && $id < 103859999)) return 'upload17';
//103819999 //103819999
if($tbl == 'rent' && ($id >= 50532293 && $id < 51527468)) return 'upload17'; if($tbl == 'rent' && ($id >= 50532293 && $id < 51527468)) return 'upload17';
//51527468 //51527468
if($tbl == 'sell' && ($id >= 103859999 && $id < 108815839)) return 'upload18'; if($tbl == 'sell' && ($id >= 103859999 && $id < 108815839)) return 'upload18';
//108806111 //108806111
if($tbl == 'rent' && ($id >= 51527468 && $id < 52249156)) return 'upload18'; if($tbl == 'rent' && ($id >= 51527468 && $id < 52249156)) return 'upload18';
//52239180 //52239180
if($tbl == 'sell' && ($id >= 108815839 && $id < 114379999)) return 'upload19'; if($tbl == 'sell' && ($id >= 108815839 && $id < 114379999)) return 'upload19';
if($tbl == 'rent' && ($id >= 52249156 && $id < 53130499)) return 'upload19'; if($tbl == 'rent' && ($id >= 52249156 && $id < 53130499)) return 'upload19';
if($tbl == 'sell' && ($id >= 114379999 && $id < 119229999)) return 'upload20'; if($tbl == 'sell' && ($id >= 114379999 && $id < 119229999)) return 'upload20';
if($tbl == 'rent' && ($id >= 53130499 && $id < 53780499)) return 'upload20'; if($tbl == 'rent' && ($id >= 53130499 && $id < 53780499)) return 'upload20';
if($tbl == 'sell' && ($id >= 119229999 && $id < 123619999)) return 'upload21'; if($tbl == 'sell' && ($id >= 119229999 && $id < 123619999)) return 'upload21';
if($tbl == 'rent' && ($id >= 53780499 && $id < 54659999)) return 'upload21'; if($tbl == 'rent' && ($id >= 53780499 && $id < 54659999)) return 'upload21';
if($tbl == 'sell' && ($id >= 123619999 && $id < 128434999)) return 'upload22'; if($tbl == 'sell' && ($id >= 123619999 && $id < 128434999)) return 'upload22';
if($tbl == 'rent' && ($id >= 54659999 && $id < 55793999)) return 'upload22'; if($tbl == 'rent' && ($id >= 54659999 && $id < 55793999)) return 'upload22';
if($tbl == 'sell' && ($id >= 128434999 && $id < 132662039)) return 'upload23'; if($tbl == 'sell' && ($id >= 128434999 && $id < 132662039)) return 'upload23';
if($tbl == 'rent' && ($id >= 55793999 && $id < 56609929)) return 'upload23'; if($tbl == 'rent' && ($id >= 55793999 && $id < 56609929)) return 'upload23';
if($tbl == 'sell' && ($id >= 132662039 && $id < 136312505)) return 'upload24'; if($tbl == 'sell' && ($id >= 132662039 && $id < 136312505)) return 'upload24';
if($tbl == 'rent' && ($id >= 56609929 && $id < 57307409)) return 'upload24'; if($tbl == 'rent' && ($id >= 56609929 && $id < 57307409)) return 'upload24';
if($tbl == 'sell' && ($id >= 136312505 && $id < 140145507)) return 'upload25'; if($tbl == 'sell' && ($id >= 136312505 && $id < 140145507)) return 'upload25';
if($tbl == 'rent' && ($id >= 57307409 && $id < 58017786)) return 'upload25'; if($tbl == 'rent' && ($id >= 57307409 && $id < 58017786)) return 'upload25';
if($tbl == 'sell' && ($id >= 140145507 && $id < 147125418)) return 'upload26'; if($tbl == 'sell' && ($id >= 140145507 && $id < 147125418)) return 'upload26';
if($tbl == 'rent' && ($id >= 58017786 && $id < 59209979)) return 'upload26'; if($tbl == 'rent' && ($id >= 58017786 && $id < 59209979)) return 'upload26';
if($tbl == 'sell' && ($id >= 147125418 && $id < 154138704)) return 'upload27'; if($tbl == 'sell' && ($id >= 147125418 && $id < 154138704)) return 'upload27';
if($tbl == 'rent' && ($id >= 59209979 && $id < 60562010)) return 'upload27'; if($tbl == 'rent' && ($id >= 59209979 && $id < 60562010)) return 'upload27';
if($tbl == 'sell' && ($id >= 154138704 && $id < 166754880)) return 'upload28'; if($tbl == 'sell' && ($id >= 154138704 && $id < 166754880)) return 'upload28';
if($tbl == 'rent' && ($id >= 60562010 && $id < 63483875)) return 'upload28'; if($tbl == 'rent' && ($id >= 60562010 && $id < 63483875)) return 'upload28';
if($tbl == 'sell' && ($id >= 166754880 && $id < 264744742)) return 'upload29'; if($tbl == 'sell' && ($id >= 166754880 && $id < 264744742)) return 'upload29';
if($tbl == 'rent' && ($id >= 63483875 && $id < 84955643)) return 'upload29'; if($tbl == 'rent' && ($id >= 63483875 && $id < 84955643)) return 'upload29';
if($tbl == 'sell' && ($id >= 264744742 && $id < 271465540)) return 'upload30'; if($tbl == 'sell' && ($id >= 264744742 && $id < 271465540)) return 'upload30';
if($tbl == 'rent' && ($id >= 84955643 && $id < 86646071)) return 'upload30'; if($tbl == 'rent' && ($id >= 84955643 && $id < 86646071)) return 'upload30';
if($tbl == 'sell' && ($id >= 271465540 && $id < 282952050)) return 'upload31'; if($tbl == 'sell' && ($id >= 271465540 && $id < 282952050)) return 'upload31';
if($tbl == 'rent' && ($id >= 86646071 && $id < 89874731)) return 'upload31'; if($tbl == 'rent' && ($id >= 86646071 && $id < 89874731)) return 'upload31';
if($tbl == 'sell' && ($id >= 282952050 && $id < 288033939)) return 'upload32'; if($tbl == 'sell' && ($id >= 282952050 && $id < 288033939)) return 'upload32';
if($tbl == 'rent' && ($id >= 89874731 && $id < 91709557)) return 'upload32'; if($tbl == 'rent' && ($id >= 89874731 && $id < 91709557)) return 'upload32';
if($tbl == 'sell' && ($id >= 288033939 && $id < 289572177)) return 'upload33'; if($tbl == 'sell' && ($id >= 288033939 && $id < 289572177)) return 'upload33';
if($tbl == 'rent' && ($id >= 91709557 && $id < 92295581)) return 'upload33'; if($tbl == 'rent' && ($id >= 91709557 && $id < 92295581)) return 'upload33';
if($tbl == 'sell' && ($id >= 289572177 && $id < 332826911)) return 'upload34'; if($tbl == 'sell' && ($id >= 289572177 && $id < 332826911)) return 'upload34';
if($tbl == 'rent' && ($id >= 92295581 && $id < 105588509)) return 'upload34'; if($tbl == 'rent' && ($id >= 92295581 && $id < 105588509)) return 'upload34';
return 'upload35'; return 'upload35';
} }
} }
/** /**
* 获取二手房的房源地址 * 获取二手房的房源地址
* @param array $row 房源信息,必须含有id * @param array $row 房源信息,必须含有id
* @return stirng * @return stirng
*/ */
if(!function_exists('get_sellinfo_url')) if(!function_exists('get_sellinfo_url'))
{ {
function get_sellinfo_url($row) function get_sellinfo_url($row)
{ {
if(is_array($row)) { if(is_array($row)) {
if(!empty($row['ID']))$row['id']=$row['ID']; if(!empty($row['ID']))$row['id']=$row['ID'];
$ss = GB_SELL_URL."/s_".$row['id'].".html"; $ss = GB_SELL_URL."/s_".$row['id'].".html";
}else{ }else{
$ss = GB_SELL_URL."/s_".$row.".html"; $ss = GB_SELL_URL."/s_".$row.".html";
} }
return $ss; return $ss;
} }
} }
/** /**
* 获取求购地址 * 获取求购地址
* @param array $row 房源信息,必须含有id * @param array $row 房源信息,必须含有id
* @return stirng * @return stirng
*/ */
if(!function_exists('get_buyinfo_url')) if(!function_exists('get_buyinfo_url'))
{ {
function get_buyinfo_url($row) function get_buyinfo_url($row)
{ {
if(is_array($row)) { if(is_array($row)) {
if(!empty($row['ID']))$row['id']=$row['ID']; if(!empty($row['ID']))$row['id']=$row['ID'];
$ss = $GB_SELL_URL."/b_".$row['id'].".html"; $ss = $GB_SELL_URL."/b_".$row['id'].".html";
} else { } else {
$ss = $GB_SELL_URL."/b_".$row.".html"; $ss = $GB_SELL_URL."/b_".$row.".html";
} }
return $ss; return $ss;
} }
} }
/** /**
* 获取租房的房源地址 * 获取租房的房源地址
* @param array $row 房源信息,必须含有id * @param array $row 房源信息,必须含有id
* @return stirng * @return stirng
*/ */
if(!function_exists('get_rentinfo_url')) if(!function_exists('get_rentinfo_url'))
{ {
function get_rentinfo_url($row,$pre = 'r') //房源地址 function get_rentinfo_url($row,$pre = 'r') //房源地址
{ {
if(is_array($row)) { if(is_array($row)) {
if(!empty($row['ID'])) $id = $row['ID']; if(!empty($row['ID'])) $id = $row['ID'];
...@@ -448,78 +448,78 @@ if(!function_exists('get_rentinfo_url')) ...@@ -448,78 +448,78 @@ if(!function_exists('get_rentinfo_url'))
} }
/** /**
* 获取问答地址 * 获取问答地址
* @param array $qid * @param array $qid
* @return stirng * @return stirng
*/ */
if(!function_exists('get_questioninfo_url')) if(!function_exists('get_questioninfo_url'))
{ {
function get_questioninfo_url($qid) //房源地址 function get_questioninfo_url($qid) //房源地址
{ {
$ss = GB_SELL_URL."/ask_".$qid.".html"; $ss = GB_SELL_URL."/ask_".$qid.".html";
return $ss; return $ss;
} }
} }
/** /**
* 获取小区地址 * 获取小区地址
* @param array $id * @param array $id
* @return stirng * @return stirng
*/ */
function get_blockinfo_url($id) function get_blockinfo_url($id)
{ {
$ss = GB_SELL_URL."/community_id".$id."/"; $ss = GB_SELL_URL."/community_id".$id."/";
return $ss; return $ss;
} }
/** /**
*获取学校地址 *获取学校地址
*@param int $id *@param int $id
*@return string *@return string
*/ */
function get_school_url($id){ function get_school_url($id){
$url = GB_SELL_URL."/school_id".$id."/"; $url = GB_SELL_URL."/school_id".$id."/";
return $url; return $url;
} }
/**
*获取学校小区地址
*@param int $id
*@return string
*/
function get_schoolblock_url($id){
$url = GB_SELL_URL."/school_id".$id."/community.html";
return $url;
}
/**
*获取学校二手房地址
*@param int $id
*@return string
*/
function get_schoolsell_url($id){
$url = GB_SELL_URL."/school_id".$id."/sell.html";
return $url;
}
/**
*获取学校租房地址
*@param int $id
*@return string
*/
function get_schoolrent_url($id){
$url = GB_SELL_URL."/school_id".$id."/rent.html";
return $url;
}
/**
*获取学校小区地址
*@param int $id
*@return string
*/
function get_schoolblock_url($id){
$url = GB_SELL_URL."/school_id".$id."/community.html";
return $url;
}
/**
*获取学校二手房地址
*@param int $id
*@return string
*/
function get_schoolsell_url($id){
$url = GB_SELL_URL."/school_id".$id."/sell.html";
return $url;
}
/** /**
* 判断值是否为数组 *获取学校租房地址
*@param int $id
*@return string
*/
function get_schoolrent_url($id){
$url = GB_SELL_URL."/school_id".$id."/rent.html";
return $url;
}
/**
* 判断值是否为数组
* @param array $arrValue * @param array $arrValue
* @return bool true or false * @return bool true or false
* @author sun * @author sun
...@@ -529,11 +529,11 @@ function isFullArray($arrValue) { ...@@ -529,11 +529,11 @@ function isFullArray($arrValue) {
} }
/** /**
* time_tran 距离现在时间多久 * time_tran 距离现在时间多久
* *
* @param string $the_time 时间参数 * @param string $the_time 时间参数
* @return string 描述字符串 * @return string 描述字符串
*/ */
function time_tran ($the_time) { function time_tran ($the_time) {
$now_time = time(); $now_time = time();
...@@ -543,22 +543,22 @@ function time_tran ($the_time) { ...@@ -543,22 +543,22 @@ function time_tran ($the_time) {
$str = $the_time; $str = $the_time;
}else{ }else{
if($dur < 60){ if($dur < 60){
$str = $dur.'秒前'; $str = $dur.'秒前';
}else if($dur < 3600){ }else if($dur < 3600){
$str = floor($dur/60).'分钟前'; $str = floor($dur/60).'分钟前';
}else if($dur < 86400){ }else if($dur < 86400){
$str = floor($dur/3600).'小时前'; $str = floor($dur/3600).'小时前';
}else if($dur < 259200){ }else if($dur < 259200){
$str = floor($dur/86400).'天前'; $str = floor($dur/86400).'天前';
}else if($dur > 259200){ }else if($dur > 259200){
$str = date('Y-m-d H:i',$the_time); $str = date('Y-m-d H:i',$the_time);
} }
} }
return $str; return $str;
} }
//加密,解密函数 FISHER 2014-3-5 //加密,解密函数 FISHER 2014-3-5
function passport_encrypt($txt, $key='fisher.house365.com') { function passport_encrypt($txt, $key='fisher.house365.com') {
srand((double)microtime() * 1000000); srand((double)microtime() * 1000000);
$encrypt_key = md5(rand(0, 32000)); $encrypt_key = md5(rand(0, 32000));
...@@ -593,36 +593,36 @@ function passport_key($txt, $encrypt_key) { ...@@ -593,36 +593,36 @@ function passport_key($txt, $encrypt_key) {
function check_input($value) function check_input($value)
{ {
// 去除斜杠 // 去除斜杠
if (get_magic_quotes_gpc()) if (get_magic_quotes_gpc())
{ {
$value = stripslashes($value); $value = stripslashes($value);
} }
// 如果不是数字则加引号 // 如果不是数字则加引号
if (!is_numeric($value)) if (!is_numeric($value))
{ {
$value = "'" . mysql_real_escape_string($value) . "'"; $value = "'" . mysql_real_escape_string($value) . "'";
} }
return $value; return $value;
} }
/** /**
* jsonNew 对数据进行gbk转utf8后json编码 json($data) * jsonNew 对数据进行gbk转utf8后json编码 json($data)
* @param mixed $data 需要编码的数据 * @param mixed $data 需要编码的数据
* @return mixed $data_json 编码后的数据 * @return mixed $data_json 编码后的数据
* @ 2012-10-16 xz * @ 2012-10-16 xz
**/ **/
function jsonNew($data,$inChar="GBK",$outChar="UTF-8") { function jsonNew($data,$inChar="GBK",$outChar="UTF-8") {
if(!$data) return $data; if(!$data) return $data;
$data = strIconv($data,$inChar,$outChar); $data = strIconv($data,$inChar,$outChar);
return json_encode($data); return json_encode($data);
} }
/** /**
* 替换数组编码(支持字符串和多维数组) * 替换数组编码(支持字符串和多维数组)
* @param mixed $strInput * @param mixed $strInput
* @param string $inChar * @param string $inChar
* @param string $outChar * @param string $outChar
...@@ -630,42 +630,42 @@ function jsonNew($data,$inChar="GBK",$outChar="UTF-8") { ...@@ -630,42 +630,42 @@ function jsonNew($data,$inChar="GBK",$outChar="UTF-8") {
*/ */
function strIconv($strInput,$inChar="GBK",$outChar="UTF-8"){ function strIconv($strInput,$inChar="GBK",$outChar="UTF-8"){
if(is_array($strInput)){ if(is_array($strInput)){
$strOutput = array(); $strOutput = array();
foreach($strInput as $key=>$val){ foreach($strInput as $key=>$val){
$key = strIconv($key,$inChar,$outChar); $key = strIconv($key,$inChar,$outChar);
$strOutput[$key] = strIconv($val,$inChar,$outChar); $strOutput[$key] = strIconv($val,$inChar,$outChar);
} }
}else{ }else{
$strOutput = iconv($inChar,$outChar,$strInput); $strOutput = iconv($inChar,$outChar,$strInput);
} }
if($strOutput !== false) if($strOutput !== false)
return $strOutput; return $strOutput;
else else
return $strInput; return $strInput;
} }
//通过curl模拟post的请求; //通过curl模拟post的请求;
function SendDataByCurl($url,$data=array()){ function SendDataByCurl($url,$data=array()){
//对空格进行转义 //对空格进行转义
$url = str_replace(' ','+',$url); $url = str_replace(' ','+',$url);
$ch = curl_init(); $ch = curl_init();
//设置选项,包括URL //设置选项,包括URL
curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_TIMEOUT,3); //定义超时3秒钟 curl_setopt($ch,CURLOPT_TIMEOUT,3); //定义超时3秒钟
// POST数据 // POST数据
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
// 把post的变量加上 // 把post的变量加上
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); //所需传的数组用http_bulid_query()函数处理一下,就ok了 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); //所需传的数组用http_bulid_query()函数处理一下,就ok了
//执行并获取url地址的内容 //执行并获取url地址的内容
$output = curl_exec($ch); $output = curl_exec($ch);
$errorCode = curl_errno($ch); $errorCode = curl_errno($ch);
//释放curl句柄 //释放curl句柄
curl_close($ch); curl_close($ch);
if(0 !== $errorCode) { if(0 !== $errorCode) {
return false; return false;
...@@ -676,19 +676,19 @@ function SendDataByCurl($url,$data=array()){ ...@@ -676,19 +676,19 @@ function SendDataByCurl($url,$data=array()){
function getJiaUserID($uid_str){ function getJiaUserID($uid_str){
$post['userid'] = $uid_str; $post['userid'] = $uid_str;
$personal_api_url = "http://jia.wuhan.house365.com/api/index.php?app=get_passport_uid"; $personal_api_url = "http://jia.wuhan.house365.com/api/index.php?app=get_passport_uid";
$json = SendDataByCurl($personal_api_url,$post); $json = SendDataByCurl($personal_api_url,$post);
$return = (json_decode($json, true)); $return = (json_decode($json, true));
if($return['status']==1){ if($return['status']==1){
return $return['data'][$uid_str]; return $return['data'][$uid_str];
} }
} }
......
...@@ -846,8 +846,11 @@ class User_model extends MY_Model ...@@ -846,8 +846,11 @@ class User_model extends MY_Model
$where_string .= " and kind = $kind"; $where_string .= " and kind = $kind";
} }
$return = $this->get_data(array('form_name' => 'personal_collection','where'=>$where_string,'select'=>array('id')),'esf'); // $return = $this->get_data(array('form_name' => 'personal_collection','where'=>$where_string,'select'=>array('id')),'esf');
$sql = "select id from personal_collection where ".$where_string;
$query = $this->db_esfbak->query($sql);
$return = $query->result_array();
writelog(':查询用户是否收藏: '.print_r($return,1), 'fangliyan_'.date('d') );
if(!empty($return[0])) if(!empty($return[0]))
{ {
return $return[0]; return $return[0];
...@@ -988,6 +991,7 @@ class User_model extends MY_Model ...@@ -988,6 +991,7 @@ class User_model extends MY_Model
//取第一个 //取第一个
$one_base_id = explode(',',$base_id); $one_base_id = explode(',',$base_id);
$arr = array('base_id'=>$one_base_id,'uid'=>$uid,'collect_id'=>$collect_id,'kind'=>$kind,'collect_value'=>$collect_value,'collect_time'=>time(),'city_name'=>$city,'infofrom'=>$infofrom,'passport_uid'=>$passport_uid); $arr = array('base_id'=>$one_base_id,'uid'=>$uid,'collect_id'=>$collect_id,'kind'=>$kind,'collect_value'=>$collect_value,'collect_time'=>time(),'city_name'=>$city,'infofrom'=>$infofrom,'passport_uid'=>$passport_uid);
writelog(':保存收藏addcollect: '.print_r($arr,1), 'fangliyan_'.date('d') );
//设置表 //设置表
$this->user_model->set_table('personal_collection'); $this->user_model->set_table('personal_collection');
//过滤表结构 //过滤表结构
...@@ -6359,7 +6363,7 @@ if($searcharr['infotype']==4){ ...@@ -6359,7 +6363,7 @@ if($searcharr['infotype']==4){
} }
} }
$base_id_url = 'http://localnewrent.house365.com/api/tf-app/get-base-id?keyword='.$passport_uid; $base_id_url = 'http://newrent.house365.com/api/tf-app/get-base-id?keyword='.$passport_uid;
$base_id = curl_get_contents($base_id_url); $base_id = curl_get_contents($base_id_url);
$res = $base_id; $res = $base_id;
...@@ -6380,4 +6384,15 @@ if($searcharr['infotype']==4){ ...@@ -6380,4 +6384,15 @@ if($searcharr['infotype']==4){
return $res; return $res;
} }
//获取用户购买二维码
public function getBuyQrImg($uid){
$url = 'http://newrentlocal.house365.com/api/tf-app-ext/get-order-qrimg?user_id='.$uid;
$result = curl_get_contents($url);
$result = $result ? json_decode($result,1) : array();
if(empty($result) || empty($result['data'])){
return '';
}
return $result['data']['qrimg'];
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment