123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace app\api\controller;
- use think\facade\View;
- use think\facade\Lang;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 支付回调控制器
- */
- class Payment extends MobileMall
- {
- public function initialize()
- {
- parent::initialize(); // TODO: Change the autogenerated stub
- Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/buy.lang.php');
- }
- /**
- * Alipay支付回调
- */
- public function alipay_h5_return()
- {
- $out_trade_no = explode('-', input('param.out_trade_no'));
- $order_type = $out_trade_no['0'];
- $out_trade_no = $out_trade_no['1'];
- $trade_no = input('param.trade_no');
- $payment_code = 'alipay_h5';
- //创建支付接口对象
- $logic_payment = model('payment', 'logic');
- $result = $logic_payment->getPaymentInfo($payment_code);
- if (!$result['code']) {
- $this->error($result['msg'], 'Memberorder/index');
- }
- $payment_info = $result['data'];
- //创建支付接口对象
- $payment_api = new $payment_info['payment_code']($payment_info);
- //取得支付结果
- $callback_info = $payment_api->verify_return();
- if (!$callback_info) {
- View::assign('result', 'fail');
- View::assign('message', lang('order_pay_fail'));
- } else {
- View::assign('result', 'success');
- View::assign('message', lang('order_payment_success'));
- }
- //支付成功后跳转
- if ($order_type == 'real_order') {
- $pay_ok_url = config('ds_config.h5_site_url') . '/pages/member/order/OrderList';
- } elseif ($order_type == 'vr_order') {
- $pay_ok_url = config('ds_config.h5_site_url') . '/pages/member/vrorder/OrderList';
- } elseif ($order_type == 'pd_order') {
- $pay_ok_url = config('ds_config.h5_site_url') . '/pages/member/recharge/RechargeList';
- }
- View::assign('pay_ok_url', $pay_ok_url);
- return View::fetch('payment_message');
- }
- }
|