Commit 82d87465 authored by zhangjun's avatar zhangjun

修改

parent 055d217d
......@@ -1910,9 +1910,13 @@ class User extends MY_Controller
}
}
// 使用优惠券
if ( GB_CITY == 'nj' ) {
if( isset( $use_coupon ) && $use_coupon == 1 ) {
$couponRes = $this->user_model->checkCoupon( $this->user_id, $coupon_id, $price );
if ( isset( $couponRes['result'] ) && $couponRes['result'] == 1 ) {
$price = $price - $couponRes['data']['coupon_price'] ;
}
}
}
......@@ -1994,7 +1998,7 @@ class User extends MY_Controller
// 优惠券字段
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_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;
......
......@@ -417,6 +417,8 @@ 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://newrenttest.house365.com/api/tf-app/use-coupon');
if($_SERVER['SERVER_ADDR'] == '192.168.105.106')
{
......
......@@ -552,6 +552,11 @@ class Package_model extends MY_Model
//订单状态更新成功,设置缓存5分钟内不再允许更新
$this->memcached_class->add( $cacheKey, 1, 300 );
//更新优惠券
if (GB_CITY == 'nj' && $orderInfo['coupon_id'] > 0) {
$this->user_model->updateCouponStatus( $orderInfo['user_id'], $orderInfo['coupon_id'] );
}
$data = array();
$tableArray = array( 1 => 'sell' , 2 => 'rent');
$tbl = $tableArray[$orderInfo['house_type']];
......
......@@ -6121,7 +6121,7 @@ if($searcharr['infotype']==4){
* @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;
$url = GB_CHECK_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;
......@@ -6147,6 +6147,19 @@ if($searcharr['infotype']==4){
return $couonRes;
}
/**
* 验证优惠券
* @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;
}
function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) {
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