public function weixin_back() { switch ($_GET['order_type']) { case 'group': $now_order = D('Group_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; case 'meal': case 'takeout': case 'food': $now_order = D('Meal_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; case 'weidian': $now_order = D('Weidian_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; case 'recharge': $now_order = D('User_recharge_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; default: $this->error_tips('非法的订单'); } $now_order['order_type'] = $_GET['order_type']; if (empty($now_order)) { $this->error_tips('该订单不存在'); } if ($now_order['paid']) { switch ($_GET['order_type']) { case 'group': $redirctUrl = C('config.site_url') . '/wap.php?c=My&a=group_order&order_id=' . $now_order['order_id']; break; case 'meal': $redirctUrl = C('config.site_url') . '/wap.php?c=Meal&a=detail&orderid=' . $now_order['order_id'] . '&mer_id=' . $now_order['mer_id'] . '&store_id=' . $now_order['store_id']; break; case 'takeout': $redirctUrl = C('config.site_url') . '/wap.php?c=Takeout&a=order_detail&order_id=' . $now_order['order_id'] . '&mer_id=' . $now_order['mer_id'] . '&store_id=' . $now_order['store_id']; break; case 'food': $redirctUrl = C('config.site_url') . '/wap.php?c=Food&a=order_detail&order_id=' . $now_order['order_id'] . '&mer_id=' . $now_order['mer_id'] . '&store_id=' . $now_order['store_id']; break; case 'weidian': $redirctUrl = D('Weidian_order')->get_weidian_url(array('wecha_id' => $now_order['uid'], 'order_no' => $now_order['weidian_order_id'], 'pay_money' => $now_order['money'], 'third_id' => $now_order['third_id'], 'payment_method' => $now_order['pay_type'])); break; case 'recharge': $redirctUrl = C('config.site_url') . '/wap.php?c=My&a=index'; break; } redirect($redirctUrl); exit; } $import_result = import('@.ORG.pay.Weixin'); $pay_method = D('Config')->get_pay_method(); if (empty($pay_method)) { $this->error_tips('系统管理员没开启任一一种支付方式!'); } $pay_class = new Weixin($now_order, 0, 'weixin', $pay_method['weixin']['config'], $this->user_session, 1); $go_query_param = $pay_class->query_order(); if ($go_query_param['error'] === 0) { switch ($_GET['order_type']) { case 'group': D('Group_order')->after_pay($go_query_param['order_param']); break; case 'meal': case 'takeout': case 'food': D('Meal_order')->after_pay($go_query_param['order_param'], $_GET['order_type']); break; case 'weidian': D('Weidian_order')->after_pay($go_query_param['order_param']); break; case 'recharge': D('User_recharge_order')->after_pay($go_query_param['order_param']); break; } } switch ($_GET['order_type']) { case 'group': $redirctUrl = C('config.site_url') . '/wap.php?g=Wap&c=My&a=group_order&order_id=' . $now_order['order_id']; break; case 'meal': $redirctUrl = C('config.site_url') . '/wap.php?g=Wap&c=Meal&a=detail&orderid=' . $now_order['order_id'] . '&mer_id=' . $now_order['mer_id'] . '&store_id=' . $now_order['store_id']; break; case 'takeout': $redirctUrl = C('config.site_url') . '/wap.php?g=Wap&c=Takeout&a=order_detail&order_id=' . $now_order['order_id'] . '&mer_id=' . $now_order['mer_id'] . '&store_id=' . $now_order['store_id']; break; case 'food': $redirctUrl = C('config.site_url') . '/wap.php?g=Wap&c=Food&a=order_detail&order_id=' . $now_order['order_id'] . '&mer_id=' . $now_order['mer_id'] . '&store_id=' . $now_order['store_id']; break; case 'weidian': $redirctUrl = D('Weidian_order')->get_weidian_url(array('wecha_id' => $now_order['uid'], 'order_no' => $now_order['weidian_order_id'], 'pay_money' => $now_order['money'], 'third_id' => $go_query_param['order_param']['third_id'], 'payment_method' => $go_query_param['order_param']['pay_type'])); break; case 'recharge': $redirctUrl = C('config.site_url') . '/wap.php?c=My&a=index'; break; } redirect($redirctUrl); }
public function weixin_back() { switch ($_GET['order_type']) { case 'group': $now_order = D('Group_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; case 'meal': $now_order = D('Meal_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; case 'recharge': $now_order = D('User_recharge_order')->get_order_by_id($this->user_session['uid'], intval($_GET['order_id'])); break; default: $this->error_tips('非法的订单'); } $now_order['order_type'] = $_GET['order_type']; if (empty($now_order)) { $this->error_tips('该订单不存在'); } if ($now_order['paid']) { switch ($_GET['order_type']) { case 'group': $redirctUrl = C('config.site_url') . '/index.php?g=User&c=Index&a=group_order_view&order_id=' . $now_order['order_id']; break; case 'meal': $redirctUrl = C('config.site_url') . '/index.php?g=User&c=Index&a=meal_order_view&order_id=' . $now_order['order_id']; break; case 'recharge': $redirctUrl = C('config.site_url') . '/index.php?g=User&c=Credit&a=index'; break; } redirect($redirctUrl); exit; } $import_result = import('@.ORG.pay.Weixin'); $pay_method = D('Config')->get_pay_method(); if (empty($pay_method)) { $this->error_tips('系统管理员没开启任一一种支付方式!'); } $pay_class = new Weixin($now_order, 0, 'weixin', $pay_method['weixin']['config'], $this->user_session, 1); $go_query_param = $pay_class->query_order(); if ($go_query_param['error'] === 0) { switch ($_GET['order_type']) { case 'group': D('Group_order')->after_pay($go_query_param['order_param']); break; case 'meal': D('Meal_order')->after_pay($go_query_param['order_param']); break; } } switch ($_GET['order_type']) { case 'group': $redirctUrl = C('config.site_url') . '/index.php?g=User&c=Index&a=group_order_view&order_id=' . $now_order['order_id']; break; case 'meal': $redirctUrl = C('config.site_url') . '/index.php?g=User&c=Index&a=meal_order_view&order_id=' . $now_order['order_id']; break; } redirect($redirctUrl); }