Commit 0c0e58f5 authored by fangliyan's avatar fangliyan

小区收藏

parent 8fc65ccd
......@@ -1289,36 +1289,56 @@ class Esf_center_api extends MY_Controller {
$blockid = $this->input->get('id');
$city = $this->input->get('city');
$city = $city ? $city : 'nj';
$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);
$url = $this->newrent_host.'/api/tf-app-ext/add-block-collect';
$postData = array(
'bid' => $blockid,
'city' => $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();
$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);
// $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);
}
/**
......
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