Commit 5e32b837 authored by fangliyan's avatar fangliyan

合并分支 'subscribe2.0' 到 'release'

Subscribe2.0

查看合并请求 !30
parents 2e0d36c7 f2b00bc3
...@@ -289,6 +289,109 @@ class Esf_center_api extends MY_Controller { ...@@ -289,6 +289,109 @@ class Esf_center_api extends MY_Controller {
echo serialize($return_array); echo serialize($return_array);
} }
/**
* 关注房源操作接口,base_id版本
* @author fly
*/
public function save_house_focus_by_baseId()
{
$return ='';
$passport_uid = $this->input->get('passport_uid');
$uid=0;
$flag = $this->input->get('flag');
if($passport_uid){
//根据passport_uid获取uid
$uid = $this->user_model->getUidByPassportId($passport_uid);
if(empty($flag))
{
$flag = 2;
}
if($uid==0)
{
$return = 'N_USER';
}
}
$kind = $this->input->get('kind');
$rowid = $this->input->get('rowid');
$city = $this->input->get('city');
$phone = $this->input->get('phone');
$base_id = $this->input->get('base_id');
$city = $city?$city:'nj';
$tbl=$kind==3?'sell':'rent';
$result = $this->user_model->getCollectHouseIdByBaseID($base_id,$kind,$rowid,$city);
//已关注此房源
if($result['id']>0)
{
$return = 'N_COL';
}
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'),'limit'=>1),'esfhousebak');
}else{
$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','priceunit','renttype'),'limit'=>1),'esfhousebak');
}
if(empty($houseinfo[0]) && $city=='nj')
{
$return = 'N_HOU';
}elseif($return != 'N_COL'){
if(!empty($houseinfo[0]))
{
$searchcond = serialize($houseinfo[0]);
}else{
$searchcond = '';
}
$return = $this->user_model->addcollectByBaseID($base_id,$rowid,$kind,$searchcond,$city,$flag,$passport_uid,$uid);
}
if($return == 'N_COL'){
$result = 2;
$msg = '已收藏此房源';
}elseif($return == 'N_HOU'){
$result = 3;
$msg = '无此房源';
}elseif($return == 'N_USER'){
$result = 4;
$msg = '无此用户';
}elseif($return > 0){
$result = 1;
$msg = '收藏成功';
$house_type = $houseinfo[0]['room']."室".$houseinfo[0]['hall']."厅";
$houseinfo[0]['floor'] = iconv('gbk','utf-8',$houseinfo[0]['floor']);
$houseinfo[0]['blockshowname'] = iconv('gbk','utf-8',$houseinfo[0]['blockshowname']);
$houseinfo[0]['forward'] = iconv('gbk','utf-8',$houseinfo[0]['forward']);
$house_type = iconv('gbk','utf-8',$house_type);
if($kind==3){
$url ="http://crm.house365.com/index.php/Simulate/sea_utf8?mobile={$phone}&city={$city}&activefrom=485&my_floor={$houseinfo[0]['floor']}&total_floor={$houseinfo[0]['totalfloor']}&block_name={$houseinfo[0]['blockshowname']}&area={$houseinfo[0]['buildarea']}&forward={$houseinfo[0]['forward']}&buy_old_property={$houseinfo[0]['infotype']}&house_type={$house_type}";
$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);
}
//验证不在白名单,不在推送库,不在推送历史库
$result2 = $this->push_model->yzpush($telno);
if($result2<=0 && $city=='nj'){
//加入备选库
//$this->push_model->addalternatives($uid,$telno);
}
}elseif($return == 0){
$result = 0;
$msg = '收藏失败';
}
$return_array = array('result'=>$result,'msg'=>$msg);
echo serialize($return_array);
}
...@@ -758,6 +861,66 @@ class Esf_center_api extends MY_Controller { ...@@ -758,6 +861,66 @@ class Esf_center_api extends MY_Controller {
echo serialize($return_array); echo serialize($return_array);
} }
/**
* 根据用户中心base_id取消关注房源操作接口
* @author cxf
*/
public function api_cancel_focus_by_baseId()
{
$base_id = $this->input->get('base_id');
$kind = $this->input->get('kind');
$rowid = $this->input->get('rowid');
$city = $this->input->get('city');
$tbl=$kind==3?'sell':'rent';
$id = $this->user_model->getCollectHouseIdByBaseID($base_id,$kind,$rowid,$city,1);
if(empty($id))
{
$return = 'N_COL';
}else{
$return = $this->user_model->delcollect($id);
}
$result = 0;
$msg = '取消失败';
if($return == 'N_COL'){
//$result = 2;
//$msg = '无此收藏';
$result = 1;
$msg = '删除成功';
}elseif($return == 'N_USER'){
$result = 3;
$msg = '无此用户';
}elseif($return > 0){
$result = 1;
$msg = '删除成功';
}elseif($return == 0){
$result = 0;
$msg = '取消失败';
}
$return_array = array('result'=>$result,'msg'=>$msg);
echo serialize($return_array);
}
/**
* 根据base_id获取收藏状态
* @author fly
*/
public function get_focus_status_by_baseId()
{
$base_id = $this->input->get('base_id');
$kind = $this->input->get('kind');
$rowid = $this->input->get('rowid');
$city = $this->input->get('city');
$city = $city?$city:'nj';
$result = $this->user_model->getCollectHouseIdByBaseID($base_id,$kind,$rowid,$city);
$return_array = array('result'=>0,'msg'=>'未收藏');
if(!empty($result))
{
$return_array = array('result'=>1,'msg'=>'已收藏');
}
echo serialize($return_array);
}
/** /**
...@@ -805,9 +968,8 @@ class Esf_center_api extends MY_Controller { ...@@ -805,9 +968,8 @@ 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');
$uid = $this->user_model->yztelno($telno); $base_id = $this->input->get('base_id');
if(!$base_id)
if($uid==0)
{ {
echo serialize(array());exit; echo serialize(array());exit;
} }
...@@ -819,8 +981,8 @@ class Esf_center_api extends MY_Controller { ...@@ -819,8 +981,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)
...@@ -926,6 +1088,49 @@ class Esf_center_api extends MY_Controller { ...@@ -926,6 +1088,49 @@ class Esf_center_api extends MY_Controller {
echo serialize($arr); echo serialize($arr);
} }
/**
* 获取用户关注房源操作接口
* @author cxf
*/
public function get_focus_house_list()
{
$base_id = $this->input->get('base_id');
if(!$base_id)
{
echo serialize(array());exit;
}
$kind = $this->input->get('kind');
$page = $this->input->get('page');
$pagesize = $this->input->get('pagesize');
$city = $this->input->get('city');
$page = $page ? $page:1;
$pagesize = $pagesize?$pagesize : 20;
$offset = $pagesize * ($page-1);
$this->load->model("userTest_model");
$collect_array = $this->user_model->getcollectByBaseId($kind,$base_id,$offset,$pagesize,$city);
if(!empty($collect_array) && is_array($collect_array))
{
foreach($collect_array as $key=>$value)
{
$collect_value = unserialize($value['collect_value']);
$collect_value['collect_time'] = $value['collect_time'];
$arr[$key]['value'] = serialize($collect_value);
}
}
else
{
$arr=array();
}
echo serialize($arr);
}
/** /**
* 获得用户id接口 * 获得用户id接口
...@@ -1014,6 +1219,34 @@ class Esf_center_api extends MY_Controller { ...@@ -1014,6 +1219,34 @@ class Esf_center_api extends MY_Controller {
exit; exit;
} }
/**
* 关注小区操作接口
* @author cxf
*/
public function api_saveblock_baseid()
{
$base_id = $this->input->get('base_id');
$kind = 2;
$blockid = $this->input->get('id');
$city = $this->input->get('city');
$city = $city ? $city : 'nj';
$result = $this->user_model->getCollectHouseIdByBaseID($base_id,$kind,$blockid,$city);
//已关注此
if($result['id']>0)
{
echo "2";
exit;
}
$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->addcollectByBaseID($base_id,$blockid,$kind,$searchcond,$city);
echo "1";
exit;
}
/** /**
* app关注小区操作接口 * app关注小区操作接口
* @author cxf * @author cxf
......
...@@ -9,20 +9,20 @@ ...@@ -9,20 +9,20 @@
<!----> <!---->
<div class="user-nav-mod user-nav-mod-auto"> <div class="user-nav-mod user-nav-mod-auto">
<div class="user-nav-mod"> <a href="javascript:void(0)" class="nav0 js_show_nav"><span class="tex"><strong class="s_h js_s_h <?php if($conf_where=='selllist' || $conf_where=='blocklist' || $conf_where=='sell_condition') echo 's_h_on';?>">我的关注</strong></span></a> </div> <div class="user-nav-mod"> <a href="javascript:void(0)" class="nav0 js_show_nav"><span class="tex"><strong class="s_h js_s_h <?php if($conf_where=='selllist' || $conf_where=='blocklist' || $conf_where=='sell_condition') echo 's_h_on';?>">我的收藏</strong></span></a> </div>
<div class="show_nav_mod js_show_nav_mod" <?php if($conf_where=='selllist' || $conf_where=='blocklist' ||$conf_where=='schoollist' || $conf_where=='sell_condition' || $conf_where == 'officelist' || $conf_where == 'brandlist') echo 'style="display: block;"';?>> <div class="show_nav_mod js_show_nav_mod" <?php if($conf_where=='selllist' || $conf_where=='blocklist' ||$conf_where=='schoollist' || $conf_where=='sell_condition' || $conf_where == 'officelist' || $conf_where == 'brandlist') echo 'style="display: block;"';?>>
<div class="user-nav-mod <?php if($conf_where=='selllist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/selllist';?>" class="innerLink">关注的房源</a> </div> <div class="user-nav-mod <?php if($conf_where=='selllist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/selllist';?>" class="innerLink">收藏的房源</a> </div>
<div class="user-nav-mod <?php if($conf_where=='blocklist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/blocklist';?>" class="innerLink">关注的小区</a> </div> <div class="user-nav-mod <?php if($conf_where=='blocklist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/blocklist';?>" class="innerLink">收藏的小区</a> </div>
<?php if(GB_CITY=='nj'){?> <?php if(GB_CITY=='nj'){?>
<div class="user-nav-mod <?php if($conf_where=='officelist' || $conf_where=='brandlist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/officelist';?>" class="innerLink">关注的楼盘</a> </div> <div class="user-nav-mod <?php if($conf_where=='officelist' || $conf_where=='brandlist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/officelist';?>" class="innerLink">收藏的写字楼</a> </div>
<?php } ?> <?php } ?>
<?php if(GB_CITY=='nj' || GB_CITY=='hf' || GB_CITY=='wh'){?> <?php if(GB_CITY=='nj' || GB_CITY=='hf' || GB_CITY=='wh'){?>
<div class="user-nav-mod <?php if($conf_where=='schoollist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/schoollist';?>" class="innerLink">关注的学校</a> </div> <div class="user-nav-mod <?php if($conf_where=='schoollist') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/schoollist';?>" class="innerLink">关注的学校</a> </div>
<?php }?> <?php }?>
<div class="user-nav-mod user-nav-mod-last <?php if($conf_where=='sell_condition') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/sell_condition';?>" class="innerLink">关注的找房条件</a> </div> <div class="user-nav-mod user-nav-mod-last <?php if($conf_where=='sell_condition') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/sell_condition';?>" class="innerLink">关注的找房条件</a> </div>
<div class="user-nav-mod "> <a href="<?php echo GB_NEW_HOUSE_COLLECT_URL;?>" class="innerLink">楼盘收藏</a> </div> <div class="user-nav-mod "> <a href="<?php echo GB_NEW_HOUSE_COLLECT_URL;?>" class="innerLink">收藏的楼盘</a> </div>
</div> </div>
</div> </div>
......
...@@ -806,7 +806,13 @@ class User_model extends MY_Model ...@@ -806,7 +806,13 @@ class User_model extends MY_Model
if($jmz==1){ if($jmz==1){
$uidnum = $this->get_data(array('form_name' => 'personal_collection','where'=>array('passport_uid'=>$uid,'kind'=>$kind,'city_name'=>$city),'select'=>array('count(*) as num')),'esfbak'); $uidnum = $this->get_data(array('form_name' => 'personal_collection','where'=>array('passport_uid'=>$uid,'kind'=>$kind,'city_name'=>$city),'select'=>array('count(*) as num')),'esfbak');
}else{ }else{
$uidnum = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'kind'=>$kind,'city_name'=>$city),'select'=>array('count(*) as num')),'esfbak'); //获取base_id
$base_id_where = $this->get_base_id($uid,0,1);
if($base_id_where){
$uidnum = $this->get_data(array('form_name' => 'personal_collection','where'=>"base_id in ($base_id_where) and kind=$kind and city_name='$city'",'select'=>array('count(*) as num')),'esfbak');
}else {
$uidnum = $this->get_data(array('form_name' => 'personal_collection', 'where' => array('uid' => $uid, 'kind' => $kind, 'city_name' => $city), 'select' => array('count(*) as num')), 'esfbak');
}
} }
...@@ -827,13 +833,20 @@ class User_model extends MY_Model ...@@ -827,13 +833,20 @@ class User_model extends MY_Model
*/ */
function getusercollectid($uid,$houseid,$city=GB_CITY,$kind="") function getusercollectid($uid,$houseid,$city=GB_CITY,$kind="")
{ {
$where_string = " collect_id = $houseid and city_name='$city'";
//如果有base_id优先走base_id
$base_id_where = $this->get_base_id($uid,0,1);
if($base_id_where){
$where_string .= " and base_id in ($base_id_where)";
}else{
$where_string .= " and uid = $uid";
}
//如果有kind
if($kind){ if($kind){
$return = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'collect_id'=>$houseid,'city_name'=>$city,'kind'=>$kind),'select'=>array('id')),'esf'); $where_string .= " and kind = $kind";
}
}else{ $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'=>array('uid'=>$uid,'collect_id'=>$houseid,'city_name'=>$city),'select'=>array('id')),'esf');
}
if(!empty($return[0])) if(!empty($return[0]))
{ {
...@@ -878,6 +891,41 @@ class User_model extends MY_Model ...@@ -878,6 +891,41 @@ class User_model extends MY_Model
} }
} }
/**
* 通过base_id查询用户关注房源的房源id
* @param type $base_id
* @return string|array
*/
function getCollectHouseIdByBaseID($base_id,$kind,$houseid,$city=GB_CITY,$all=0){
$base_id_where = "'".$base_id."'";
$base_id = explode(',',$base_id);
if(count($base_id)>1){
$base_id_where = '';
foreach ($base_id as $key => $value) {
$base_id_where .= "'".$value."',";
}
$base_id_where = rtrim($base_id_where,',');
}
$sql = "select id from personal_collection where base_id in ($base_id_where) and collect_id = $houseid and city_name = '$city' and kind = $kind";
$query = $this->db_esfbak->query($sql);
$data = $query->result_array();
if(!empty($data[0]))
{
$res = array();
foreach ($data as $key => $value) {
$res[$key] = $value['id'];
}
if($all){
return $res;
}
return $res[0];
}else{
return 0;
}
}
/** /**
* 查询是否有此用户 * 查询是否有此用户
...@@ -936,7 +984,10 @@ class User_model extends MY_Model ...@@ -936,7 +984,10 @@ class User_model extends MY_Model
*/ */
function addcollect($uid,$collect_id,$kind,$collect_value,$city=GB_CITY,$infofrom=1,$passport_uid=0) function addcollect($uid,$collect_id,$kind,$collect_value,$city=GB_CITY,$infofrom=1,$passport_uid=0)
{ {
$arr = array('uid'=>$uid,'collect_id'=>$collect_id,'kind'=>$kind,'collect_value'=>$collect_value,'collect_time'=>time(),'city_name'=>$city,'infofrom'=>$infofrom,'passport_uid'=>$passport_uid); $base_id = $this->get_base_id($uid);
//取第一个
$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);
//设置表 //设置表
$this->user_model->set_table('personal_collection'); $this->user_model->set_table('personal_collection');
//过滤表结构 //过滤表结构
...@@ -945,6 +996,26 @@ class User_model extends MY_Model ...@@ -945,6 +996,26 @@ class User_model extends MY_Model
return $result; return $result;
} }
/**
* 添加关注
* @param string $base_id
* @param string $collect_id
* @return string
*/
function addcollectByBaseID($base_id,$collect_id,$kind,$collect_value,$city=GB_CITY,$infofrom=1,$passport_uid=0,$uid=0)
{
//取base_id字符串中逗号前面的部分作为base_id
$base_id = explode(',',$base_id);
$base_id = $base_id[0];
$arr = array('base_id'=>$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);
//设置表
$this->user_model->set_table('personal_collection');
//过滤表结构
$result = $this->user_model->add($arr,'esf');
return $result;
}
/** /**
* 推广情况 * 推广情况
* @param type $uid * @param type $uid
...@@ -1043,15 +1114,33 @@ class User_model extends MY_Model ...@@ -1043,15 +1114,33 @@ class User_model extends MY_Model
$this->memcached_class->delete($key); $this->memcached_class->delete($key);
} }
$collect_array = $this->memcached_class->get($key); // $collect_array = $this->memcached_class->get($key);
if(empty($collect_array) ) if(empty($collect_array) )
{ {
//获取base_id
$base_id_where = $this->get_base_id($uid,0,1);
if($base_id_where){
$collect_array = $this->get_data(array('form_name' => 'personal_collection','where'=>"base_id in ($base_id_where) and kind=$kind and city_name='$city'",'limit'=>$pagesize,'offset'=>$offset,'order_by'=>'collect_time desc'),'esfbak');
}else{
$collect_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>(int)$uid,'kind'=>$kind,'city_name'=>$city),'limit'=>$pagesize,'offset'=>$offset,'order_by'=>'collect_time desc'),'esfbak');
}
$collect_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>(int)$uid,'kind'=>$kind,'city_name'=>$city),'limit'=>$pagesize,'offset'=>$offset,'order_by'=>'collect_time desc'),'esfbak');
//获取虚拟号码 //获取虚拟号码
foreach($collect_array as &$value){ foreach($collect_array as &$value){
$collect_value = unserialize($value['collect_value']); $collect_value = unserialize($value['collect_value']);
if($value['kind'] == 2 && empty($collect_value)) {
//转化成utf-8
$collect_value = mb_convert_encoding($value['collect_value'], 'UTF-8', 'GBK');
$collect_value = unserialize($collect_value);
if ($collect_value) {
//转化成gbk
foreach ($collect_value as $key => $a) {
$collect_value[$key] = mb_convert_encoding($a, 'GBK', 'UTF-8');
}
}
}
if(is_array($collect_value)){ if(is_array($collect_value)){
if($collect_value['infofrom'] == 5){ if($collect_value['infofrom'] == 5){
if($city == 'nj'){ if($city == 'nj'){
...@@ -2420,6 +2509,9 @@ if($searcharr['infotype']==4){ ...@@ -2420,6 +2509,9 @@ if($searcharr['infotype']==4){
{ {
//设置表 //设置表
$this->user_model->set_table('personal_collection'); $this->user_model->set_table('personal_collection');
if(is_array($arr)){
$arr = implode(',',$arr);
}
//过滤表结构 //过滤表结构
$result = $this->user_model->del_mul($arr,'id','esf'); $result = $this->user_model->del_mul($arr,'id','esf');
return $result; return $result;
...@@ -4589,11 +4681,21 @@ if($searcharr['infotype']==4){ ...@@ -4589,11 +4681,21 @@ if($searcharr['infotype']==4){
$this->memcached_class->delete($key); $this->memcached_class->delete($key);
} }
$block = $this->memcached_class->get($key); // $block = $this->memcached_class->get($key);
if( empty($block) ) if( empty($block) )
{ {
$block_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'city_name'=>$city,'collect_id <>'=>0,'kind'=>2),'select'=>array('collect_id')),'esfbak'); //获取base_id
$base_id_where = $this->get_base_id($uid,0,1);
if($base_id_where){
$sql = "select collect_id from personal_collection where base_id in ($base_id_where) and city_name = '$city' and kind = 2 and collect_id <> 0
order by collect_time desc ";
$query = $this->db_esfbak->query($sql);
$block_array = $query->result_array();
}else{
$block_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'city_name'=>$city,'collect_id <>'=>0,'kind'=>2),'select'=>array('collect_id')),'esfbak');
}
if(is_array($block_array) && !empty($block_array)) if(is_array($block_array) && !empty($block_array))
{ {
...@@ -4603,7 +4705,16 @@ if($searcharr['infotype']==4){ ...@@ -4603,7 +4705,16 @@ if($searcharr['infotype']==4){
} }
} }
$sell_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'city_name'=>$city,'collect_id <>'=>0,'kind'=>3),'select'=>array('collect_id')),'esfbak'); if($base_id_where){
$sql = "select collect_id from personal_collection where base_id in ($base_id_where) and city_name = '$city' and kind = 3 and collect_id <> 0
order by collect_time desc";
$query = $this->db_esfbak->query($sql);
$sell_array = $query->result_array();
}else{
$sell_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'city_name'=>$city,'collect_id <>'=>0,'kind'=>3),'select'=>array('collect_id')),'esfbak');
}
if(is_array($sell_array) && !empty($sell_array)) if(is_array($sell_array) && !empty($sell_array))
{ {
...@@ -4625,7 +4736,14 @@ if($searcharr['infotype']==4){ ...@@ -4625,7 +4736,14 @@ if($searcharr['infotype']==4){
} }
} }
$rent_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'city_name'=>$city,'collect_id <>'=>0,'kind'=>4),'select'=>array('collect_id')),'esfbak'); if($base_id_where){
$sql = "select collect_id from personal_collection where base_id in ($base_id_where) and city_name = '$city' and kind = 4 and collect_id <> 0
order by collect_time desc";
$query = $this->db_esfbak->query($sql);
$rent_array = $query->result_array();
}else{
$rent_array = $this->get_data(array('form_name' => 'personal_collection','where'=>array('uid'=>$uid,'city_name'=>$city,'collect_id <>'=>0,'kind'=>4),'select'=>array('collect_id')),'esfbak');
}
if(is_array($rent_array) && !empty($rent_array)) if(is_array($rent_array) && !empty($rent_array))
{ {
...@@ -6119,6 +6237,44 @@ if($searcharr['infotype']==4){ ...@@ -6119,6 +6237,44 @@ if($searcharr['infotype']==4){
return $collect_array; return $collect_array;
} }
/**
* 获取关注信息通过base_id
* @param type $base_id
* @return string
*/
function getcollectByBaseId($kind,$base_id,$offset=0,$pagesize=0,$city=GB_CITY)
{
$pagesize = $pagesize ? $pagesize : 20;
$key = $this->memkey.'getcollectByBaseId'.$base_id.$kind.$offset.$pagesize.$city;
if($this->input->get('update') == 1)
{
$this->memcached_class->delete($key);
}
$collect_array = $this->memcached_class->get($key);
if(empty($collect_array) )
{
$base_id_where = "'".$base_id."'";
$base_id = explode(',',$base_id);
if(count($base_id)>1){
$base_id_where = '';
foreach ($base_id as $key => $value) {
$base_id_where .= "'".$value."',";
}
$base_id_where = rtrim($base_id_where,',');
}
$sql = "select * from personal_collection where base_id in ($base_id_where) and city_name = '$city' and kind = $kind
order by collect_time desc limit $offset,$pagesize";
$query = $this->db_esfbak->query($sql);
$collect_array = $query->result_array();
$this->memcached_class->add($key, $collect_array,1);
}
return $collect_array;
}
/** /**
* 验证优惠券 * 验证优惠券
* @param $user_id * @param $user_id
...@@ -6183,5 +6339,45 @@ if($searcharr['infotype']==4){ ...@@ -6183,5 +6339,45 @@ if($searcharr['infotype']==4){
return $data; return $data;
} }
/**
* 获取用户信息
* @param $uid int
* @param $passport_uid int
* @param $in_where int 是否要作为sql 拼接条件
* @return string
*/
public function get_base_id($uid=0,$passport_uid=0,$in_where=0)
{
if(!$uid && !$passport_uid) return '';
if(!$passport_uid){
$user_array = $this->get_data(array('form_name' => 'personal_user','where'=>array('id'=>$uid),'select'=>array('passport_uid')),'esfbak');
if(!empty($user_array)){
$passport_uid = $user_array[0]['passport_uid'];
}else{
return '';
}
}
$base_id_url = 'http://localnewrent.house365.com/api/tf-app/get-base-id?keyword='.$passport_uid;
$base_id = curl_get_contents($base_id_url);
$res = $base_id;
if($base_id){
if($in_where){
$base_id_where = "'".$base_id."'";
$base_id = explode(',',$base_id);
if(count($base_id)>1){
$base_id_where = '';
foreach ($base_id as $key => $value) {
$base_id_where .= "'".$value."',";
}
$base_id_where = rtrim($base_id_where,',');
}
$res = $base_id_where;
}
}
return $res;
}
} }
\ 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