From c1499a40af37a4041fe51b9e943fae745ed78258 Mon Sep 17 00:00:00 2001 From: devil Date: Sat, 19 Sep 2020 20:55:23 +0800 Subject: [PATCH] =?UTF-8?q?qq=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/OrderService.php | 7 +++ extend/payment/Weixin.php | 10 ++-- sourcecode/qq/pages/user-order/user-order.js | 48 ++++++++++++++------ 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/application/service/OrderService.php b/application/service/OrderService.php index 6a84e3ea8..bb75d2236 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -288,6 +288,13 @@ class OrderService // 支付日志id 'order_id' => $pay_log['data']['id'], 'order_no' => $pay_log['data']['log_no'], + + // 支付方式信息 + 'payment' => [ + 'id' => $payment['id'], + 'name' => $payment['name'], + 'payment' => $payment['payment'], + ], ]; // 是否线下支付 diff --git a/extend/payment/Weixin.php b/extend/payment/Weixin.php index 094c30e66..beed7cf59 100755 --- a/extend/payment/Weixin.php +++ b/extend/payment/Weixin.php @@ -52,7 +52,7 @@ class Weixin 'name' => '微信', // 插件名称 'version' => '1.1.1', // 插件版本 'apply_version' => '不限', // 适用系统版本描述 - 'apply_terminal'=> ['pc', 'h5', 'ios', 'android', 'weixin', 'toutiao'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu'] + 'apply_terminal'=> ['pc', 'h5', 'ios', 'android', 'weixin', 'toutiao', 'qq'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu'] 'desc' => '适用公众号+PC+H5+APP+[微信|头条]小程序,即时到帐支付方式,买家的交易资金直接打入卖家账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) 'author' => 'Devil', // 开发者 'author_url' => 'http://shopxo.net/', // 开发者主页 @@ -337,8 +337,11 @@ class Weixin return DataReturn('支付类型不匹配', -1); } + // 平台 + $client_type = ApplicationClientType(); + // openid - if(APPLICATION == 'app') + if($client_type == 'weixin') { $openid = isset($params['user']['weixin_openid']) ? $params['user']['weixin_openid'] : ''; } else { @@ -346,7 +349,7 @@ class Weixin } // appid - $appid = (APPLICATION == 'app') ? $this->config['mini_appid'] : $this->config['appid']; + $appid = ($client_type == 'weixin') ? $this->config['mini_appid'] : $this->config['appid']; // 异步地址处理 $notify_url = (__MY_HTTP__ == 'https' && isset($this->config['agreement']) && $this->config['agreement'] == 1) ? 'http'.mb_substr($params['notify_url'], 5, null, 'utf-8') : $params['notify_url']; @@ -389,6 +392,7 @@ class Weixin 'weixin' => 'JSAPI', 'h5' => 'MWEB', 'toutiao' => 'MWEB', + 'qq' => 'MWEB', 'app' => 'APP', 'ios' => 'APP', 'android' => 'APP', diff --git a/sourcecode/qq/pages/user-order/user-order.js b/sourcecode/qq/pages/user-order/user-order.js index 5fde76f75..b124121da 100755 --- a/sourcecode/qq/pages/user-order/user-order.js +++ b/sourcecode/qq/pages/user-order/user-order.js @@ -233,21 +233,41 @@ Page({ switch (res.data.data.is_payment_type) { // 正常线上支付 case 0 : - qq.requestPayment({ - package: res.data.data.data, - success: function(res) { - // 数据设置 - self.order_item_pay_success_handle(order_ids); + // 是否微信支付 + if(res.data.data.payment.payment == 'Weixin') { + qq.requestWxPayment({ + url: res.data.data.data, + referer: app.data.request_url, + success: function(res) { + // 数据设置 + self.order_item_pay_success_handle(order_ids); - // 跳转支付页面 - qq.navigateTo({ - url: "/pages/paytips/paytips?code=9000" - }); - }, - fail: function (res) { - app.showToast('支付失败'); - } - }); + // 跳转支付页面 + qq.navigateTo({ + url: "/pages/paytips/paytips?code=9000" + }); + }, + fail: function (res) { + app.showToast('支付失败'); + } + }); + } else { + qq.requestPayment({ + package: res.data.data.data, + success: function(res) { + // 数据设置 + self.order_item_pay_success_handle(order_ids); + + // 跳转支付页面 + qq.navigateTo({ + url: "/pages/paytips/paytips?code=9000" + }); + }, + fail: function (res) { + app.showToast('支付失败'); + } + }); + } break; // 线下支付