Commit ecbc9c91 authored by zhangjun's avatar zhangjun

修改

parent 49cca158
...@@ -1814,8 +1814,10 @@ class User extends MY_Controller ...@@ -1814,8 +1814,10 @@ class User extends MY_Controller
$packageKeyword = intval($this->input->post('package_keyword',true)); $packageKeyword = intval($this->input->post('package_keyword',true));
$day = intval($this->input->post('day_'.$packageType,true)); $day = intval($this->input->post('day_'.$packageType,true));
$payType = addslashes($this->input->post('pay_type',true)); $payType = addslashes($this->input->post('pay_type',true));
// 租房8折优惠券 20200507添加 // 是否使用优惠券
$use_coupon = intval($this->input->post('use_coupon',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); $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)){ 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'); return $this->jump(USER_CENTER,'参数缺失',3000,'warning');
...@@ -1870,40 +1872,53 @@ class User extends MY_Controller ...@@ -1870,40 +1872,53 @@ class User extends MY_Controller
} }
// 列表套餐8折券使用 20200507 // 列表套餐8折券使用 20200507
// 优惠券修改为 6折 // 优惠券修改为 6折
if( GB_CITY == 'nj' && $packageType == 2 && $tbl == 'rent'){ // if( GB_CITY == 'nj' && $packageType == 2 && $tbl == 'rent'){
// // //
$checkbox_status = 0; // $checkbox_status = 0;
// 检查是否有可用的优惠券,如果有则使用,如果无,则跳转提示 // // 检查是否有可用的优惠券,如果有则使用,如果无,则跳转提示
$userInfoData = $this->user_model->getuserdetail($this->user_id); // $userInfoData = $this->user_model->getuserdetail($this->user_id);
$passport_uid = $userInfoData ? $userInfoData['passport_uid'] : 0; // $passport_uid = $userInfoData ? $userInfoData['passport_uid'] : 0;
//
// 测试数据 // // 测试数据
$couponUserIdArr = array('1785149','3367096','4112782'); // $couponUserIdArr = array('1785149','3367096','4112782');
if( in_array($this->user_id,$couponUserIdArr) ){ // if( in_array($this->user_id,$couponUserIdArr) ){
$price = 0.05; // $price = 0.05;
} // }
//
if( isset($use_coupon) && $use_coupon == 1){ // if( isset($use_coupon) && $use_coupon == 1){
//
$check_coupon = $this->rent_coupon_model->checkCoupon($passport_uid); // $check_coupon = $this->rent_coupon_model->checkCoupon($passport_uid);
if( !$check_coupon ){ // if( !$check_coupon ){
$from_url = $from_url ? $from_url : USER_CENTER; // $from_url = $from_url ? $from_url : USER_CENTER;
return $this->jumpNew($from_url,'已有待支付订单,勿重复下单!<br/>请30分钟后再试。',3000,'warning'); // return $this->jumpNew($from_url,'已有待支付订单,勿重复下单!<br/>请30分钟后再试。',3000,'warning');
} // }
$checkbox_status = 1; // $checkbox_status = 1;
// 列表优先套餐8折 // // 列表优先套餐8折
// 修改为6折 20200927 // // 修改为6折 20200927
$price = sprintf("%.2f",$price * 0.6); // $price = sprintf("%.2f",$price * 0.6);
// 锁定半小时 // // 锁定半小时
$this->rent_coupon_model->lockCoupon($passport_uid); // $this->rent_coupon_model->lockCoupon($passport_uid);
//
//
} // }
//
// 设置8折优惠券的选中状态 // // 设置8折优惠券的选中状态
$this->rent_coupon_model->setCheckbox($passport_uid,$checkbox_status); // $this->rent_coupon_model->setCheckbox($passport_uid,$checkbox_status);
//
} // }
}
}
}
// 订单号
$transaction_id = $this->package_model->getTransactionId($packageType);
// 使用优惠券
if ( GB_CITY == 'nj' ){
if( isset($use_coupon) && $use_coupon == 1 ) {
$couponRes = $this->user_model->useCoupon( $transaction_id, $this->user_id, $coupon_id, $price );
if ( $couponRes['result'] == 1 ) {
$price = $price - $couponRes['data']['price'];
} }
} }
} }
...@@ -1973,7 +1988,7 @@ class User extends MY_Controller ...@@ -1973,7 +1988,7 @@ class User extends MY_Controller
$tblArr = array('sell' => 1 ,'rent' => 2); $tblArr = array('sell' => 1 ,'rent' => 2);
$tableId = $tblArr[$tbl]; $tableId = $tblArr[$tbl];
$orderData = array(); $orderData = array();
$orderData['transaction_id'] = $this->package_model->getTransactionId($packageType); $orderData['transaction_id'] = $transaction_id;
$orderData['user_id'] = $this->user_id; $orderData['user_id'] = $this->user_id;
$orderData['house_type'] = $tableId; $orderData['house_type'] = $tableId;
$orderData['house_id'] = $houseId; $orderData['house_id'] = $houseId;
......
...@@ -413,6 +413,8 @@ define('GB_UCENTER_LOGIN_URL', 'https://ucenter.house365.com/index/login'); ...@@ -413,6 +413,8 @@ define('GB_UCENTER_LOGIN_URL', 'https://ucenter.house365.com/index/login');
define('GB_NEWRENT_INDEX_URL', 'http://newrent.house365.com/sell/index'); define('GB_NEWRENT_INDEX_URL', 'http://newrent.house365.com/sell/index');
// 退出地址 // 退出地址
define('GB_LOGOUT_URL', 'http://passport.house365.com/index/logout'); define('GB_LOGOUT_URL', 'http://passport.house365.com/index/logout');
// 验证优惠券
define('GB_USE_COUPON_URL', 'http://newrent.house365.com/api/tf-app/use-coupon');
if($_SERVER['SERVER_ADDR'] == '192.168.105.106') if($_SERVER['SERVER_ADDR'] == '192.168.105.106')
{ {
......
...@@ -6114,6 +6114,26 @@ if($searcharr['infotype']==4){ ...@@ -6114,6 +6114,26 @@ if($searcharr['infotype']==4){
return $collect_array; return $collect_array;
} }
/**
* 验证优惠券
* @param $user_id
* @param $coupon_id
* @param $price
*/
public function useCoupon( $order_code, $user_id, $coupon_id, $price ) {
$params = array(
'order_code' => $order_code,
'coupon_id' => $coupon_id,
'price' => $price,
'uid' => $user_id,
'business_type' => 2,
);
$url = GB_USE_COUPON_URL;
$couonRes = request_post( $url, $params );
$couonRes = !empty( $couonRes ) ? json_decode( $couonRes, 1 ) : array();
return $couonRes;
}
function request_post($url = '', $param = '') { function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) { if (empty($url) || empty($param)) {
return false; return false;
......
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