Commit 055d217d authored by zhangjun's avatar zhangjun

修改

parent 2bae583b
......@@ -1910,16 +1910,9 @@ class User extends MY_Controller
}
}
// 订单号
$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'];
}
if ( GB_CITY == 'nj' ) {
if( isset( $use_coupon ) && $use_coupon == 1 ) {
$couponRes = $this->user_model->checkCoupon( $this->user_id, $coupon_id, $price );
}
}
......@@ -1988,7 +1981,7 @@ class User extends MY_Controller
$tblArr = array('sell' => 1 ,'rent' => 2);
$tableId = $tblArr[$tbl];
$orderData = array();
$orderData['transaction_id'] = $transaction_id;
$orderData['transaction_id'] = $this->package_model->getTransactionId( $packageType );
$orderData['user_id'] = $this->user_id;
$orderData['house_type'] = $tableId;
$orderData['house_id'] = $houseId;
......@@ -1999,7 +1992,7 @@ class User extends MY_Controller
$orderData['package_keyword'] = $packageKeyword;
}
// 优惠券字段
if ( $couponRes['result'] == 1 ) {
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']['price'] ) ? $couponRes['data']['price'] : 0;
$orderData['coupon_id'] = isset( $couponRes['data']['id'] ) ? $couponRes['data']['id'] : 0;
......@@ -2017,6 +2010,13 @@ 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, $price );
}
}
$data = $this->getWxPayCodeByHouse365($orderId);
if($data['status'] != 1){
return $this->jump(USER_CENTER , $data['msg'],3000,'warning');
......
......@@ -414,6 +414,8 @@ 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');
if($_SERVER['SERVER_ADDR'] == '192.168.105.106')
......
......@@ -6114,6 +6114,19 @@ if($searcharr['infotype']==4){
return $collect_array;
}
/**
* 验证优惠券
* @param $user_id
* @param $coupon_id
* @param $price
*/
public function checkCoupon( $user_id, $coupon_id, $price, $business_type = 0) {
$url = GB_USE_COUPON_URL . '?uid=' . $user_id .'&coupon_id=' . $coupon_id . '&price=' . $price . '&business_type=' . $business_type;
$couponRes = curl_get_contents( $url );
$couponRes = !empty( $couponRes ) ? json_decode( $couponRes, 1 ) : array();
return $couponRes;
}
/**
* 验证优惠券
* @param $user_id
......
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