作者 anyv
1 个管道 的构建 通过 耗费 0 秒

54

@@ -157,6 +157,20 @@ class OrderpageController extends WeChatBaseController{ @@ -157,6 +157,20 @@ class OrderpageController extends WeChatBaseController{
157 157
158 } 158 }
159 159
  160 + /**
  161 + * 取消支付时
  162 + */
  163 + public function cancel_pay(){
  164 +
  165 + $indent_id = $this -> request -> param();
  166 + $data = Db::name('indent') -> where('id',$indent_id['id']) -> find();
  167 + $money_ratio = Db::name('money_ratio') -> where('id',1) -> find();
  168 + if($data['indent_type'] == 2 && $data['is_courier'] == 2){
  169 + Db::name('indent') -> where('id',$indent_id['id']) -> setDec('money',$money_ratio['courier']);
  170 + }
  171 + $this -> redirect('index/index');
  172 +
  173 + }
160 174
161 175
162 176
@@ -66,6 +66,7 @@ class PayController extends HomeBaseController @@ -66,6 +66,7 @@ class PayController extends HomeBaseController
66 $this->assign('name','北京煊坤博文图书有限公司'); 66 $this->assign('name','北京煊坤博文图书有限公司');
67 $this->assign('price',$data['money']); 67 $this->assign('price',$data['money']);
68 $this->assign('order_number',$data['order_number']); 68 $this->assign('order_number',$data['order_number']);
  69 + $this->assign('indent_id',$data['id']);
69 $this->assign('jsApiParameters',json_encode($jsApiParameters)); 70 $this->assign('jsApiParameters',json_encode($jsApiParameters));
70 return $this->fetch(); 71 return $this->fetch();
71 }else{ 72 }else{
@@ -241,11 +242,6 @@ class PayController extends HomeBaseController @@ -241,11 +242,6 @@ class PayController extends HomeBaseController
241 242
242 } 243 }
243 244
244 - }else{  
245 - cache('a','33333');  
246 - if($order['indent_type'] == 2 && $order['is_courier'] == 2){  
247 - cache('a','33333');  
248 - }  
249 } 245 }
250 246
251 return true; // 返回处理完成 247 return true; // 返回处理完成
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 alert(res.err_code+res.err_desc+res.err_msg); 17 alert(res.err_code+res.err_desc+res.err_msg);
18 if (res.err_msg=='get_brand_wcpay_request:cancel'){ 18 if (res.err_msg=='get_brand_wcpay_request:cancel'){
19 //支付取消逻辑 19 //支付取消逻辑
  20 + window.location.href = "{:url('Orderpage/cancel_pay',array('id'=>$indent_id))}";
20 }else if (res.err_msg=='get_brand_wcpay_request:ok'){ 21 }else if (res.err_msg=='get_brand_wcpay_request:ok'){
21 //支付成功逻辑 22 //支付成功逻辑
22 window.location.href = "{:url('index/index')}"; 23 window.location.href = "{:url('index/index')}";