12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\api\controller;
- use think\facade\View;
- use think\facade\Lang;
- /**
- * ============================================================================
- *
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- *
- * ============================================================================
- * 支付回调控制器
- */
- 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');
- }
- }
|