public function alipay_return() { $order_id_arr = explode('_', $_GET['out_trade_no']); $order_type = $order_id_arr[0]; $order_id = $order_id_arr[1]; switch ($order_type) { case 'group': $now_order = D('Group_order')->where(array('order_id' => $order_id))->find(); break; case 'meal': $now_order = D('Meal_order')->where(array('order_id' => $order_id))->find(); break; default: $this->error('非法的订单'); } if ($now_order['paid']) { switch ($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); exit; } $pay_method = D('Config')->get_pay_method(); if (empty($pay_method)) { $this->error_tips('系统管理员没开启任一一种支付方式!'); } $import_result = import('@.ORG.pay.Alipay'); $pay_class = new Alipay('', '', $pay_type, $pay_method['alipay']['config'], $this->user_session, 0); $go_query_param = $pay_class->query_order(); if ($go_query_param['error'] === 0) { switch ($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 ($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); }