Commit df0f92f9 authored by zhangjun's avatar zhangjun

Merge branch 'release-fangliyan'

parents 955cb1a0 4d688148
# Created by .ignore support plugin (hsz.mobi)
.idea
\ No newline at end of file
......@@ -1372,6 +1372,11 @@ class Esf_center_api extends MY_Controller {
*/
public function api_adduser_mobile()
{
$result = 1;
$msg = '停用';
$return_array = array('result'=>$result , 'msg'=>$msg);
echo serialize($return_array);die();
$telno = $this->input->get('telno');
$paasword = $this->input->get('paasword');
$city = $this->input->get('city');
......@@ -2914,12 +2919,13 @@ class Esf_center_api extends MY_Controller {
public function notify(){
$data = $_POST;
$msg = "************************************************ \n";
$msg .= date('Y-m-d H:i:s').var_export($_POST,true)." \n";
$log = dirname(__FILE__)."/notify";
file_put_contents($log,$msg,FILE_APPEND );
$log2 = dirname(__FILE__ ) . "/notifylog2.txt";
file_put_contents( $log2, $msg,FILE_APPEND );
$this->user_model->addLog("微信支付回调参数数据2:", json_encode( $data ) );
// $msg = "************************************************ \n";
// $msg .= date('Y-m-d H:i:s').var_export($_POST,true)." \n";
// $log = dirname(__FILE__)."/notify";
// file_put_contents($log,$msg,FILE_APPEND );
// $log2 = dirname(__FILE__ ) . "/notifylog2.txt";
// file_put_contents( $log2, $msg,FILE_APPEND );
$result['status'] = 'FAIL';
if(GB_CITY != 'nj' && GB_CITY != 'wh' ){
$result['msg'] = 'city error';
......@@ -2986,6 +2992,56 @@ class Esf_center_api extends MY_Controller {
}
}
/**
* 0元支付回调
*/
public function zeroNotify() {
$result['status'] = 0;
$data = $_POST;
$transactionId = isset( $data['transaction_id'] ) ? $data['transaction_id'] : '';
// 订单数据
$orderInfo = $this->package_model->getOrderInfoByTransactionId( $transactionId );
if ( empty( $orderInfo ) ) {
$result['msg'] = '订单数据不存在';
echo json_encode($result);exit;
}
//判断订单状态
if($orderInfo['order_status'] != 1){
$result['msg'] = '订单已关闭';
echo json_encode($result);exit;
}
if($orderInfo['pay_status'] != 0){
$result['msg'] = '订单已失效';
echo json_encode($result);exit;
}
$payTransactionId = isset( $data['pay_transaction_id'] ) ? $data['pay_transaction_id'] : '';
if ( empty( $payTransactionId ) ) {
$result['msg'] = '支付凭证不能为空';
echo json_encode($result);exit;
}
//支付成功后的操作
$res = $this->package_model->payFinish( $orderInfo, array( 'transaction_id' => $payTransactionId ) );
if( !$res ) {
$result['msg'] = '生成推广相关数据失败';
echo json_encode($result);exit;
}
// 发送短信
if ( GB_CITY == 'nj' ) {
$this->sendMsg( $orderInfo );
}
$result['status'] = 1;
$result['msg'] = '成功';
echo json_encode($result);exit;
}
// 支付回调修复数据 20200605
public function notify_modify_data(){
$data = $_POST;
......
......@@ -570,19 +570,19 @@ class Esf_center_api_zhang extends MY_Controller {
//登陆成功需要把sso_token以cookie形式种到浏览器中
protected function register_tf_ucenter_cookie($passport_uid){
setcookie('PHPSESSID','',time()-1,'/','house365.com');
$url = "http://api.house365.com/passport/passport_gettoken_byuid.php?passport_uid=".$passport_uid;
if(isset($_COOKIE['utm_source']) && isset($_COOKIE['utm_medium']) && isset($_COOKIE['utm_campaign'])){
$url.= "&utm_source={$_COOKIE['utm_source']}&utm_medium={$_COOKIE['utm_medium']}&utm_campaign={$_COOKIE['utm_campaign']}";
}
if(isset($_COOKIE['crm_scene'])){
$url.= "&register_client=PC&register_application={$_COOKIE['crm_scene']}";
}
$api_res = json_decode($this->get_api($url), true);
if(isset($api_res['result']) && $api_res['result']==1){
setcookie('sso_token',$api_res['data'],time()+3600*24*180,'/','house365.com');
}
// setcookie('PHPSESSID','',time()-1,'/','house365.com');
// $url = "http://api.house365.com/passport/passport_gettoken_byuid.php?passport_uid=".$passport_uid;
// if(isset($_COOKIE['utm_source']) && isset($_COOKIE['utm_medium']) && isset($_COOKIE['utm_campaign'])){
// $url.= "&utm_source={$_COOKIE['utm_source']}&utm_medium={$_COOKIE['utm_medium']}&utm_campaign={$_COOKIE['utm_campaign']}";
// }
// if(isset($_COOKIE['crm_scene'])){
// $url.= "&register_client=PC&register_application={$_COOKIE['crm_scene']}";
// }
// $api_res = json_decode($this->get_api($url), true);
//
// if(isset($api_res['result']) && $api_res['result']==1){
// setcookie('sso_token',$api_res['data'],time()+3600*24*180,'/','house365.com');
// }
}
......
......@@ -17,6 +17,8 @@ class Findpassword extends MY_Controller {
*/
public function index()
{
header('Location:http://passport.house365.com/index/forgetPwd');die();
$_SESSION['token'] = md5($this->user_id);
$data['title'] = '用户找回密码';
......
......@@ -17,7 +17,7 @@ class Login extends MY_Controller
function index()
{
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://newrent.house365.com/user/login");
Header("Location: http://passport.house365.com/index/login?others_returnback=http://newrent.house365.com/user-center/index");
exit;
//IM 埋点
if($_GET['from']=='im'){
......
......@@ -1819,8 +1819,10 @@ class User extends MY_Controller
$packageKeyword = intval($this->input->post('package_keyword',true));
$day = intval($this->input->post('day_'.$packageType,true));
$payType = addslashes($this->input->post('pay_type',true));
// 租房8折优惠券 20200507添加
// 是否使用优惠券
$use_coupon = intval($this->input->post('use_coupon',true));
// 优惠券ID
$coupon_id = intval($this->input->post('coupon_id',true));
$from_url = $this->input->post('from_url',true);
if(empty($packageId) || empty($houseId) || empty($tbl) || empty($packageType) || (!in_array($packageType,array(4,5)) && empty($day)) || empty($payType) || !in_array($payType,$payTypeArr)){
return $this->jump(USER_CENTER,'参数缺失',3000,'warning');
......@@ -1854,73 +1856,89 @@ class User extends MY_Controller
$packageData['package_desc'] = unserialize($packageData['package_desc']);
foreach($packageData['package_desc'] as $item){
if($packageType == 4){
$price = floatval($item['price']);
$price = $originalPrice = floatval($item['price']);
}else if($packageType == 5){
if($item['property_type'] == $infoType){
$price = floatval($item['price']);
$price = $originalPrice = floatval($item['price']);
//处理折扣
if(isset($item['discount']) && $item['discount'] >0){
$price = $this->pirceDiscount($price,$item['discount']);
$price = $originalPrice = $this->pirceDiscount($price,$item['discount']);
}
}
}else{
if($item['property_type'] == $infoType && $item['day'] == $day){
$price = floatval($item['price']);
$price = $originalPrice = floatval($item['price']);
if(GB_CITY == 'wh' && $packageType == 2){
//处理折扣
if(isset($item['discount']) && $item['discount'] >0){
$price = $this->pirceDiscount($price,$item['discount']);
$price = $originalPrice = $this->pirceDiscount($price,$item['discount']);
}
}
// 列表套餐8折券使用 20200507
// 优惠券修改为 6折
if( GB_CITY == 'nj' && $packageType == 2 && $tbl == 'rent'){
//
$checkbox_status = 0;
// 检查是否有可用的优惠券,如果有则使用,如果无,则跳转提示
$userInfoData = $this->user_model->getuserdetail($this->user_id);
$passport_uid = $userInfoData ? $userInfoData['passport_uid'] : 0;
// 测试数据
$couponUserIdArr = array('1785149','3367096','4112782');
if( in_array($this->user_id,$couponUserIdArr) ){
$price = 0.05;
}
if( isset($use_coupon) && $use_coupon == 1){
$check_coupon = $this->rent_coupon_model->checkCoupon($passport_uid);
if( !$check_coupon ){
$from_url = $from_url ? $from_url : USER_CENTER;
return $this->jumpNew($from_url,'已有待支付订单,勿重复下单!<br/>请30分钟后再试。',3000,'warning');
}
$checkbox_status = 1;
// 列表优先套餐8折
// 修改为6折 20200927
$price = sprintf("%.2f",$price * 0.6);
// 锁定半小时
$this->rent_coupon_model->lockCoupon($passport_uid);
}
// 设置8折优惠券的选中状态
$this->rent_coupon_model->setCheckbox($passport_uid,$checkbox_status);
}
// if( GB_CITY == 'nj' && $packageType == 2 && $tbl == 'rent'){
// //
// $checkbox_status = 0;
// // 检查是否有可用的优惠券,如果有则使用,如果无,则跳转提示
// $userInfoData = $this->user_model->getuserdetail($this->user_id);
// $passport_uid = $userInfoData ? $userInfoData['passport_uid'] : 0;
//
// // 测试数据
// $couponUserIdArr = array('1785149','3367096','4112782');
// if( in_array($this->user_id,$couponUserIdArr) ){
// $price = 0.05;
// }
//
// if( isset($use_coupon) && $use_coupon == 1){
//
// $check_coupon = $this->rent_coupon_model->checkCoupon($passport_uid);
// if( !$check_coupon ){
// $from_url = $from_url ? $from_url : USER_CENTER;
// return $this->jumpNew($from_url,'已有待支付订单,勿重复下单!<br/>请30分钟后再试。',3000,'warning');
// }
// $checkbox_status = 1;
// // 列表优先套餐8折
// // 修改为6折 20200927
// $price = sprintf("%.2f",$price * 0.6);
// // 锁定半小时
// $this->rent_coupon_model->lockCoupon($passport_uid);
//
//
// }
//
// // 设置8折优惠券的选中状态
// $this->rent_coupon_model->setCheckbox($passport_uid,$checkbox_status);
//
// }
}
}
}
// 使用优惠券
if ( GB_CITY == 'nj' ) {
if( isset( $use_coupon ) && $use_coupon == 1 ) {
$couponRes = $this->user_model->checkCoupon( $this->user_id, $coupon_id, $price, $packageType );
if ( isset( $couponRes['result'] ) && $couponRes['result'] == 1 ) {
$price = $price - $couponRes['data']['coupon_price'] ;
}
}
}
$userIdArr = array(2909549,3137198,4532164,4112782,5355879,1729793);
$userIdArr = array(4112782,5355879,1729793,4449390,6264549);
if(in_array($this->user_id,$userIdArr)){
$price = 0.01;
$price = $price * 0.01;
}
// 付款方式
$payType = $price <= 0 ? 'zeroyuanpay' : $payType;
//校验参数正确性
if($packageType != $packageData['package_type'] || empty($price) || $price <= 0){
return $this->jump(USER_CENTER,'套餐价格数据异常',3000,'warning');
// if($packageType != $packageData['package_type'] || empty($price) || $price <= 0){
// return $this->jump(USER_CENTER,'套餐价格数据异常',3000,'warning');
// }
if($packageType != $packageData['package_type']){
return $this->jump(USER_CENTER,'套餐数据异常',3000,'warning');
}
if($packageType == 1 && ( $packageKeyword != $packageData['package_keyword'] || $packageKeyword <= 0 ) ){
return $this->jump(USER_CENTER,'套餐关键词异常',3000,'warning');
......@@ -1978,7 +1996,7 @@ class User extends MY_Controller
$tblArr = array('sell' => 1 ,'rent' => 2);
$tableId = $tblArr[$tbl];
$orderData = array();
$orderData['transaction_id'] = $this->package_model->getTransactionId($packageType);
$orderData['transaction_id'] = $this->package_model->getTransactionId( $packageType );
$orderData['user_id'] = $this->user_id;
$orderData['house_type'] = $tableId;
$orderData['house_id'] = $houseId;
......@@ -1988,6 +2006,12 @@ class User extends MY_Controller
if($packageType == 1){
$orderData['package_keyword'] = $packageKeyword;
}
// 优惠券字段
if ( isset( $couponRes['result'] ) && $couponRes['result'] == 1 ) {
$orderData['coupon_name'] = isset( $couponRes['data']['name'] ) ? iconv('utf-8','gbk',$couponRes['data']['name']) : 0;
$orderData['coupon_price'] = isset( $couponRes['data']['coupon_price'] ) ? $couponRes['data']['coupon_price'] : 0;
$orderData['coupon_id'] = isset( $couponRes['data']['id'] ) ? $couponRes['data']['id'] : 0;
}
$orderData['package_days'] = $day;
$orderData['price'] = $price;
$orderData['create_time'] = time();
......@@ -2001,6 +2025,26 @@ class User extends MY_Controller
return $this->jump(USER_CENTER ,'订单创建失败',3000,'warning');
}
// 使用优惠券
if ( GB_CITY == 'nj' ){
if( isset( $use_coupon ) && $use_coupon == 1 ) {
$this->user_model->useCoupon( $orderData['transaction_id'], $this->user_id, $coupon_id, $originalPrice, $packageType );
// 0元支付
if ( $price <= 0 ) {
//支付成功后的操作
$result = $this->package_model->payFinish($orderData, array('transaction_id' => $this->package_model->getPaymentTransactionId( $packageType )));
if (GB_CITY == 'nj') {
$this->package_model->sendMsg( $orderData );
}
$data['orderData'] = $orderData;
$data['title'] = '0元支付';
$this->load->view('zero_yuan_pay', $data);
return;
}
}
}
$data = $this->getWxPayCodeByHouse365($orderId);
if($data['status'] != 1){
return $this->jump(USER_CENTER , $data['msg'],3000,'warning');
......
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_Fang extends MY_Controller
{
/**
* Survey
* @author Candison <www.kandisheng.com>
*/
private $surveyConfig = array(
'nj' => array(
'surveyInfotype' => array(1,'1'),
'surveyDistrict' => array('雨花台区'),
),
'wh' => array(
'surveyInfotype' => array(1,2,3,4,5,6,'1','2','3','4','5','6'),
'surveyDistrict' => array('镜湖区', '鸠江区', '弋江区', '三山区'),
),
);
/**
* 开通支付的城市
* @var array
*/
private $openPayCitys = array(
'nj','wh'
);
/**
* 支付中台活动id
* @var array
*/
private $openPayCitysActId = array(
'nj' => 57,//89,
'wh' => 82,
);
private $surveyStatus = array(
0 => '实勘未知状态',
1 => '实勘审核中',
2 => '实勘不通过',
3 => '实勘已预约',
4 => '实勘处理中',
5 => '实勘已上传',
6 => '实勘已取消'
);
private $address = array(
'nj' => '南京市建邺区云龙山路99号江苏省建大厦B幢6楼信息中心;(地铁10号线中胜站下2A出口,向东300米)',
'wh' => '芜湖市镜湖区绿地新都会C座7层 365淘房二手房运营部',
);
function __construct()
{
parent::__construct();
$this->load->model("user_model");
$this->load->model("broker_model");
$this->load->model("pic_model");
$this->load->model("block_model");
$this->load->model("ask_model");
$this->load->model("house_model");
$this->load->model("house_statistic_model");
// 租房9折优惠券 20200507添加
$this->load->model('rent_coupon_model');
$this->load->library("user_class");
$this->load->library("apply_class");
$this->user_id = checklogin();
if( $this->user_id <= 0 )
{
jumpto( USER_CENTER.'login');
exit();
}
//关注各项数量
$this->num_1 = $this->user_model->getusercollect($this->user_id,1);
$this->num_2 = $this->user_model->getusercollect($this->user_id,2);
$this->num_3 = $this->user_model->getusercollect($this->user_id,3);
$this->num_4 = $this->user_model->getusercollect($this->user_id,4);
$this->num_5 = $this->user_model->getusercollect($this->user_id,5);
$this->num_7 = $this->user_model->getusercollect($this->user_id,7);
$this->num_8 = $this->user_model->getusercollect($this->user_id,8);
$this->num_9 = $this->user_model->getusercollect($this->user_id,9);
}
private function getAD($id=0, $width=0, $height=0)
{
/*
$databaseHost = '172.17.1.5';
$databasePort = '3306';
$databaseName = 'njhouse';
$databaseAccount = 'root';
$databasePassword = 'idontcare';
$databaseCharset = 'gbk';
// Connect
$mysql = mysql_connect(sprintf('%s:%s', $databaseHost, $databasePort), $databaseAccount, $databasePassword);
if($mysql === false){
return $defaultString;
}
// Query
$sql = sprintf('select id,filetype,width,height,href,src from news_ad where id="%s" limit 1', $id);
$result = mysql_db_query($databaseName, $sql, $mysql);
if($result === false){
return $defaultString;
}
$data = mysql_fetch_row($result);
if($data === false){
return $defaultString;
}
*/
// Config
$defaultString = '';
$adInterfaceBaseURL = 'http://adadmin.house365.com/api/ad/sort_ads.php';
// Get Data
$adInterfaceURL = sprintf('%s?city=%s&id=%s', $adInterfaceBaseURL, GB_CITY, $id);
$result = curl_get_contents($adInterfaceURL);
if(empty($result)){
return $defaultString;
}
$data = unserialize($result);
if(!isset($data[0])){
return $defaultString;
}
$data = $data[0];
// HTML
if(intval($width) == 0 && intval($height) == 0){
$width = $data['width'];
$height = $data['height'];
}
if($data['filetype'] == 'i'){
if(empty($data['href'])){
return sprintf('<img target="_blank" src="%s" width="%s" height="%s" border="0">', $data['src'], $width, $height);
}
return sprintf('<a target="_blank" href="%s"><img target="_blank" src="%s" width="%s" height="%s" border="0"></a>', $data['link'], $data['src'], $width, $height);
}
if($data['filetype'] == 'f'){
return sprintf('<embed src="%s" quality="high" width="%s" height="%s" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent">', $data['src'], $width, $height);
}
return $defaultString;
}
/**
* 用户中心首页
* @author cxf
*/
public function index()
{
global $house;
header("Location:http://newrent.house365.com/user-center/index");
die;
$data['conf_where'] = 'index';
$data['title'] = '会员中心';
$data['priceunit'] = $house['priceunit'];
$data['sell_num'] = $this->house_model->gethousenumbyuid($this->user_id,'sell',1);
$data['rent_num'] = $this->house_model->gethousenumbyuid($this->user_id,'rent',1);
$data['want_num'] = $this->user_model->get_rent_wantnum_by_uid($this->user_id,1);
$data['buy_num'] = $this->user_model->get_buynum_by_uid($this->user_id,1);
$data['user_detail'] = $this->user_model->get_userdetail($this->user_id,array('email','telno','auth_type','bank_type'));
$data = array_merge($data,$this->realNameData());
//获取最新2条房源
$newhouse = $this->user_model->newhouse( $this->user_id , 2 );
$data['newhouse'] = $newhouse;
$count_newhouse =count($newhouse);
$active_num =0;
$active_sell_num =0;
for($i=0;$i<$count_newhouse;$i++)
{
if($newhouse[$i]['esta']==1)
{
if($newhouse[$i]['tbl']=='sell')
{
$active_sell_num++;
}
$active_num++;
}
}
$sell_collect_house = $this->user_model->getcollect(3,$this->user_id,0,8); //网友关注的二手房房源
$rent_collect_house = $this->user_model->getcollect(4,$this->user_id,0,8); //网友关注的租房房源
$sell_collect_block = $this->user_model->getcollect(2,$this->user_id,0,8); //网友关注的小区
$data['sell_collect_house'] = $sell_collect_house;
$data['rent_collect_house'] = $rent_collect_house;
$data['sell_collect_block'] = $sell_collect_block;
//获取你可能感兴趣的二手房
$data['likesell'] = $this->user_model->getlikehousebyrule($active_num,$active_sell_num,$newhouse,$sell_collect_house,$sell_collect_block,$this->user_id,'sell',$active_sell_num,4);
//获取你可能感兴趣的租房
$data['likerent'] = $this->user_model->getlikehousebyrule($active_num,$active_sell_num,$newhouse,$rent_collect_house,$sell_collect_block,$this->user_id,'rent',$active_sell_num,4);
//获取你可能感兴趣的小区
$data['likeblock'] = $this->user_model->getlikehousebyrule($active_num,$active_sell_num,$newhouse,$sell_collect_house,$sell_collect_block,$this->user_id,'block',4);
//中奖通知 5.25-8.31
$data['is_win'] = $this->_get_is_win();
//BI统计 ----- start----->
$data['isa_website'] = '2,19,46';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
$this->load->model('package_model');
$data['limitNumGtZero'] = $this->package_model->getLimitNumGtZero();
//BI统计 ----- ent----->
/**
* Survey
* @author Candison <www.kandisheng.com>
*/
if (is_array($data['newhouse'])) {
if(GB_CITY=='nj'){
$this->load->model('survey_model');
$modelSurvey = new Survey_model();
}elseif(GB_CITY == 'wh'){
$this->load->model('vr_model');
$modelSurvey = new Vr_model();
}
foreach($data['newhouse'] as &$value) {
$value['survey_status'] = '';
$value['can_survey'] = false;
$value['show_survey_icon'] = false;
if(intval($value['esta']) != 1){
$value['survey'] = 0;
}
if ($value['tbl'] == 'sell' && $data['limitNumGtZero'][5]['sell'] && intval($value['survey']) != 1 && intval($value['esta']) == 1 && in_array(GB_CITY, array_keys($this->surveyConfig)) && in_array(intval($value['infotype']), $this->surveyConfig[GB_CITY]['surveyInfotype']) && in_array($value['district'], $this->surveyConfig[GB_CITY]['surveyDistrict'])) {
$value['can_survey'] = true;
}
if(intval($value['survey']) == 1) {
if(GB_CITY=='nj'){
$surveyInformation = $modelSurvey->getInformation('sell', $value['id']);
$status = isset($surveyInformation[0]['status']) ? intval($surveyInformation[0]['status']) : 0;
if ($status == 3 && !empty($surveyInformation[0]['time_order']) && time() > intval($surveyInformation[0]['time_order'])) {
$status = 4;
}
if($status != 2){
$value['show_survey_icon'] = true;
}
$value['survey_status'] = isset($this->surveyStatus[$status]) ? $this->surveyStatus[$status] : '实勘未知状态';
}elseif(GB_CITY=='wh'){
$surveyInformation = $modelSurvey->getVrInfoByHouseId('sell', $value['id']);
if($surveyInformation){
$value['show_survey_icon'] = $surveyInformation['show_icon'];
$value['survey_status'] = $surveyInformation['vr_status_word'];
}
}
}
//获取房源已有套餐
if(in_array(GB_CITY,$this->openPayCitys)){
$packageData = $this->package_model->getHousePackageNew($value['id'],$value['tbl']);
if($packageData){
if(isset($packageData['leftTime'])) $value['leftTime'] = $packageData['leftTime'];
if(in_array(1,$packageData['package_types']) || in_array(2,$packageData['package_types']) || in_array(3,$packageData['package_types'])){
$value['promoting'] = 1;
}else{
$value['promoting'] = 0;
}
}
}
}
}
$data['ad3799'] = $this->getAD(3799);
$data['ad4217'] = $this->getAD(4217);
$this->load->view('index',$data);
}
/**
* 会员中心切换城市
* @author cxf
*/
public function changecity()
{
$city = $this->input->get('city');
$city = !empty($city)?$city:'nj';
header("Location:http://newrent.house365.com/user-center/switch-city?city=".$city);
die;
setcoandsess('website_jumpto_city',$city);
jumpto(USER_CENTER.'user');
}
/**
* 我的关注二手房页面
* @author cxf
*/
public function selllist()
{
$data['conf_where'] = 'selllist';
$data['title'] = '会员中心';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;exit;
}
//分页开始
$data['collect_num'] = $this->num_3;
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getcollect(3,$this->user_id,$data['offset'],$data['pagesize']);
if(is_array($data['collect'])&&!empty($data['collect'])){
foreach($data['collect'] as $key=>$value){
if(GB_CITY=='nj')
{
$isChoice = $this->user_model->isCheckPriceRemind($this->user_id,$value['collect_id']);
$infofrom_data=$this->user_model->get_infofrom_by_id($value['collect_id']);
}
$data['collect'][$key]['infofrom'] =$infofrom_data[0]['infofrom'];
$data['collect'][$key]['is_remind'] = isset($isChoice[0]['status'])&&($isChoice[0]['status']==1) ? 1:0;
}
}
//获取你可能感兴趣的二手房
$data['likesell'] = $this->user_model->getlikehouse($this->user_id,'sell',4);
//BI统计 ----- start----->
$data['isa_website'] = '2,19,79';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$this->load->view('my_attention_sell',$data);
}
/**
* 我的关注租房页面
* @author cxf
*/
public function rentlist()
{
GLOBAL $house;
$data['conf_where'] = 'selllist';
$data['title'] = '我的关注';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;exit;
}
//分页开始
$data['collect_num'] = $this->num_4;
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getcollect(4,$this->user_id,$data['offset'],$data['pagesize']);
$data['collect'] = $this->user_model->getNewRentUserCollectInfo($data['collect'], 4);
$data['priceunit'] = $house['priceunit'];
//获取你可能感兴趣的租房
$data['likerent'] = $this->user_model->getlikehouse($this->user_id,'rent',4);
$this->load->view('my_attention_rent',$data);
}
/**
* 我的关注小区页面
* @author cxf
*/
public function blocklist()
{
$data['conf_where'] = 'blocklist';
$data['title'] = '我的关注';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;
exit;
}
//分页开始
$data['collect_num'] = $this->num_2;
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getcollect(2,$this->user_id,$data['offset'],$data['pagesize']);
$data['collect'] = $this->user_model->getNewRentUserCollectInfo($data['collect'], 2);
//获取你可能感兴趣的小区
$data['likeblock'] = $this->user_model->getlikehouse($this->user_id,'block',4);
//BI统计 ----- start----->
$data['isa_website'] = '2,19,80';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$this->load->view('my_attention_block',$data);
}
/**
* 我的关注学区页面
* @author xue
*/
public function schoollist()
{
$data['conf_where'] = 'schoollist';
$data['title'] = '会员中心';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;exit;
}
//分页开始
$data['collect_num'] = $this->num_7;
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getCollectSchoolList(7,$this->user_id,$data['offset'],$data['pagesize']);
//获取你可能感兴趣的二手房
$data['likesell'] = $this->user_model->getLikeSchoolHouse($this->user_id);
//BI统计 ----- start----->
$data['isa_website'] = '2,19,77';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$this->load->view('my_attention_school',$data);
}
/**
* 我的二手房关注条件页面
* @author cxf
*/
public function sell_condition()
{
$data['conf_where'] = 'sell_condition';
$data['title'] = '我的关注';
$muldel = $this->input->post('muldel');
$actionid = $this->input->post('actionid');
//删除操作
if( isset( $muldel ) && $muldel == 'del')
{
$result = $this->user_model->delcollect($actionid);
echo $result;
exit;
}
//分页开始
$data['collect_num'] = $this->num_1;
$data['pagesize'] = 5;//设定每一页显示的记录数
//计算总页数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ;
//获取当前页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) : 1 ;
//判断跳转页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page'];
//计算记录偏移量
$data['offset'] = $data['pagesize']*($data['page']-1);
$data['collect'] = $this->user_model->getcollect(1,$this->user_id,$data['offset'],$data['pagesize']);
$data['sarr'] = $this->user_model->getSeachcondStr($data['collect']);
$data['surl'] = $this->user_model->getSeachcondUrl($data['collect'], 1);
//获取你可能感兴趣的二手房
$data['likesell'] = $this->user_model->getlikehouse($this->user_id,'sell',4);
//2018-8-16加,房源特色总标签
$data['house_features'] = $this->user_model->getHouseFeatures();
//BI统计 ----- start----->
$data['isa_website'] = '2,19,78';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$this->load->view('my_sell_condition',$data);
}
/**
* 我的关注条件页面
* @author cxf
*/
public function rent_condition()
{
global $house;
$data['conf_where'] = 'sell_condition';
$data['title'] = '我的关注';
$data['priceunit'] = $house['priceunit'];
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;exit;
}
if(isset($_GET['zj']) && $_GET['zj']==1)
{
var_dump($house);die();
}
//分页开始
$data['collect_num'] = $this->num_5;
$data['pagesize'] = 5;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getcollect(5,$this->user_id,$data['offset'],$data['pagesize']);
$data['sarr'] = $this->user_model->getSeachcondStr($data['collect'], 'rent');
$data['surl'] = $this->user_model->getSeachcondUrl($data['collect'], 5);
//获取你可能感兴趣的租房
$data['likerent'] = $this->user_model->getlikehouse($this->user_id,'rent',4);
$this->load->view('my_rent_condition',$data);
}
/**
* 我的关注楼盘页面
* @author cxf
*/
public function officelist()
{
GLOBAL $house;
$data['conf_where'] = 'officelist';
$data['title'] = '我的关注';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;exit;
}
//分页开始
$data['collect_num'] = $this->num_8;
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getcollect(8,$this->user_id,$data['offset'],$data['pagesize']);
$data['collect'] = $this->user_model->getNewRentUserCollectInfo($data['collect'], 8);
$data['priceunit'] = $house['priceunit'];
//获取你可能感兴趣的租房
$data['likerent'] = $this->user_model->getlikehouse($this->user_id,'rent',4);
$this->load->view('my_attention_office',$data);
}
/**
* 我的关注联合办公页面
* @author cxf
*/
public function brandlist()
{
GLOBAL $house;
$data['conf_where'] = 'brandlist';
$data['title'] = '我的关注';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delcollect($_POST['actionid']);
echo $result;exit;
}
//分页开始
$data['collect_num'] = $this->num_9;
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['collect_num'] ? ceil($data['collect_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['collect'] = $this->user_model->getcollect(9,$this->user_id,$data['offset'],$data['pagesize']);
$data['collect'] = $this->user_model->getNewRentUserCollectInfo($data['collect'], 9);
$data['priceunit'] = $house['priceunit'];
//获取你可能感兴趣的租房
$data['likerent'] = $this->user_model->getlikehouse($this->user_id,'rent',4);
$this->load->view('my_attention_brand',$data);
}
/**
* 用户退出
* @author cxf
*/
public function logout()
{
vbsetcookie("esfuserid","",1);
vbsetcookie("esfpassword","",1);
vbsetcookie("esfusername","",1);
vbsetcookie("esfusertelno","",1);
vbsetcookie("esfshowname","",1);
vbsetcookie("esfusercity","",1);
vbsetcookie("sso_token","",1);
setcookie("esfuserid", null, time() - 1000, "/", "house365.com");
setcookie("esfusername", null, time() - 1000, "/", "house365.com");
setcookie("esfusertelno", null, time() - 1000, "/", "house365.com");
setcookie("sso_token", null, time() - 1000, "/", "house365.com");
setcookie("PHPSESSID", null, time() - 1000, "/", "house365.com");
setcookie("PHPSESSID", null, time() - 1000, "/", "newrent.house365.com");
setcookie("newrent_yii3-session", null, time() - 1000, "/", "house365.com");
unset($_SESSION['esfuserid']);
unset($_SESSION['esfpassword']);
unset($_SESSION['esfusername']);
unset($_SESSION['esfusertelno']);
unset($_SESSION['esfusercity']);
unset($_SESSION['esfshowname']);
unset($_SESSION['sso_token']);
setcookie("sessionid", null, time() - 1000, "/", "house365.com");
setcookie("newrent_yii2-session", null, time() - 1000, "/", "house365.com");
jumpto(GB_LOGOUT_URL);exit();
if(isset($_SERVER['HTTP_REFERER']))
{
$url = substr($_SERVER['HTTP_REFERER'], 0, 35);
$url1 = substr($_SERVER['HTTP_REFERER'], 0, 40);
jumpto(GB_SELL_URL);
/*if($url==USER_CENTER.'user' || $url1==USER_CENTER.'statistic' || $url==USER_CENTER.'want')
{
//jumptotk(GB_SELL_URL,"退出成功!将返回二手房首页!",3000,'tips');
jumpto(GB_SELL_URL);
}else{
//jumptotk($_SERVER['HTTP_REFERER'],"退出成功!将返回之前的页面!",3000,'tips');
jumpto($_SERVER['HTTP_REFERER']);
}*/
}else{
//jumptotk(GB_SELL_URL,"退出成功!将返回二手房首页!",3000,'tips');
jumpto(GB_SELL_URL);
}
exit();
}
public function bind_zmxy()
{
if (!defined('OPEN_ZMXY')) {
exit('该城市暂未开通此功能!');
}
//简单防止CSRF与模拟POST访问
$data['time'] = time();
$data['token'] = md5('house365'. $data['time'] . $this->user_id); //加盐
$_SESSION[$data['token']] = 1;
$data['conf_where'] = 'bind_zmxy';
$data['title'] = '认证管理';
$data = array_merge($data,$this->realNameData());
$this->load->model('user_model');
$data['user_card_info'] = $this->user_model->getUserCardInfo($this->user_id,1);
//获取银行的配置文件
require_once(APPPATH.'config/bank.php');
$data['bank'] = $bank;
//芝麻认证信息
$zhima = $this->user_model->getCertAuth($this->user_id,1);
//银联认证
$bank_cert = $this->user_model->getCertAuth($this->user_id,2);
$data['zhima'] = $zhima;
$data['bank_cert'] = $bank_cert;
if ($_POST) {
$result = array(
'status' => 0,
'msg' => '',
'url' => ''
);
$msg = '';
$sessionToken = $_SESSION[$_POST['token']];
unset($_SESSION[$_POST['token']]);
$_POST['truename'] = iconv('utf8','gbk',$_POST['truename']);
$_POST['truename'] = addslashes($_POST['truename']);
$_POST['idno'] = addslashes($_POST['idno']);
$checkData = $this->user_model->checkIdNo($_POST['idno'], $this->user_id);
if (!$checkData['result']) {
$msg = $checkData['msg'];
}
if (empty($_POST['idno']) || empty($_POST['truename'])) {
$msg = '参数错误!';
}
//页面有效时间为5分钟
$timeFlag = time() - $_POST['time'] > 300 ? true : false;
if ($_POST['token'] != md5('house365' . $_POST['time'] . $this->user_id) || $timeFlag || $sessionToken != 1) {
$msg = '页面已过期!请重新刷新页面';
}
if (!empty($msg)) {
$result['msg'] = iconv('gbk','utf8', $msg);
exit(json_encode($result));
}
$url = $this->doBindZmxy($_POST);
$result['status'] = 1;
$result['url'] = $url;
exit(json_encode($result));
}
$this->load->view('bind_zmxy',$data);
}
private function doBindZmxy($data)
{
$userInfo = array(
'name' => iconv('gbk', 'utf8', $data['truename']),
'certNo' => $data['idno'],
'certType' => 'IDENTITY_CARD'
);
$state = $userInfo;
$state['userId'] = $this->user_id;
$bizParams = array(
'auth_code' => 'M_APPPC_CERT',
'channelType' => 'apppc',
'state' => json_encode($state)
);
//业务参数数组
$params = array(
'identity_type' => '2',
'identity_param' => json_encode($userInfo),
'biz_params' => json_encode($bizParams)
);
$this->load->library("zmop_class");
$this->zmop_class->setRsaPriKeyFile(ZMXY_PRIVATE_KEY);
$this->zmop_class->setRsaPubKeyFile(ZMXY_PUBLIC_KEY);
$sign = $this->zmop_class->getSignature($params);
$encryptData = $this->zmop_class->encrypt($params);
// 公共参数数组
$sParam = array(
'app_id' => ZMXY_APPID,
'method' => "zhima.auth.info.authorize",
'charset' => "utf-8",
'version' => "1.0",
'params' => $encryptData,
'sign' => $sign
);
$str = http_build_query($sParam);
$url = 'https://zmopenapi.zmxy.com.cn/openapi.do?' . $str;
//添加日志记录
$logData = array(
'user_id' => $this->user_id,
'truename' => $data['truename'],
'idno' => $data['idno'],
'ip' => get_ip(),
'created_time' => time()
);
$this->user_model->addAuthLog($logData);
return $url;
}
public function zmxyCallback()
{
if (!defined('OPEN_ZMXY')) {
exit('该城市暂未开通此功能!');
}
$params = $this->input->get('params');
$sign = $this->input->get('sign');
if (empty($params) || empty($sign)) {
exit('参数缺失!');
}
//含有%则urldecode
$params = strstr ( $params, '%' ) ? urldecode ( $params ) : $params;
$sign = strstr ( $sign, '%' ) ? urldecode ( $sign ) : $sign;
$this->load->library("zmop_class");
$this->zmop_class->setRsaPriKeyFile(ZMXY_PRIVATE_KEY);
$this->zmop_class->setRsaPubKeyFile(ZMXY_PUBLIC_KEY);
//解密数据
$decryptData = $this->zmop_class->decrypt($params);
//验签
$result = $this->zmop_class->verify($decryptData, $sign);
if (!$result) {
exit('签名错误!');
}
parse_str($decryptData, $paramList);
if ($paramList['success'] == 'false' && !empty($paramList['error_message'])) {
$paramList['error_message'] = iconv('utf8', 'gbk', $paramList['error_message']);
$msg = "绑定失败!失败原因:" . $paramList['error_message'];
exit($msg);
}
//更新用户数据
$state = json_decode($paramList['state'], true);
if ($this->user_id != $state['userId']) {
exit('用户信息异常!');
}
$checkData = $this->user_model->checkIdNo($state['certNo'], $this->user_id);
if (!$checkData['result']) {
exit($checkData['msg']);
}
if (empty($state['name']) || empty($state['certNo']) || empty($paramList['open_id'])) {
exit('数据异常!');
}
$updateData['truename'] = iconv('utf8', 'gbk', $state['name']);
$updateData['idno'] = $state['certNo'];
$updateData['auth_type'] = 1;
$updateData['auth_open_id'] = $paramList['open_id'];
$this->user_model->updateuser($this->user_id, $updateData);
header('Location:' . GB_CRNTER_URL . 'user/bind_zmxy/');
}
/**
* 修改个人资料
* @author cxf
*/
function edit_profile()
{
$_SESSION['token'] = md5($this->user_id);
$data['js'] = '<script type="text/javascript" src="'.USER_CENTER.'js/jquery.Jcrop.min.js"></script>';
$data['conf_where'] = 'edit_profile';
$data['title'] = '修改资料';
$data['user_detail_old'] = $this->user_model->get_userdetail($this->user_id,array('username','email','sex','birthdate'));
if($_POST)
{
if($_POST['token'] != $_SESSION['token'])
{
//echo $_POST['token']."<br/>";
//echo $_SESSION['token']."<br/>";
echo "<script> alert('请输入正确的验证');</script>";die;
}
$arr['email'] = $this->input->post('email');
$arr['sex'] = $this->input->post('sex');
$arr['birthdate'] = strtotime($this->input->post('year')."-".$this->input->post('month')."-".$this->input->post('day'));
//var_dump($arr['birthdate']);exit;
$url = GB_UPDATE_USER_INFO_BY_USER_ID_URL . '?city=nj='.GB_CITY.'&email='.$arr['email'].'&uid='.$this->user_id . '&sex=' . $arr['sex'] . '&birthdate=' . $arr['birthdate'];
$res = curl_get_contents( $url );
$res = !empty( $res ) ? json_decode( $res, 1) : array();
if ( $res['result'] != 1 ) {
echo "<script> alert(". $res['msg'] . ");</script>";die;
}
$result = $this->user_model->updateuser($this->user_id,$arr);
}
$data['user_detail'] = $this->user_model->get_userdetail($this->user_id,array('username','email','sex','birthdate','head_pic'));
//BI统计 ----- start----->
$data['isa_website'] = '2,19,83';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$this->load->view('edit_profile',$data);
}
/**
* 修改密码
* @author cxf
*/
function edit_password()
{
$_SESSION['token'] = md5($this->user_id);
$data['js']= '<script type="text/javascript" src="'.USER_CENTER.'js/Validform_v5.3.2_ncr_min.js"></script>';
$select = array('telno');
$data['user'] = $this->user_model->get_userdetail($this->user_id,$select);
$data['conf_where'] = 'edit_password';
$data['title'] = '修改密码';
if($_POST)
{
if($_POST['token'] != $_SESSION['token'])
{
//echo $_POST['token']."<br/>";
//echo $_SESSION['token']."<br/>";
//echo "<script> alert('请输入正确的验证');</script>";die;
}
$newpassword = $this->input->post('newpassword');
$againpassword = $this->input->post('againpassword');
$password = $this->input->post('password');
if($newpassword == $againpassword)
{
$result = $this->user_model->yzloginuser($this->user_id,md5($password));
if( $result > 0 )
{
$result_pass = $this->user_model->updatepassowrdbyuid($this->user_id,$newpassword);
echo $result_pass ? 1 : 4;
exit;
}else{
echo 3;
exit;
}
}
else
{
echo 2;
exit;
}
}
$this->load->view('edit_password',$data);
}
/**
* 修改电话号码
* @author cxf
*/
function edit_telno()
{
$_SESSION['token'] = md5($this->user_id);
$data['conf_where'] = 'edit_telno';
$data['title'] = '修改手机号码';
$data['js']= '<script type="text/javascript" src="'.USER_CENTER.'js/code.js"></script><script type="text/javascript" src="'.USER_CENTER.'js/Validform_v5.3.2_ncr_min.js"></script>';
$select = array('telno');
$data['user'] = $this->user_model->get_userdetail($this->user_id,$select);
if($_POST)
{
if($_POST['token'] != $_SESSION['token'])
{
//echo $_POST['token']."<br/>";
//echo $_SESSION['token']."<br/>";
echo "<script> alert('请输入正确的验证');</script>";die;
}
$telno = $this->input->post('telnoold');
$telnonew = $this->input->post('telno');
$validcode = $this->input->post('validcode');
$kind = $this->input->post('kind');
//验证手机号是否存在
$result2 = $this->user_model->yztelnolt($telnonew);
if($result2)
{
echo 3;
exit;
}
//验证短信验证码是否正确
$result = $this->user_model->yzusersms($validcode,$telnonew,$kind);
if($result>0)
{
$result_pass = $this->user_model->updatetelnobyuid($this->user_id,$telnonew);
if($result_pass)
{
$this->user_model->SyncPhoneUserCenter($this->user_id, $telno, $telnonew);
//修改已经绑定的400号码
$this->load->model("esf_400_model");
$this->esf_400_model->update_telno($this->user_id , $telnonew ,$telno);
}
echo $result_pass ? 1 : 0;
if($result2[0]['id']>0 && $result2[0]['infofrom']==2)
{
//对原有账号进行失效操作
$this->user_model->updateuser($result2[0]['id'],array('is_use'=>0));
//对原有房源进行id修改
$this->house_model->updatehouseuid($result2[0]['id'],$this->user_id,'sell');
$this->house_model->updatehouseuid($result2[0]['id'],$this->user_id,'rent');
}
exit;
}
else
{
echo 2;
exit;
}
}
$this->load->view('edit_telno',$data);
}
/**
* 编辑头像文件
* @author cxf
*/
function edit_headfile()
{
if($this->input->post("action") == 'headfile')
{
$fileurl = common_file_upload("headfile", false, false, 340, 220);
if($fileurl)
{
echo "<script>window.parent.setHeadimgsrc('".$fileurl."');window.parent.document.getElementById('headpic').value='".$fileurl."';window.parent.jcSetImage();window.parent.changeShowPic('headShowPic');</script>";
}
else
{
echo "<script>window.parent.document.getElementById('jsUploadHeadPortrait').style.display = 'none';window.parent.document.getElementById('jsDialogE_msg').innerHTML='图片上传失败,请重试!';window.parent.openWin('jsDialogE');setTimeout(function(){window.parent.location.reload();},1000);</script>";
}
exit;
}
else if( $this->input->post("action") == 'savehead' )
{
$headpic = trim($this->input->post("headpic"));
$x = floatval($this->input->post("x"));
$y = floatval($this->input->post("y"));
$w = floatval($this->input->post("w"));
$h = floatval($this->input->post("h"));
$picfile = curl_get_contents($headpic);
if( $picfile )
{
$targ_w = $w;
$targ_h = $h;
$jpeg_quality = 100;
//FISHER 2013-6-22
//获取远程图片再裁剪处理,然后还要FTP上传到图片服务器,目前只能在本地创建临时文件,想不出其他办法了。
$filename = GB_CITY.'_'.md5($headpic).".jpg";
$cachefile = APPPATH."/cache/".$filename;
if($handle = fopen($cachefile, "wb") && $targ_w > 0 && $targ_h > 0)
{
$img_r = imagecreatefromstring($picfile);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$x,$y,$targ_w,$targ_h,$w,$h);
imagejpeg($dst_r, $cachefile, $jpeg_quality);
@fclose($handle);
$_FILES['headfile']['nocheck'] = "house365";//uploadfile 类会检查这个文件是否是POST提交的文件,没办法啊绕过去。
$_FILES['headfile']['name'] = $filename;
$_FILES['headfile']['type'] = 'image/pjpeg';
$_FILES['headfile']['tmp_name'] = $cachefile;
$_FILES['headfile']['error'] = 0;
$_FILES['headfile']['size'] = @filesize($cachefile);
$this->load->library('uploadfile_class',array('filename'=>"headfile"));
$this->uploadfile_class->setFileType("jpg");
$this->uploadfile_class->setMaxSize(5120);
$this->uploadfile_class->setUploadType("ftp");
$this->uploadfile_class->setSaveDir("/".GB_CITY."house/");
$this->uploadfile_class->setWatermark(false);
$this->uploadfile_class->setImageCut(false);
if ($this->uploadfile_class->upload() == "success")
{
$headpicurl = $this->uploadfile_class->getSaveFileURL(); //图片地址
}
else
{
$headpicurl = "";
}
@unlink($cachefile);
if($headpicurl != "")
{
//更新用户头像
$id = $this->user_model->updateheadpic($this->user_id,$headpicurl);
if($id > 0)
{
echo "<script>window.parent.openWin('upfile-ok');</script>";
}
else
{
echo "<script>window.parent.openWin('warning');</script>";
}
}
else
{
echo "<script>window.parent.openWin('warning');</script>";
}
}
else
{
echo "<script>window.parent.openWin('warning');setTimeout(function(){window.parent.location.reload();},1000);</script>";
}
}
else
{
echo "<script>window.parent.openWin('warning');setTimeout(function(){window.parent.location.reload();},1000);</script>";
}
exit;
}
}
/**
* 我的问答
* @author cxf
*/
function myask()
{
$data['conf_where'] = 'ask';
$data['title'] = '我的问答';
//分页开始
$data['ask_num'] = $this->ask_model->getquelistnum($this->user_id);
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['ask_num'] ? ceil($data['ask_num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page'] > $data['pages']) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
//获取问题列表
$data['asklist'] = $this->ask_model->getquelist($this->user_id,$data['offset'],$data['pagesize']);
$data['expertslist'] = $this->ask_model->getexperts();
//BI统计 ----- start----->
$data['isa_website'] = '2,19,99';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
//print_r($data);die;
$this->load->view('myask',$data);
}
/**
* 提问详情页跳转页
* @author cxf
*/
function qdetail($qid)
{
$arr=array('a_qid'=>$qid,'a_esta'=>1,'a_read'=>0);
$up= array('a_read'=>1);
$this->user_model->set_table('qa_answer');
$result = $this->user_model->save($arr,$up,'esfhouse');
//更新问答未读的cookie
$ask_num = $this->ask_model->getnewanswerbyuid($this->user_id);
setcoandsess('esfasknum',$ask_num);
echo '<script language="javascript">location= "'.get_questioninfo_url($qid).'";</script>';
}
/**
* 我的消息
* @author cxf
*/
function mymessage()
{
$data['conf_where'] = 'message';
$data['title'] = '我的消息';
//删除操作
if(isset($_POST['muldel']) && $_POST['muldel']=='del')
{
$result = $this->user_model->delmessage($_POST['actionid']);
echo $result;
exit;
}
//更新消息的点击状态
$this->user_model->updateannounceclick($this->user_id);
$data['num'] = $this->user_model->getmessagenumbyuid($this->user_id);
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['num'] ? ceil($data['num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
$data['message'] = $this->user_model->getmessagebyuid($this->user_id,$data['offset'],$data['pagesize']);
//BI统计 ----- start----->
$data['isa_website'] = '2,19,82';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$this->load->view('mymessage',$data);
}
function updateread()
{
$ids = $this->input->post("ids");
if(!empty($ids))
{
$id_arr = explode(',',$ids);
foreach($id_arr as $value)
{
$result = $this->user_model->updateannounce($value);
}
}else{
$result = $this->user_model->updateannounce($this->input->post("id"));
}
echo $result;
}
/**
* 实名认证弹窗
* @return array
*/
private function realNameData(){
$data = array();
$data['userInfo'] = $this->user_model->get_userdetail($this->user_id,array('truename','idno','auth_type','auth_open_id','passport_uid'));
// $data['imgUrl'] = 'http://mtt.house365.com/H5/pctoapp/index.php?city=nj&TFRouteType=1058&TFRouteParm=' .urlencode(urlencode('type=3&uuid='.$data['userInfo'][0]['passport_uid']));
// $data['imgUrl'] = 'http://newrent.house365.com/api/common/get-qr-code?size=144&margin=0&url='.urlencode($data['imgUrl']);
$data['imgUrl'] = '/images/downloadTFApp.png';
$data['imgUrlbg2'] = '/images/smbg2.png';
$data['imgUrlbg1'] = '/images/mybg.png';
if(GB_CITY == 'wh'){
$data['publishUrlSell'] = 'http://publish.wh.house365.com/?newWh=1&kind=1';
}else{
$data['publishUrlSell'] = "http://".GB_CITY.".publish.house365.com";
}
if(GB_CITY == 'nj'){
$data['publishUrlRent'] = "http://publish.house365.com/nj/publish";
}else if(GB_CITY == 'wh'){
$data['publishUrlRent'] = "http://publish.wh.house365.com/?newWh=1&kind=2";
}else{
$data['publishUrlRent'] = " http://".GB_CITY.".publish.house365.com/?kind=2";
}
return $data;
}
/**
* 我的房源二手房
* @author cxf
*/
function myhousesell()
{
header("Location:http://newrent.house365.com/user-center/sell-list");
die;
$data['conf_where'] = 'housesell';
$data['title'] = '我的房源';
$this->load->model('package_model');
$data['limitNumGtZero'] = $this->package_model->getLimitNumGtZero();
$data = array_merge($data,$this->realNameData());
if($_POST)
{
$id = $this->input->post('id');
$type = $this->input->post('type');
$code = $this->input->post('code');
$infotype = $this->input->post('infotype');
$payday = $this->input->post('payday');
$paytype = $this->input->post('paytype');
//推广处理
if($type =='tg'){
//更新房源状态,改为有意向
$result = $this->house_model->updatehouse($id,'sell',array('ischarge'=>'2'));
//记录客户意向
$result1 = $this->user_model->addusercharge($id, $paytype , $payday,$this->user_id );
if($result1>0)
{
//发送消息
$subject='您的房源推广申请已提交。';
$msg='您编号为"'.$id.'"的房源推广申请正在审核中,请耐心等待。';
$this->apply_class->send_systemmsg($this->user_id,$subject,$msg,1,GB_CITY);
//添加成功
echo '1';exit;
}else{
//添加失败
echo '3';exit;
}
}
//验证
if(md5($id.'house365')==$code)
{
if($type =='refresh')
{
//验证刷新可用次数
$num = $this->house_model->yzrefrshnum($this->user_id,$id,'sell');
//获取今日已刷新次数
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$this->house_statistic_model->set_nocache(1);
$arr = $this->house_statistic_model->get_operate_list(2,$id,date("Y-m-d"));
//获得实际可刷新次数
$num = $num - count($arr);
if($num>0)
{
//更新房源刷新时间
$result = $this->house_model->updatehouse($id,'sell',array('updatetime'=>time()));
//记录刷新操作
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$result = $this->house_statistic_model->sub_operate_log('sell' , $id , 2 );
if($result['is_ok'] == 1)
{
//发送消息
$subject='您的房源刷新成功';
$msg='您编号为"'.$id.'"房源刷新成功。如有疑问,请联系客服。';
$this->apply_class->send_systemmsg($this->user_id,$subject,$msg,1,GB_CITY);
//刷新成功
$arr1['msg'] = 1;
$arr1['num'] = $num-1;
print json_encode($arr1);exit;
}else{
//刷新失败
$arr1['msg'] = 4;
$arr1['num'] = $num;
print json_encode($arr1);exit;
}
}else{
//刷新次数不足
$arr1['msg'] = 3;
$arr1['num'] = $num;
print json_encode($arr1);exit;
}
}elseif($type =='del'){
//更新房源状态,相当于失效状态
$result = $this->house_model->updatehouse($id,'sell',array('esta'=>'2'));
//记录再发布操作
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$result1 = $this->house_statistic_model->sub_operate_log('sell' , $id , 3 );
if($result>0)
{
//删除成功
echo '1';
exit;
}else{
//删除失败
echo '3';
exit;
}
}
elseif($type =='again_pub')
{
//更新房源状态
if(GB_CITY == 'nj')
{
if($infotype==1 or $infotype==2)
{
$expiretime = strtotime("+45 day");
}
else if($infotype==3 or $infotype==4 or $infotype==5 or $infotype==6)
{
$expiretime = strtotime("+60 day");
}
}
else
{
$expiretime = strtotime("+90 day");
}
$result = $this->house_model->republishhouse($id,'sell',array('esta'=>'1','creattime'=>time(),'updatetime'=>time(),'expiretime'=>$expiretime),GB_CITY);
//记录再发布操作
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
//$result1 = $this->house_statistic_model->sub_operate_log('sell' , $id , 5 ,1);
if($result>0)
{
$this->load->model('user_model');
//增加云信accid
$this->user_model->yunxin_accid($this->user_id);
//再发布成功
echo '1';exit;
}else{
//再发布失败
echo '3';exit;
}
}else{
//验证不通过,来源不正确
echo '2';exit;
}
}else{
//验证不通过,来源不正确
echo '2';exit;
}
}
$data['num'] = $this->house_model->gethousenumbyuid($this->user_id,'sell');
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['num'] ? ceil($data['num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
if(GB_CITY=='nj' || GB_CITY=='wh')
{
$data['house_array'] = $this->house_model->gethousebyuid($this->user_id,'sell',array('id','address','buildarea','price','updatetime','creattime','esta','ischarge','pic1','district','streetid','blockshowname','infotype','room','hall','fitment','buildarea','ischarge','telno','floor ','subfloor','totalfloor','survey'),$data['offset'],$data['pagesize']);
}
else
{
$data['house_array'] = $this->house_model->gethousebyuid($this->user_id,'sell',array('id','address','buildarea','price','updatetime','creattime','esta','ischarge','pic1','district','streetid','blockshowname','infotype','room','hall','fitment','buildarea','ischarge','telno','floor ','subfloor','totalfloor'),$data['offset'],$data['pagesize']);
}
if (is_array($data['house_array'])) {
if(GB_CITY=='nj'){
$this->load->model('survey_model');
$modelSurvey = new Survey_model();
}elseif(GB_CITY == 'wh'){
$this->load->model('vr_model');
$modelSurvey = new Vr_model();
}
foreach($data['house_array'] as &$value) {
$value['survey_status'] = '';
$value['can_survey'] = false;
$value['show_survey_icon'] = false;
if(intval($value['esta']) != 1){
$value['survey'] = 0;
}
if ($data['limitNumGtZero'][5]['sell'] && intval($value['survey']) != 1 && intval($value['esta']) == 1 && in_array(GB_CITY, array_keys($this->surveyConfig)) && in_array(intval($value['infotype']), $this->surveyConfig[GB_CITY]['surveyInfotype']) && in_array($value['district'], $this->surveyConfig[GB_CITY]['surveyDistrict'])) {
$value['can_survey'] = true;
}
if(intval($value['survey']) == 1) {
if(GB_CITY=='nj'){
$surveyInformation = $modelSurvey->getInformation('sell', $value['id']);
$status = isset($surveyInformation[0]['status']) ? intval($surveyInformation[0]['status']) : 0;
if ($status == 3 && !empty($surveyInformation[0]['time_order']) && time() > intval($surveyInformation[0]['time_order'])) {
$status = 4;
}
if($status != 2){
$value['show_survey_icon'] = true;
}
$value['survey_status'] = isset($this->surveyStatus[$status]) ? $this->surveyStatus[$status] : '实勘未知状态';
}elseif(GB_CITY=='wh'){
$surveyInformation = $modelSurvey->getVrInfoByHouseId('sell', $value['id']);
if($surveyInformation){
$value['show_survey_icon'] = $surveyInformation['show_icon'];
$value['survey_status'] = $surveyInformation['vr_status_word'];
}
}
}
//获取房源已有套餐
if(in_array(GB_CITY,$this->openPayCitys)){
$packageData = $this->package_model->getHousePackageNew($value['id'],'sell');
if($packageData){
if(isset($packageData['leftTime'])) $value['leftTime'] = $packageData['leftTime'];
if(in_array(1,$packageData['package_types']) || in_array(2,$packageData['package_types']) || in_array(3,$packageData['package_types'])){
$value['promoting'] = 1;
}else{
$value['promoting'] = 0;
}
}
}
}
}
//中奖通知 5.25-8.31
$data['is_win'] = $this->_get_is_win();
//BI统计 ----- start----->
$data['isa_website'] = '2,19,72';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$data['userInfo'] = $this->user_model->get_userdetail($this->user_id,array('truename','idno','auth_type','auth_open_id','passport_uid','bank_type'));
$this->load->view('myhousesell',$data);
}
/**
* 我的房源二手房
* @author cxf
*/
function myhouserent()
{
header("Location:http://newrent.house365.com/user-center/rent-list");
die;
global $house;
$data['conf_where'] = 'houserent';
$data['title'] = '我的房源';
$data = array_merge($data,$this->realNameData());
$this->load->model('package_model');
$data['limitNumGtZero'] = $this->package_model->getLimitNumGtZero();
if($_POST)
{
$id = $this->input->post('id');
$type = $this->input->post('type');
$code = $this->input->post('code');
$infotype = $this->input->post('infotype');
$payday = $this->input->post('payday');
$paytype = $this->input->post('paytype');
//推广处理
if($type =='tg'){
//更新房源状态,改为有意向
$result = $this->house_model->updatehouse($id,'rent',array('ischarge'=>'2'));
//记录客户意向
$result1 = $this->user_model->addusercharge($id, $paytype , $payday,$this->user_id,'rent' );
if($result1>0)
{
//发送消息
$subject='您的房源推广申请已提交。';
$msg='您编号为"'.$id.'"的房源推广申请正在审核中,请耐心等待。';
$this->apply_class->send_systemmsg($this->user_id,$subject,$msg,1,GB_CITY);
//添加成功
echo '1';exit;
}else{
//添加失败
echo '3';exit;
}
}
//验证
if(md5($id.'house365')==$code)
{
if($type =='refresh')
{
//验证刷新可用次数
$num = $this->house_model->yzrefrshnum($this->user_id,$id,'rent');
//获取今日已刷新次数
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$this->house_statistic_model->set_nocache(1);
$arr = $this->house_statistic_model->get_operate_list(2,$id,date("Y-m-d"));
//获得实际可刷新次数
$num = $num - count($arr);
if($num>0)
{
//更新房源刷新时间
$result = $this->house_model->updatehouse($id,'rent',array('updatetime'=>time()));
if(empty($result))
{
$arr1['msg'] = 4;
$arr1['num'] = $num;
print json_encode($arr1);exit;
}
//记录刷新操作
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$result = $this->house_statistic_model->sub_operate_log('rent' , $id , 2,1);
if($result['is_ok'] == 1)
{
//发送消息
$subject='您的房源刷新成功';
$msg='您编号为"'.$id.'"房源刷新成功。如有疑问,请联系客服。';
$this->apply_class->send_systemmsg($this->user_id,$subject,$msg,1,GB_CITY);
//刷新成功
$arr1['msg'] = 1;
$arr1['num'] = $num-1;
print json_encode($arr1);exit;
}else{
//刷新失败
$arr1['msg'] = 4;
$arr1['num'] = $num;
print json_encode($arr1);exit;
}
}else{
//刷新次数不足
$arr1['msg'] = 3;
$arr1['num'] = $num;
print json_encode($arr1);exit;
}
}elseif($type =='del'){
//更新房源状态
$result = $this->house_model->updatehouse($id,'rent',array('esta'=>2));
//记录再发布操作
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$result1 = $this->house_statistic_model->sub_operate_log('rent' , $id , 3 );
if($result>0)
{
//通知爱租哪
if(GB_CITY == 'nj' || GB_CITY == 'hf')
{
$houseData = $this->house_model->gethousebywhere(array('id' => $id),'rent',array('iszhizu'),1);
if(!empty($houseData) && $houseData[0]['iszhizu'] == '1')
{
$url = 'http://mtapi.house365.com/?method=zhizu.ApiRent_syncEsf2AznStatus&city='.GB_CITY.'&id='.$id.'&esta=2&uid='.$this->user_id;
curl_get_contents($url);
}
}
//删除成功
echo '1';exit;
}
else
{
//删除失败
echo '3';exit;
}
}
elseif($type =='again_pub')
{
//更新房源状态
if(GB_CITY == 'nj')
{
if($infotype == 1 or $infotype == 2)
{
$expiretime = strtotime("+35 day");
}
else if($infotype==3 or $infotype==4 or $infotype==5 or $infotype==6)
{
$expiretime = strtotime("+60 day");
}
}
else
{
$expiretime = strtotime("+90 day");
}
$result = $this->house_model->republishhouse($id,'rent',array('esta'=>1,'creattime'=>time(),'updatetime'=>time(),'expiretime'=>$expiretime),GB_CITY);
//记录再发布操作
$this->house_statistic_model->set_uid($this->user_id);
$this->house_statistic_model->set_city(GB_CITY);
$result1 = $this->house_statistic_model->sub_operate_log('rent' , $id , 5 );
if($result>0)
{
//通知爱租哪
if(GB_CITY == 'nj' || GB_CITY == 'hf')
{
$houseData = $this->house_model->gethousebywhere(array('id' => $id),'rent',array('iszhizu'),1);
if(!empty($houseData) && $houseData[0]['iszhizu'] == '1')
{
$url = 'http://mtapi.house365.com/?method=zhizu.ApiRent_syncEsf2AznStatus&city='.GB_CITY.'&id='.$id.'&esta=1&uid='.$this->user_id;
curl_get_contents($url);
}
}
$this->load->model('user_model');
//增加云信accid
$this->user_model->yunxin_accid($this->user_id);
//再发布成功
echo '1';exit;
}else{
//再发布失败
echo '3';exit;
}
}else{
//验证不通过,来源不正确
echo '2';exit;
}
}else{
//验证不通过,来源不正确
echo '2';exit;
}
}
$data['num'] = $this->house_model->gethousenumbyuid($this->user_id,'rent');
$data['pagesize'] = 8;//设定每一页显示的记录数
$data['pages'] = $data['num'] ? ceil($data['num']/$data['pagesize']) : 0 ; //计算总页数
$data['page'] = $this->uri->segment(3) ? intval($this->uri->segment(3)) :1 ; // 获取当前页数
$data['page'] = ($data['page']>$data['pages'] && $data['pages']!=0) ? $data['pages'] : $data['page']; //判断跳转页数
$data['offset'] = $data['pagesize']*($data['page']-1); //计算记录偏移量
//获取房源
$data['house_array'] = $this->house_model->gethousebyuid($this->user_id,'rent',array('id','address','buildarea','price','updatetime','creattime','esta','ischarge','pic1','district','streetid','blockshowname','infotype','room','hall','fitment','buildarea','priceunit','ischarge','telno','floor ','subfloor','totalfloor'),$data['offset'],$data['pagesize']);
//获取房源已有套餐
if(in_array(GB_CITY,$this->openPayCitys)){
foreach($data['house_array'] as &$value) {
$packageData = $this->package_model->getHousePackageNew($value['id'],'rent');
if($packageData){
if(isset($packageData['leftTime'])) $value['leftTime'] = $packageData['leftTime'];
if(in_array(1,$packageData['package_types']) || in_array(2,$packageData['package_types']) || in_array(3,$packageData['package_types'])){
$value['promoting'] = 1;
}else{
$value['promoting'] = 0;
}
}
}
}
$data['priceunit'] = $house['priceunit'];
//中奖通知 5.25-8.31
$data['is_win'] = $this->_get_is_win();
//BI统计 ----- start----->
$data['isa_website'] = '2,19,73';
$data['isa_city'] = GB_CITY;
$data['isa_addones'] = '';
$data['isa_url'] = 'isa.house365.com/js/analyze.js?v=2.1';
//BI统计 ----- ent----->
$data['userInfo'] = $this->user_model->get_userdetail($this->user_id,array('truename','idno','auth_type','auth_open_id','passport_uid','bank_type'));
$this->load->view('myhouserent',$data);
}
/**
* 获取当前会员是否获取奖品
*
*/
private function _get_is_win()
{
$result = array();
if(GB_CITY == 'nj' && false)
{
$time = time();
$start_date = mktime(0,0,0,5,25,date('Y'));
$end_date = mktime(23,59,59,12,23,date('Y'));
if($start_date <= $time && $time <= $end_date)
{
$user_data = $this->user_model->get_user_data($this->user_id);
if(!empty($user_data) && !empty($user_data['telno']))
{
$result = $this->user_model->check_is_win($this->user_id,$user_data['telno'],$start_date,$end_date);
}
}
}
return $result;
}
//价格提醒处理ajax
function price_remind_ajax(){
// error_reporting(7);
// ini_set("display_errors",true);
$this->load->model("user_model");
$houseid = $this->input->post('houseid');
$type = $this->input->post('type');
$flag = $this->input->post('flag');
$priceRemindNum = $this->user_model->getPriceRemindNum($this->user_id);
if($priceRemindNum>=5&&$flag==1){//满4条提示
$result = 3;
}else{
$isChoice = $this->user_model->isCheckPriceRemind($this->user_id,$houseid);
//var_dump($isChoice);exit();
if(is_array($isChoice)){
if(empty($isChoice)&&$flag==1){
$result = $this->user_model->addPriceRemind($houseid,$this->user_id);
//echo "444";
}elseif($isChoice[0]['status']==1&&$flag==0){
$result = $this->user_model->updatePrcieRemind($houseid,$this->user_id,0);
}elseif($isChoice[0]['status']==0&&$flag==1){
$result = $this->user_model->updatePrcieRemind($houseid,$this->user_id,1);
}
}
}
echo $result = $result ? $result :0;
}
public function pay(){
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
if(GB_CITY != 'nj' && GB_CITY != 'wh'){
return $this->jump(USER_CENTER,'该城市暂未开通此功能!',3000,'warning');
}
//定义支持的支付类型
$payTypeArr = array('wxpay');
//获取房源属性
$packageId = intval($this->input->post('package_id',true));
$houseId = intval($this->input->post('house_id',true));
$tbl = addslashes($this->input->post('tbl',true));
$packageType = intval($this->input->post('package_type',true));
$packageKeyword = intval($this->input->post('package_keyword',true));
$day = intval($this->input->post('day_'.$packageType,true));
$payType = addslashes($this->input->post('pay_type',true));
// 是否使用优惠券
$use_coupon = intval($this->input->post('use_coupon',true));
// 优惠券ID
$coupon_id = intval($this->input->post('coupon_id',true));
$from_url = $this->input->post('from_url',true);
if(empty($packageId) || empty($houseId) || empty($tbl) || empty($packageType) || (!in_array($packageType,array(4,5)) && empty($day)) || empty($payType) || !in_array($payType,$payTypeArr)){
return $this->jump(USER_CENTER,'参数缺失',3000,'warning');
}
$searchArr['id'] = $houseId;
$searchArr['uid'] = $this->user_id;
$searchArr['infofrom'] = 1;
$searchArr['esta'] = 1;
//获取房源信息
$houseData = $this->house_model->gethousebywhere($searchArr,$tbl,array('id,infofrom,infotype,district,telno'),1);
if(empty($houseData)){
return $this->jump(USER_CENTER,'房源状态异常',3000,'warning');
}
//获取联系人手机号
if(GB_CITY == 'nj' && $houseData[0]['infofrom'] == 1){
$tbl_ext = $tbl == 'rent' ? 'rent_ext' : 'sell_ext';
$telno = $this->house_model->getHouseTel($houseId,$tbl_ext);
if($telno){
$houseData[0]['telno'] = $telno;
}
}
$infoType = $houseData[0]['infotype'] == 1 ? 1 : 2;
//加载套餐model类
$this->load->model("package_model");
$packageData = $this->package_model->getDetailById($packageId);
if(empty($packageData)){
return $this->jump(USER_CENTER,'套餐状态异常',3000,'warning');
}
//价格数据
$packageData['package_desc'] = unserialize($packageData['package_desc']);
foreach($packageData['package_desc'] as $item){
if($packageType == 4){
$price = $originalPrice = floatval($item['price']);
}else if($packageType == 5){
if($item['property_type'] == $infoType){
$price = $originalPrice = floatval($item['price']);
//处理折扣
if(isset($item['discount']) && $item['discount'] >0){
$price = $originalPrice = $this->pirceDiscount($price,$item['discount']);
}
}
}else{
if($item['property_type'] == $infoType && $item['day'] == $day){
$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']);
}
}
// 列表套餐8折券使用 20200507
// 优惠券修改为 6折
// if( GB_CITY == 'nj' && $packageType == 2 && $tbl == 'rent'){
// //
// $checkbox_status = 0;
// // 检查是否有可用的优惠券,如果有则使用,如果无,则跳转提示
// $userInfoData = $this->user_model->getuserdetail($this->user_id);
// $passport_uid = $userInfoData ? $userInfoData['passport_uid'] : 0;
//
// // 测试数据
// $couponUserIdArr = array('1785149','3367096','4112782');
// if( in_array($this->user_id,$couponUserIdArr) ){
// $price = 0.05;
// }
//
// if( isset($use_coupon) && $use_coupon == 1){
//
// $check_coupon = $this->rent_coupon_model->checkCoupon($passport_uid);
// if( !$check_coupon ){
// $from_url = $from_url ? $from_url : USER_CENTER;
// return $this->jumpNew($from_url,'已有待支付订单,勿重复下单!<br/>请30分钟后再试。',3000,'warning');
// }
// $checkbox_status = 1;
// // 列表优先套餐8折
// // 修改为6折 20200927
// $price = sprintf("%.2f",$price * 0.6);
// // 锁定半小时
// $this->rent_coupon_model->lockCoupon($passport_uid);
//
//
// }
//
// // 设置8折优惠券的选中状态
// $this->rent_coupon_model->setCheckbox($passport_uid,$checkbox_status);
//
// }
}
}
}
// 使用优惠券
if ( GB_CITY == 'nj' ) {
if( isset( $use_coupon ) && $use_coupon == 1 ) {
$couponRes = $this->user_model->checkCoupon( $this->user_id, $coupon_id, $price, $packageType );
if ( isset( $couponRes['result'] ) && $couponRes['result'] == 1 ) {
$price = $price - $couponRes['data']['coupon_price'] ;
}
}
}
$userIdArr = array(4112782,5355879,1729793,4449390,6264549);
if(in_array($this->user_id,$userIdArr)){
$price = $price * 0.01;
}
// 付款方式
$payType = $price <= 0 ? 'zeroyuanpay' : $payType;
//校验参数正确性
// if($packageType != $packageData['package_type'] || empty($price) || $price <= 0){
// return $this->jump(USER_CENTER,'套餐价格数据异常',3000,'warning');
// }
if($packageType != $packageData['package_type']){
return $this->jump(USER_CENTER,'套餐数据异常',3000,'warning');
}
if($packageType == 1 && ( $packageKeyword != $packageData['package_keyword'] || $packageKeyword <= 0 ) ){
return $this->jump(USER_CENTER,'套餐关键词异常',3000,'warning');
}
//首页推荐需要限制数量
if($packageType == 1){
//已售出和已锁定的套餐数量
$count = $this->package_model->getPackageNum($packageKeyword,$tbl);
if($count >= $packageData['package_num']){
return $this->jump(USER_CENTER,'套餐已售完',3000,'warning');
}
}
//wh实勘限制购买数量
if($packageType == 5){
//城市限制
if (!in_array($houseData[0]['district'], $this->surveyConfig[GB_CITY]['surveyDistrict'])) {
return $this->jump(USER_CENTER,'所在区域实勘服务暂未开通',3000,'warning');
}
$this->load->model('vr_model');
$countVr = $this->vr_model->getVrApplyNowNum(1,3); //sell 个人房源
$countOrder = $this->package_model->getPackageOrderNumByType($packageType,$tbl); //未支付有效订单
if( $countVr+$countOrder >= $packageData['package_num']){
return $this->jump(USER_CENTER,'套餐已售完',3000,'warning');
}
}
//首页推荐和列表排序在有效期内不能同时购买(南京租房除外 修改日期2020/3/4)
//获取该房源的套餐状态
$housePackage = $this->package_model->getHousePackage($houseId,$tbl);
//获取禁止的套餐数组
$banHousePackage = array();
if(!empty($housePackage)){
foreach($housePackage as $k =>$v){
if($v == 1 || $v == 2){
if(GB_CITY == 'nj' && $tbl == 'rent'){
$banHousePackage[] = $v;
}else{
$banHousePackage[] = 1;
$banHousePackage[] = 2;
}
}
if($v == 3){
$banHousePackage[] = 3;
}
}
}
if(in_array($packageData['package_type'],$banHousePackage)){
return $this->jump(USER_CENTER,'请勿重复购买套餐',3000,'warning');
}
//创建订单
$tblArr = array('sell' => 1 ,'rent' => 2);
$tableId = $tblArr[$tbl];
$orderData = array();
$orderData['transaction_id'] = $this->package_model->getTransactionId( $packageType );
$orderData['user_id'] = $this->user_id;
$orderData['house_type'] = $tableId;
$orderData['house_id'] = $houseId;
$orderData['house_tel'] = $houseData[0]['telno'];
$orderData['package_id'] = $packageId;
$orderData['package_type'] = $packageType;
if($packageType == 1){
$orderData['package_keyword'] = $packageKeyword;
}
// 优惠券字段
if ( isset( $couponRes['result'] ) && $couponRes['result'] == 1 ) {
$orderData['coupon_name'] = isset( $couponRes['data']['name'] ) ? iconv('utf-8','gbk',$couponRes['data']['name']) : 0;
$orderData['coupon_price'] = isset( $couponRes['data']['coupon_price'] ) ? $couponRes['data']['coupon_price'] : 0;
$orderData['coupon_id'] = isset( $couponRes['data']['id'] ) ? $couponRes['data']['id'] : 0;
}
$orderData['package_days'] = $day;
$orderData['price'] = $price;
$orderData['create_time'] = time();
$orderData['pay_type'] = $payType;
$orderData['source'] = 1;
$orderData['ip'] = get_ip();
$orderId = $this->package_model->createOrder($orderData);
$orderData['id'] = $orderId;
//极小概率出现的订单号重复处理
if($orderId <= 0){
return $this->jump(USER_CENTER ,'订单创建失败',3000,'warning');
}
// 使用优惠券
if ( GB_CITY == 'nj' ){
if( isset( $use_coupon ) && $use_coupon == 1 ) {
$this->user_model->useCoupon( $orderData['transaction_id'], $this->user_id, $coupon_id, $originalPrice, $packageType );
// 0元支付
if ( $price <= 0 ) {
//支付成功后的操作
$result = $this->package_model->payFinish($orderData, array('transaction_id' => $this->package_model->getPaymentTransactionId( $packageType )));
if (GB_CITY == 'nj') {
$this->package_model->sendMsg( $orderData );
}
$data['orderData'] = $orderData;
$data['title'] = '0元支付';
$this->load->view('zero_yuan_pay', $data);
return;
}
}
}
$data = $this->getWxPayCodeByHouse365($orderId);
if($data['status'] != 1){
return $this->jump(USER_CENTER , $data['msg'],3000,'warning');
}
$data['orderData'] = $orderData;
$data['title'] = '微信支付';
$this->load->view('wxpay',$data);
}
/**
* 折扣
* @param $price
* @param $discount
*/
private function pirceDiscount($price,$discount){
return $price*$discount/10;
}
/**
* 向house365支付中台查询订单状态
* @param $transactionId
* @return string
*/
public function queryOrder($transactionId){
$data = array('status' => 0);
if(!in_array(GB_CITY,$this->openPayCitys)){
echo json_encode($data);exit;
}
$this->load->model("package_model");
$curlData = array();
$curlData['serviceCode'] = 'pay';
$curlData['serviceName'] = 'queryOrder';
$curlData['actId'] = $this->openPayCitysActId[GB_CITY];
$curlData['tradeNo'] = $transactionId;
$curlData['sign'] = $this->package_model->makeSign($curlData);
$url = 'https://pay.house365.com/house365-pay-web/rest/interface';
$result = SendDataByCurl($url,$curlData);
$result = json_decode($result,true);
if(!empty($result['status'])){
$result['status'] = iconv('utf-8','gbk',$result['status']);
}
if(!empty($result) && $result['result'] == 'SUCCESS' && $result['status'] == '支付成功'){
$data['status'] = 1;
//测试环境无法回调的处理
//$orderInfo = $this->package_model->getOrderInfoByTransactionId($transactionId);
//$this->package_model->payFinish($orderInfo);
}
echo json_encode($data);exit;
}
/**
* 根据订单ID生成微信支付二维码
* @param $orderId 订单ID
* @return array
*/
private function getWxPayCodeByHouse365($orderId){
//加载套餐model类
$data['status'] = 0;
$this->load->model("package_model");
$packageData = $this->package_model->getOrderInfoById($orderId);
if(empty($packageData) || $packageData['order_status'] == 0 || $packageData['pay_status'] == 1){
$msg = '订单信息异常';
$data['msg'] = $msg;
return $data;
}
$transaction_id = $packageData['transaction_id'];
$price = $packageData['price'];
$notifyUrl = 'http://user.house365.com/esf_center_api/notify?city='.GB_CITY;
//$price = 0.01;
//$notifyUrl = 'http://esfadmin.house365.com/test.php';
$packageTypeName = $this->package_model->getPackageTypeName($packageData['package_type']);
$subject = '个人房源增值服务-' . GB_CITY . '-' .$packageTypeName;
//拼接数组
$curlData = array();
$curlData['serviceCode'] = 'pay';
$curlData['serviceName'] = 'createAPPReceiptOrder';
//活动标识
switch (GB_CITY){
case 'nj' :
$curlData['actId'] = '57';
break;
case 'wh' :
$curlData['actId'] = '82';
break;
}
$curlData['tradeNo'] = $transaction_id;
$curlData['version'] = '1.0';
$curlData['notifyUrl'] = $notifyUrl;
$curlData['amount'] = $price * 100;
$curlData['city'] = GB_CITY;
$curlData['wechatTradeType'] = 1;
$curlData['subject'] = iconv('gbk','utf-8',$subject);
//订单过期时间为30分钟,考虑到网络延迟加上10S
$curlData['timeExpire'] = date("YmdHis", time() + 30 * 60 + 10);
$IpHostAllow =explode('.',get_ip());
if($IpHostAllow[0] == '192' && ($_COOKIE['is_test_wh'] == 'test' || (isset($_COOKIE['esfuserid']) && $_COOKIE['esfuserid'] == 2640088))){
$orderInfo = $this->package_model->getOrderInfoByTransactionId($transaction_id);
$this->package_model->payFinish($orderInfo);
$data['status'] = 1;
$data['msg'] = "支付完成!";
$data['is_test'] = 1;
return $data;
}
$curlData['sign'] = $this->package_model->makeSign($curlData);
$url = 'https://pay.house365.com/house365-pay-web/rest/interface';
$result = SendDataByCurl($url,$curlData);
$result = json_decode($result,true);
if(!empty($result['payParams']) && !is_array($result['payParams'])){
$result['payParams'] = json_decode($result['payParams'],true);
}
if ( isset( $_COOKIE['zj'] ) && $_COOKIE['zj'] == 1 ) {
$curlData['subject'] = iconv('utf-8','gbk',$curlData['subject']);
var_dump($curlData);die();
}
if( empty($result) || $result['result'] != 'SUCCESS' || empty($result['payParams']['code_url']) ){
$msg = !empty($result['payParams']['msg']) ? $result['payParams']['msg'] : $result['msg'];
//若未返回错误信息则返回默认错误信息
$msg = !empty($msg) ? iconv('utf-8','gbk',$msg): '支付参数有误';
$data['msg'] = $msg;
return $data;
}
$data['status'] = 1;
//此处调用微信支付的生成二维码接口,后期如果微信接口不能访问请自行用qrcode生成二维码
// $data['url'] = 'http://paysdk.weixin.qq.com/example/qrcode.php?data='.urlencode($result['payParams']['code_url']);
// $data['url'] = 'http://qr.liantu.com/api.php?text='.urlencode($result['payParams']['code_url']);
$data['url'] = 'http://newrent.house365.com/api/common/get-qr-code?size=298&margin=0&url='.urlencode($result['payParams']['code_url']);
return $data;
}
/**
* 根据房源获取该房源可以购买的套餐
* @param int $houseId 房源ID
* @param string $tbl sell/rent
* @param string $type promote:房源推广 refresh:房源刷新
*/
public function getPersonalHousePackage($houseId , $tbl = 'sell' , $type = 'promote')
{
if(GB_CITY != 'nj' && GB_CITY != 'wh'){
return;
}
$this->load->model('package_model');
$packageData = $this->package_model->getPackageByHouseId($houseId,$tbl);
$promoteData = array();
$refreshData = array();
$surveyData = array();
foreach($packageData as $key => $value){
if($value['package_type'] == 1 && GB_CITY == 'nj'){
$promoteData[] = $value;
}
if($value['package_type'] == 2 ){
$promoteData[] = $value;
}
if($value['package_type'] == 3 || $value['package_type'] == 4){
$refreshData[] = $value;
}
if($value['package_type'] == 5 && GB_CITY == 'wh'){
$surveyData[] = $value;
}
}
if($type == 'promote'){
echo json_encode($promoteData);
}
if($type == 'refresh'){
echo json_encode($refreshData);
}
if($type == 'survey'){
echo json_encode($surveyData);
}
}
public function orderInvoice($orderId = '0'){
if(GB_CITY != 'nj' && GB_CITY != 'wh'){
return $this->jump(USER_CENTER ,'当前城市暂未开通此功能',3000,'warning');
}
//获取订单状态
$this->load->model("package_model");
$orderData = $this->package_model->getOrderInfoById($orderId);
//校验订单状态
if($orderData['user_id'] != $this->user_id || $orderData['order_status'] != 1 ){
return $this->jump(USER_CENTER ,'订单数据异常',3000,'warning');
}
//获取发票是否创建
$invoiceData = $this->package_model->getOrderInvoice($orderId);
if(!empty($invoiceData)){
return $this->jump(USER_CENTER ,'发票已经创建',3000,'warning');
}
//获取用户最新的发票信息
$oldInvoice = $this->package_model->getOrderInvoiceByUserId($this->user_id);
//领取方式
$oldInvoice['send_type_show'] = 1;
$oldInvoice['send_type_more_show'] = $oldInvoice['send_type'] == 1 ? 1 : 0;
if ( GB_CITY == 'nj') {
if ( $oldInvoice['user_type'] == 2 ) {
$oldInvoice['send_type_show'] = 0;
}
if ( $data['send_type_show'] == 1 && $data['send_type'] == 1 ) {
$oldInvoice['send_type_more_show'] = 1;
} else {
$oldInvoice['send_type_more_show'] = 0;
}
}
$oldInvoice['pic'] = !empty($oldInvoice['pic']) ? explode(',', $oldInvoice['pic']) : array();
$data['oldInvoice'] = $oldInvoice;
$data['orderData'] = $orderData;
$data['title'] = '发票在线填写';
$this->load->model("tel_model");
$data['telno_config'] = $this->tel_model->getTelInfoByType(tel_model::TYPE3);
$data['address_config'] = isset($this->address[GB_CITY]) ? $this->address[GB_CITY] : '';
$this->load->view('order_invoice',$data);
}
public function createOrderInvoice(){
if(GB_CITY != 'nj' && GB_CITY != 'wh'){
return;
}
$orderId = intval($this->input->post('order_id',true));
$userType = intval($this->input->post('user_type',true));
$type = intval($this->input->post('type',true));
$username = addslashes($this->input->post('username',true));
$identityCard = addslashes($this->input->post('identity_card',true));
$invoiceTitle = addslashes($this->input->post('invoice_title',true));
$invoiceNumber = addslashes($this->input->post('invoice_number',true));
$bank = addslashes($this->input->post('bank',true));
$phone = addslashes($this->input->post('phone',true));
$address = addslashes($this->input->post('address',true));
$sendType = addslashes($this->input->post('send_type',true));
$bankAccount = addslashes($this->input->post('bank_account',true));
$mailingUsername = addslashes($this->input->post('mailing_username',true));
$mailingAddress = addslashes($this->input->post('mailing_address',true));
$mailingPhone = addslashes($this->input->post('mailing_phone',true));
$telno = addslashes($this->input->post('telno',true));
$email = addslashes($this->input->post('email',true));
// $picArr = $this->input->post('p_filename',true);
$picArr = $this->input->post('file_name',true);
//参数判断
$type = $type > 0 ? $type : 1;
if(empty($orderId) || empty($type) || empty($userType)){
return $this->jump(USER_CENTER ,'参数缺失',3000,'warning');
}
if ( GB_CITY != 'nj' && empty($sendType)) {
return $this->jump(USER_CENTER ,'参数缺失',3000,'warning');
}
if ( GB_CITY == 'nj' && !( $userType == 2 && $type == 2 ) ) {
if ( empty($telno) || empty($email) ) {
return $this->jump(USER_CENTER, '参数缺失', 3000, 'warning');
}
}
if($userType == 1 && $type == 2){
return $this->jump(USER_CENTER ,'参数错误',3000,'warning');
}
if($userType == 1 && ( empty($username) || empty($identityCard))){
return $this->jump(USER_CENTER ,'参数缺失',3000,'warning');
}
if($userType == 2 && ( empty($invoiceTitle) || empty($invoiceNumber) ) ){
return $this->jump(USER_CENTER ,'参数缺失',3000,'warning');
}
if($type == 2 && ( empty($bank) || empty($phone) || empty($address) || empty($bankAccount) || empty($picArr)) ){
return $this->jump(USER_CENTER ,'参数缺失',3000,'warning');
}
if($sendType == 1 && GB_CITY != 'nj' && ( empty($mailingUsername) || empty($mailingAddress) || empty($mailingPhone) ) ){
return $this->jump(USER_CENTER ,'参数缺失',3000,'warning');
}
//获取订单状态
$this->load->model("package_model");
$orderData = $this->package_model->getOrderInfoById($orderId);
//校验订单状态
if($orderData['user_id'] != $this->user_id || $orderData['pay_status'] != 1 || $orderData['order_status'] != 1 ){
return $this->jump(USER_CENTER ,'订单数据异常',3000,'warning');
}
//获取发票是否创建
$invoiceData = $this->package_model->getOrderInvoice($orderId);
if(!empty($invoiceData)){
return $this->jump(USER_CENTER ,'发票已经创建',3000,'warning');
}
$data = array();
$data['order_id'] = $orderId;
$data['type'] = $type;
$data['price'] = $orderData['price'];
$data['send_type'] = $sendType;
$data['user_type'] = $userType;
if ( GB_CITY == 'nj' ) {
$data['invoice_class'] = $type == 2 ? 2 : 3;//电子发票
$data['send_type'] = $sendType > 0 ? $sendType : 1;
$data['want_invoice'] = 1;
$data['telno'] = $telno;
$data['email'] = $email;
}
if($userType == 1){
$data['username'] = $username;
$data['identity_card'] = $identityCard;
}
if($userType == 2){
$data['invoice_title'] = $invoiceTitle;
$data['invoice_number'] = $invoiceNumber;
$pic = addslashes( implode(',',$picArr) );
$data['pic'] = $pic;
}
if($type == 2){
$data['bank'] = $bank;
$data['bank_account'] = $bankAccount;
$data['phone'] = $phone;
$data['address'] = $address;
}
if($sendType == 1){
$data['mailing_username'] = $mailingUsername;
$data['mailing_address'] = $mailingAddress;
$data['mailing_phone'] = $mailingPhone;
}
$invoiceId = $this->package_model->createOrderInvoice($data);
if($invoiceId <= 0){
return $this->jump(USER_CENTER ,'发票生成失败',3000,'warning');
}
//获取推广信息
$promoteData = $this->package_model->getPromoteByOrderId($orderId);
$promoteId = $promoteData['id'];
$updateData = array();
$updateData['invoice_id'] = $invoiceId;
$updateData['invoice_status'] = 0;
$where = array();
$where['id'] = $promoteId;
$this->package_model->updatePromote($updateData, $where);
return $this->jump(USER_CENTER);
}
/**
* form表单提示信息 2017-12-18
* @param string $url
* @param string $msg
* @param string $time
* @param string $type
*/
private function jump( $url = 'user.house365.com' , $msg = '提交成功', $time ='3000', $type = 'success'){
$data['msg'] = $msg;
$data['url'] = $url;
$data['time'] = $time;
$data['type'] = $type;
$this->load->view('form_alert',$data);
}
// 20200610
private function jumpNew( $url = 'user.house365.com' , $msg = '提交成功', $time ='3000', $type = 'success'){
$data['msg'] = $msg;
$data['url'] = $url;
$data['time'] = $time;
$data['type'] = $type;
$this->load->view('form_alert_new',$data);
}
//我的订单
public function myorder(){
$data['conf_where'] = 'myorder';
$data['title'] = '我的订单';
$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['totalpage'] = ceil($data['totalsize']/$data['pagesize']);
$orderdata = $this->user_model->myorder_list($this->user_id,$data['page'],$data['pagesize']);
$invoiceUrlArr = $this->user_model->getInvoiceUrlArr( $orderdata );
$data['orders'] = $orderdata;
$data['invoice_url_arr'] = $invoiceUrlArr;
$this->load->view('myorder',$data);
}
//图形验证码
public function imageCode(){
$this->user_model->imageCode();
}
//图形验证码验证
public function imageCodeVerify(){
$re = $this->user_model->imageCodeVerify();
$re['msg'] = iconv('gbk','utf-8',$re['msg']);
echo json_encode($re);die;
}
//银行卡实名认证
public function bankCertify(){
$re = $this->user_model->bankCertify();
$re['msg'] = iconv('gbk','utf-8',$re['msg']);
if(!empty($re['data']['truename'])){
$re['data']['truename'] = iconv('gbk','utf-8',$re['data']['truename']);
}
echo json_encode($re);die;
}
}
......@@ -6,7 +6,9 @@ class User_Wang extends MY_Controller
function __construct()
{
parent::__construct();
if($_GET['test']){
echo 'ddddd';exit;
}
$this->load->model("user_model");
$this->load->model("broker_model");
......@@ -20,7 +22,9 @@ class User_Wang extends MY_Controller
$this->load->library("user_class");
$this->load->library("apply_class");
$this->user_id = checklogin();
if($_GET['test']){
echo 'ffff';exit;
}
if( $this->user_id <= 0 )
{
jumpto( USER_CENTER.'login');
......
......@@ -70,8 +70,8 @@
<div class="user-nav-mod <?php if($conf_where=='edit_profile') echo 'on';?>"> <a href="<?php echo USER_CENTER.'user/edit_profile';?>" class="innerLink">修改资料</a> </div>
<!-- <div class="user-nav-mod --><?php //if($conf_where=='edit_password') echo 'on';?><!--"> <a href="--><?php //echo USER_CENTER.'user/edit_password';?><!--" class="innerLink">修改密码</a> </div>-->
<!-- <div class="user-nav-mod user-nav-mod-last --><?php //if($conf_where=='edit_telno') echo 'on';?><!--"> <a href="--><?php //echo USER_CENTER.'user/edit_telno';?><!--" class="innerLink">修改手机号码</a> </div>-->
<div class="user-nav-mod <?php if($conf_where=='edit_password') echo 'on';?>"> <a href="<?php echo GB_EDIT_PHONE_URL;?>" class="innerLink">修改密码</a> </div>
<div class="user-nav-mod user-nav-mod-last <?php if($conf_where=='edit_telno') echo 'on';?>"> <a href="<?php echo GB_EDIT_PWD_URL;?>" class="innerLink">修改手机号码</a> </div>
<div class="user-nav-mod <?php if($conf_where=='edit_password') echo 'on';?>"> <a href="<?php echo GB_EDIT_PWD_URL;?>" class="innerLink">修改密码</a> </div>
<div class="user-nav-mod user-nav-mod-last <?php if($conf_where=='edit_telno') echo 'on';?>"> <a href="<?php echo GB_EDIT_PHONE_URL;?>" class="innerLink">修改手机号码</a> </div>
</div>
</div>
......
......@@ -82,12 +82,12 @@
<script>
function buyListGuidePop(){
$("#myAskGuidePop").css({
"display":"block",
// "display":"block",
"width":$(window).width() < 960 ? 960 : $(window).width() +"px",
"height":$(document).height()+"px"
});
$("#myAskGuide").css({
"display":"block",
// "display":"block",
"left":$(".mod-list").offset().left - 25 +"px",
"top":$(".mod-list").offset().top - 74 +"px"
});
......
<?php require APPPATH_MVC.'views/header.php'; ?>
<div class="paysuc popw" >
<div class="release-failBack">
</div>
<div class="release-fail yz-pop">
<div class="tit">
<span>支付成功 </span>
<div class="closes"></div>
</div>
<div class="poplist">
<div class="pstit">支付成功</div>
<div class="f16 c3 mt20">前往 <a href="<?php echo USER_CENTER; ?>" class="orange">个人中心>></a></div>
<div class="f14 c3 mt10" >支付金额:<span class="bold red"><?=$orderData['price']?></span>
<a href="<?php echo USER_CENTER.'user/orderInvoice/'.$orderData['id']?>">
<span class="f14 oranget hand">我要开发票</span>
</a>
</div>
</div>
<p>重要提醒:不点陌生链接、不泄露银行卡和验证码信息,谨防诈骗!</p>
</div>
</div>
<!--2017-11-28 end-->
<?php require APPPATH_MVC.'views/footer.php'; ?>
......@@ -413,6 +413,14 @@ define('GB_UCENTER_LOGIN_URL', 'https://ucenter.house365.com/index/login');
define('GB_NEWRENT_INDEX_URL', 'http://newrent.house365.com/sell/index');
// 退出地址
define('GB_LOGOUT_URL', 'http://passport.house365.com/index/logout');
// 验证优惠券
define('GB_CHECK_COUPON_URL', 'http://newrent.house365.com/api/tf-app/check-coupon-personal');
// 使用优惠券
define('GB_USE_COUPON_URL', 'http://newrent.house365.com/api/tf-app/use-coupon');
// 更新状态接口地址
define('GB_UPDATE_COUPON_URL', 'http://newrent.house365.com/api/tf-app/update-coupon-status');
// 添加日志
define('GB_ADD_LOG_URL', 'http://newrent.house365.com/api/tf-app/add-log');
if($_SERVER['SERVER_ADDR'] == '192.168.105.106')
{
......
......@@ -248,11 +248,11 @@ class MY_Model extends CI_Model
{
if (strlen($data['limit']) && is_numeric($data['limit']))
{
($data['limit'] > 0) ? $this->db->limit($data['offset'], $data['limit']) : $this->db->limit($data['offset']);
($data['limit'] > 0) ? $this->db->offset($data['offset'])->limit($data['limit']) : $this->db->offset($data['offset'])->limit(20);
}
else
{
$this->db->limit($data['offset']);
$this->db->offset($data['offset'])->limit(20);
}
}
else
......
......@@ -210,6 +210,17 @@ if ( ! function_exists('get_upload_tblname'))
{
function get_upload_tblname($tbl,$id){
if(GB_CITY == 'wh'){
if($tbl == 'sell' && $id < 10310000) return 'upload';
if($tbl == 'rent' && $id < 1577000) return 'upload';
if($tbl == 'sell' && ($id >= 10310000 && $id < 15591000)) return 'upload1';
if($tbl == 'rent' && ($id >= 1577000 && $id < 1809000)) return 'upload1';
return 'upload2';
}
if(GB_CITY !='nj') return 'upload';
if($tbl == 'sell' && $id < 23972101) return 'upload0';
......@@ -349,7 +360,26 @@ if ( ! function_exists('get_upload_tblname'))
if($tbl == 'rent' && ($id >= 63483875 && $id < 84955643)) return 'upload29';
return 'upload30';
if($tbl == 'sell' && ($id >= 264744742 && $id < 271465540)) return 'upload30';
if($tbl == 'rent' && ($id >= 84955643 && $id < 86646071)) return 'upload30';
if($tbl == 'sell' && ($id >= 271465540 && $id < 282952050)) return 'upload31';
if($tbl == 'rent' && ($id >= 86646071 && $id < 89874731)) return 'upload31';
if($tbl == 'sell' && ($id >= 282952050 && $id < 288033939)) return 'upload32';
if($tbl == 'rent' && ($id >= 89874731 && $id < 91709557)) return 'upload32';
if($tbl == 'sell' && ($id >= 288033939 && $id < 289572177)) return 'upload33';
if($tbl == 'rent' && ($id >= 91709557 && $id < 92295581)) return 'upload33';
if($tbl == 'sell' && ($id >= 289572177 && $id < 332826911)) return 'upload34';
if($tbl == 'rent' && ($id >= 92295581 && $id < 105588509)) return 'upload34';
return 'upload35';
}
}
......
......@@ -40,31 +40,31 @@
function getLoginInfoBySSO(){
if(empty($_COOKIE['sso_token'])){
return false;
}
$ci = & get_instance();
if(empty($_COOKIE['esfuserid']) || empty($_COOKIE['esfpassword'])){
$url = 'http://api.house365.com/passport/check_login_bytoken.php?sso_token='.$_COOKIE['sso_token'];
$info = json_decode(curl_get_contents($url),1);
if(is_array($info)){
if (isset($info['data']['passport_uid']) && $info['data']['passport_uid']) {
$passport_uid = $info['data']['passport_uid'];
$ci->load->model('user_model');
$user = $ci->user_model->get_data(array('form_name' => 'personal_user','where'=>array('passport_uid'=>$passport_uid),'select'=>array('id','telno','password')),'esfbak');
if($user){
$esfuserid = $user[0]['id'];
$esfpassword = $user[0]['password'];
setcookie('esfuserid',$esfuserid,time() + 3600 * 24 * 7,'/','.house365.com');
setcookie('esfpassword',$esfpassword,time() + 3600 * 24 * 7,'/','.house365.com');
}
}
}else{
return false;
}
}
return $info;
// if(empty($_COOKIE['sso_token'])){
// return false;
// }
// $ci = & get_instance();
// if(empty($_COOKIE['esfuserid']) || empty($_COOKIE['esfpassword'])){
// $url = 'http://api.house365.com/passport/check_login_bytoken.php?sso_token='.$_COOKIE['sso_token'];
// $info = json_decode(curl_get_contents($url),1);
// if(is_array($info)){
// if (isset($info['data']['passport_uid']) && $info['data']['passport_uid']) {
// $passport_uid = $info['data']['passport_uid'];
// $ci->load->model('user_model');
// $user = $ci->user_model->get_data(array('form_name' => 'personal_user','where'=>array('passport_uid'=>$passport_uid),'select'=>array('id','telno','password')),'esfbak');
// if($user){
// $esfuserid = $user[0]['id'];
// $esfpassword = $user[0]['password'];
// setcookie('esfuserid',$esfuserid,time() + 3600 * 24 * 7,'/','.house365.com');
// setcookie('esfpassword',$esfpassword,time() + 3600 * 24 * 7,'/','.house365.com');
// }
// }
// }else{
// return false;
// }
// }
//
// return $info;
}
function getLoginInfoBySSOUcenter(){
......
......@@ -58,6 +58,22 @@ class Package_model extends MY_Model
return time() . $formatType . $randValue;
}
/**
* 获取某个产品的0元支付交易号
* @param int $type 产品类型 1代表首页推荐,2代表列表页推荐,3代表智能刷新,4代表普通刷新
* @return string
*/
public function getPaymentTransactionId($type)
{
//防止订单ID与租售宝重复,$type 定义为从50开始
$type = 50 + $type;
$formatType = self::formatValue($type, 2);
//随机数
$randValue = self::formatValue(self::randValue(), 4);
//订单号
return 'zeropay-' . time() . $formatType . $randValue;
}
/**
* 获取套餐详情
* @param int $id 套餐ID
......@@ -552,6 +568,11 @@ class Package_model extends MY_Model
//订单状态更新成功,设置缓存5分钟内不再允许更新
$this->memcached_class->add( $cacheKey, 1, 300 );
//更新优惠券
if (GB_CITY == 'nj' && (int)$orderInfo['coupon_id'] > 0) {
$this->updateCouponStatus( $orderInfo['user_id'], $orderInfo['coupon_id'] );
}
$data = array();
$tableArray = array( 1 => 'sell' , 2 => 'rent');
$tbl = $tableArray[$orderInfo['house_type']];
......@@ -947,6 +968,18 @@ class Package_model extends MY_Model
}
/**
* 验证优惠券
* @param $user_id
* @param $coupon_id
*/
public function updateCouponStatus( $user_id, $coupon_id ) {
$url = GB_UPDATE_COUPON_URL . '?uid=' . $user_id .'&coupon_id=' . $coupon_id;
$couponRes = curl_get_contents( $url );
$couponRes = !empty( $couponRes ) ? json_decode( $couponRes, 1 ) : array();
return $couponRes;
}
/**
* 远程获取
* @author zj
......@@ -968,4 +1001,42 @@ class Package_model extends MY_Model
curl_close($ch);
return $str;
}
/**
* 发送消息
* @author zj
* @date 2020-09-08
*
* @param array $orderInfo 订单数据
* @return bool
*/
public function sendMsg( $orderInfo ) {
$message = '';
$this->load->library("apply_class");
if ( $orderInfo['package_type'] == 1 ) {
$message = "您已成功购买{$orderInfo['package_days']}天的首页推荐套餐,购买的套餐可以在个人中心-我的订单进行查看。";
} else if ( $orderInfo['package_type'] == 2 ) {
$message = "您已成功购买{$orderInfo['package_days']}天的列表页推荐套餐,购买的套餐可以在个人中心-我的订单进行查看。";
} else if ( $orderInfo['package_type'] == 3 ) {
$message = "您已成功购买{$orderInfo['package_days']}天的智能刷新套餐,购买的套餐可以在个人中心-我的订单进行查看。";
} else if ( $orderInfo['package_type'] == 6 ) {
$message = "您已成功购买24小时{$orderInfo['refresh_num']}次刷新,您可以选择手动去刷新或者设置时间预约刷新,购买的套餐可以在个人中心-我的订单进行查看哦";
}
if ( !$message ) {
return false;
}
//发送用户中心消息
$subject = '购买套餐成功。';
$this->apply_class->send_systemmsg( $orderInfo['user_id'], $subject, $message, 7, GB_CITY );
//发送短信
$telno = isset( $orderInfo['house_tel'] ) ? $orderInfo['house_tel'] : '';
if ( $telno ) {
sendsms( $telno, $message, 'sx' );
}
return true;
}
}
\ No newline at end of file
......@@ -2579,9 +2579,9 @@ if($searcharr['infotype']==4){
function get_buy_by_uid($uid,$offset=0,$pagesize=0,$sendtime='')
{
if(!empty($sendtime)){
$buy_array = $this->get_data(array('form_name' => 'buy','where'=>array('uid'=>$uid,'esta'=>1,'creattime >'=>$sendtime),'limit'=>$offset,'offset'=>$pagesize,'order_by'=>'id DESC','select'=>array('matched_num','id','infotype','infofrom','address','buildyear','buildyear1','buildyear2','buildarea1','buildarea2','room','price1','price2','remark','allow_match','creattime','esta','telno')),'esfhousebak');
$buy_array = $this->get_data(array('form_name' => 'buy','where'=>array('uid'=>$uid,'esta'=>1,'creattime >'=>$sendtime),'limit'=>$pagesize,'offset'=>$offset,'order_by'=>'id DESC','select'=>array('matched_num','id','infotype','infofrom','address','buildyear','buildyear1','buildyear2','buildarea1','buildarea2','room','price1','price2','remark','allow_match','creattime','esta','telno')),'esfhousebak');
}else{
$buy_array = $this->get_data(array('form_name' => 'buy','where'=>array('uid'=>$uid,'esta'=>1),'limit'=>$offset,'offset'=>$pagesize,'order_by'=>'id DESC','select'=>array('matched_num','id','infotype','infofrom','address','buildyear','buildyear1','buildyear2','buildarea1','buildarea2','room','price1','price2','remark','allow_match','creattime','esta','telno')),'esfhousebak');
$buy_array = $this->get_data(array('form_name' => 'buy','where'=>array('uid'=>$uid,'esta'=>1),'limit'=>$pagesize,'offset'=>$offset,'order_by'=>'id DESC','select'=>array('matched_num','id','infotype','infofrom','address','buildyear','buildyear1','buildyear2','buildarea1','buildarea2','room','price1','price2','remark','allow_match','creattime','esta','telno')),'esfhousebak');
}
if(is_array($buy_array) && !empty($buy_array) && GB_CITY=='nj')
{
......@@ -5818,7 +5818,7 @@ if($searcharr['infotype']==4){
$passport_info = $this->get_data(array('form_name' => 'personal_user','limit'=>1,'where'=>array('id'=>$uid),'select'=>array('passport_uid')),'esfbak');
if ($passport_info) {
$passport_uid =$passport_info['0']['passport_uid'];
$url ="http://api.house365.com/passport/passport_changephone.php?come_from=1&passport_uid=".$passport_uid."&phoneold=".$oldPhone."&phone=".$newPhone;
// $url ="http://api.house365.com/passport/passport_changephone.php?come_from=1&passport_uid=".$passport_uid."&phoneold=".$oldPhone."&phone=".$newPhone;
// get_api($url);
}
}
......@@ -6119,6 +6119,53 @@ if($searcharr['infotype']==4){
return $collect_array;
}
/**
* 验证优惠券
* @param $user_id
* @param $coupon_id
* @param $price
* @param $packageType
*/
public function checkCoupon( $user_id, $coupon_id, $price, $packageType) {
$url = GB_CHECK_COUPON_URL . '?uid=' . $user_id .'&coupon_id=' . $coupon_id . '&price=' . $price . '&package_type=' . $packageType;
$couponRes = curl_get_contents( $url );
$couponRes = !empty( $couponRes ) ? json_decode( $couponRes, 1 ) : array();
return $couponRes;
}
/**
* 验证优惠券
* @param $order_code
* @param $user_id
* @param $coupon_id
* @param $price
* @param $packageType
*/
public function useCoupon( $order_code, $user_id, $coupon_id, $price, $packageType ) {
$params = array(
'order_code' => $order_code,
'coupon_id' => $coupon_id,
'price' => $price,
'uid' => $user_id,
'package_type' => $packageType,
);
$url = GB_USE_COUPON_URL;
$couonRes = $this->request_post( $url, $params );
$couonRes = !empty( $couonRes ) ? json_decode( $couonRes, 1 ) : array();
return $couonRes;
}
/**
* 记录日志
* @param $params
*/
public function addLog( $msg, $content ) {
$url = GB_ADD_LOG_URL;
$res = $this->request_post( $url, array( 'msg' => iconv('gbk', 'utf-8', $msg), 'content' => $content ) );
return $res;
}
function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) {
return false;
......
......@@ -5694,8 +5694,8 @@ class User_Xue_model extends MY_Model
$passport_info = $this->get_data(array('form_name' => 'personal_user','limit'=>1,'where'=>array('id'=>$uid),'select'=>array('passport_uid')),'esfbak');
if ($passport_info) {
$passport_uid =$passport_info['0']['passport_uid'];
$url ="http://api.house365.com/passport/passport_changephone.php?come_from=1&passport_uid=".$passport_uid."&phoneold=".$oldPhone."&phone=".$newPhone;
get_api($url);
// $url ="http://api.house365.com/passport/passport_changephone.php?come_from=1&passport_uid=".$passport_uid."&phoneold=".$oldPhone."&phone=".$newPhone;
// get_api($url);
}
}
......
......@@ -409,10 +409,10 @@ class User_Zhou_model extends MY_Model
{
$passport_uid =$passport_info['0']['passport_uid'];
$url ="http://api.house365.com/passport/passport_changepwd.php?passport_uid=".$passport_uid."&passport_pwd=".$passport_pwd."&passport_new_pwd=".$passport_new_pwd;
// $url ="http://api.house365.com/passport/passport_changepwd.php?passport_uid=".$passport_uid."&passport_pwd=".$passport_pwd."&passport_new_pwd=".$passport_new_pwd;
//echo $url;die;
get_api($url);
// get_api($url);
}
}
......@@ -432,9 +432,9 @@ class User_Zhou_model extends MY_Model
{
$passport_uid =$passport_info['0']['passport_uid'];
$url ="http://api.house365.com/passport/passport_changepwd.php?passport_uid=".$passport_uid."&phoneold=".$phoneold."&phone=".$phone;
get_api($url);
// $url ="http://api.house365.com/passport/passport_changepwd.php?passport_uid=".$passport_uid."&phoneold=".$phoneold."&phone=".$phone;
//
// get_api($url);
}
}
......
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