1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\api\controller;
- use think\facade\View;
- use think\facade\Lang;
- /**
- * ============================================================================
- * DSMall多用户商城
- * ============================================================================
- * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
- * 网站地址: http://www.csdeshang.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
- * 不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * 支付回调控制器
- */
- 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');
- }
- }
|