From 69f0d560d7cd87589d53070b1dfaa3582c28d534 Mon Sep 17 00:00:00 2001 From: brjun Date: Fri, 3 Mar 2023 17:54:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD=E5=92=8C?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1app=E5=86=85=E6=94=AF=E4=BB=98=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/demo_rgapi/demo_rgapi_wxapp/app.json | 9 +- .../demo_rgapi/pages/pay/index.js | 73 +++++ .../demo_rgapi/pages/pay/index.json | 3 + .../demo_rgapi/pages/pay/index.wxml | 5 + .../demo_rgapi/pages/pay/index.wxss | 1 + .../demo_rgapi_wxapp/demo_rgapi/util/pay.js | 4 +- addons/demo_rgapi/install.php | 4 +- addons/demo_rgapi/manifest.xml | 2 +- addons/demo_rgapi/site.php | 48 ++- addons/demo_rgapi/template/mobile/index.html | 6 + addons/demo_rgapi/template/wechatpay.html | 10 +- addons/demo_rgapi/upgrade.php | 31 ++ addons/demo_rgapi/wxapp.php | 64 +++- app/source/mc/__init.php | 15 - app/source/mc/cash.ctrl.php | 185 +---------- app/themes/default/common/paycenter.html | 307 ------------------ framework/builtin/core/site.php | 34 +- framework/class/account/account.class.php | 59 +--- .../class/account/weixin.account.class.php | 2 +- .../class/account/wxapp.account.class.php | 2 +- framework/model/account.mod.php | 2 +- framework/model/payment.mod.php | 177 +--------- payment/wechat/pay.php | 23 +- 23 files changed, 269 insertions(+), 797 deletions(-) create mode 100644 addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.js create mode 100644 addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.json create mode 100644 addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxml create mode 100644 addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxss mode change 100755 => 100644 addons/demo_rgapi/template/wechatpay.html create mode 100644 addons/demo_rgapi/upgrade.php mode change 100755 => 100644 app/source/mc/__init.php mode change 100755 => 100644 app/source/mc/cash.ctrl.php mode change 100755 => 100644 app/themes/default/common/paycenter.html mode change 100755 => 100644 framework/builtin/core/site.php mode change 100755 => 100644 framework/class/account/account.class.php mode change 100755 => 100644 framework/class/account/weixin.account.class.php mode change 100755 => 100644 framework/class/account/wxapp.account.class.php mode change 100755 => 100644 framework/model/account.mod.php mode change 100755 => 100644 framework/model/payment.mod.php mode change 100755 => 100644 payment/wechat/pay.php diff --git a/addons/demo_rgapi/demo_rgapi_wxapp/app.json b/addons/demo_rgapi/demo_rgapi_wxapp/app.json index 202024b..5389ddf 100644 --- a/addons/demo_rgapi/demo_rgapi_wxapp/app.json +++ b/addons/demo_rgapi/demo_rgapi_wxapp/app.json @@ -2,7 +2,8 @@ "pages": [ "demo_rgapi/pages/index/index", "demo_rgapi/pages/add/add", - "demo_rgapi/pages/edit/edit" + "demo_rgapi/pages/edit/edit", + "demo_rgapi/pages/pay/index" ], "window": { "navigationBarTextStyle": "white", @@ -20,7 +21,11 @@ { "pagePath": "demo_rgapi/pages/add/add", "text": "新增" + }, + { + "pagePath": "demo_rgapi/pages/pay/index", + "text": "支付" } ] } -} +} \ No newline at end of file diff --git a/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.js b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.js new file mode 100644 index 0000000..ffe511c --- /dev/null +++ b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.js @@ -0,0 +1,73 @@ +import http from '../../util/request.js'; +import pay from '../../util/pay.js'; + +// demo_rgapi/pages/pay/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + pay: function(e) { + pay('orderid'); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.json b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxml b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxml new file mode 100644 index 0000000..087ac54 --- /dev/null +++ b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxml @@ -0,0 +1,5 @@ + +小程序支付: + + + diff --git a/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxss b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxss new file mode 100644 index 0000000..c45ae17 --- /dev/null +++ b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/pages/pay/index.wxss @@ -0,0 +1 @@ +/* demo_rgapi/pages/pay/index.wxss */ \ No newline at end of file diff --git a/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/util/pay.js b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/util/pay.js index 9c895b1..94f8d54 100644 --- a/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/util/pay.js +++ b/addons/demo_rgapi/demo_rgapi_wxapp/demo_rgapi/util/pay.js @@ -27,10 +27,10 @@ function wxPay(param) { console.log('wxPay'); return new Promise((resolve, reject)=>{ wx.requestPayment({ - 'timeStamp': param.timeStamp, + 'timeStamp': param.timeStamp.toString(), 'nonceStr': param.nonceStr, 'package': param.package, - 'signType': 'MD5', + 'signType': param.signType, 'paySign': param.paySign, 'success': function (res) { console.log(res); diff --git a/addons/demo_rgapi/install.php b/addons/demo_rgapi/install.php index d79a3ce..98fcdc7 100644 --- a/addons/demo_rgapi/install.php +++ b/addons/demo_rgapi/install.php @@ -19,8 +19,8 @@ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `no` varchar(255) NOT NULL DEFAULT '' COMMENT '商户订单号', `code` varchar(255) NOT NULL DEFAULT '' COMMENT '二维码链接', - `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态', - `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '支付类型 1:微信;2:支付宝;', + `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态 0:未支付;1:已支付;2:已退款;', + `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '支付类型 1:Native(微信扫码);2:ali(支付宝);3:Wechat(公众号jsapi);4:Wxapp(小程序jsapi);', `createtime` int(11) NOT NULL COMMENT '创建时间', `updatetime` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间', `uid` varchar(255) NOT NULL DEFAULT '' COMMENT '用户标识', diff --git a/addons/demo_rgapi/manifest.xml b/addons/demo_rgapi/manifest.xml index cad762e..e241836 100644 --- a/addons/demo_rgapi/manifest.xml +++ b/addons/demo_rgapi/manifest.xml @@ -3,7 +3,7 @@ - + diff --git a/addons/demo_rgapi/site.php b/addons/demo_rgapi/site.php index 30471a1..c9b3d09 100644 --- a/addons/demo_rgapi/site.php +++ b/addons/demo_rgapi/site.php @@ -14,6 +14,31 @@ public function doMobileIndex() { global $_W; include $this->template('index'); } + + public function doMobilePay() { + global $_W, $_GPC; + $out_trade_no = 'wechat' . date('YmdHis', time()) . time() . rand(11, 99); + + $insert = array( + 'no' => $out_trade_no, + 'code' => '', + 'status' => 0, + 'type' => 3, + 'createtime' => TIMESTAMP, + 'updatetime' => TIMESTAMP, + 'uid' => $_W['uid'], + 'uniacid' => $_W['uniacid'], + ); + pdo_insert('demo_rgapi_paylog', $insert); + + $params['tid'] = $out_trade_no; + $params['ordersn'] = $out_trade_no; + $params['user'] = $_W['uid']; + $params['fee'] = 0.01; + $params['title'] = '测试支付'; + $this->pay($params); + } + public function doWebList() { global $_W, $_GPC; $data = pdo_getall(self::TABLE, array(), '', 'orderBy createtime desc'); @@ -46,7 +71,7 @@ public function doWebOther() { public function doWebWechatpay() { global $_W; - $data = pdo_getall('demo_rgapi_paylog', array('type' => 1), '', '', 'id DESC'); + $data = pdo_getall('demo_rgapi_paylog', array('type in' => array(1, 3, 4)), '', '', 'id DESC'); foreach ($data as $key => &$value) { $value['createtime'] = date('Y-m-d H:i:s', $value['createtime']); } @@ -70,18 +95,19 @@ public function doWebPay() { iajax(-1, '支付类型错误!'); } load()->library('sdk-module'); - $api = new \W7\Sdk\Module\Api($_W['setting']['server_setting']['app_id'], $_W['setting']['server_setting']['app_secret'], "1"); + $api = new \W7\Sdk\Module\Api($_W['setting']['server_setting']['app_id'], $_W['setting']['server_setting']['app_secret'], "1", V3_API_DOMAIN); + $uniontid = date('YmdHis') . random(14, 1); $out_trade_no = $type . date('YmdHis', time()) . time() . rand(11, 99); if ('wechat' == $type) { $pay = $api->wechatPay($_W['siteroot'] . 'payment/wechat/notify.php'); - $data = $pay->payTransactionsNative("测试支付", $out_trade_no, 1, array('attach' => json_encode(array('uniacid' => $_W['uniacid']))))->toArray(); + $data = $pay->payTransactionsNative("测试支付", $uniontid, 1, array('attach' => json_encode(array('uniacid' => $_W['uniacid']))))->toArray(); if (empty($data['code_url'])) { iajax(-1, '支付失败!'); } $code = $data['code_url']; } else { $pay = $api->aliPay($_W['siteroot'] . 'payment/alipay/notify.php'); - $data = $pay->payForPc("测试支付", $out_trade_no, 0.01)->toArray(); + $data = $pay->payForPc("测试支付", $uniontid, 0.01)->toArray(); if (empty($data['data'])) { iajax(-1, '支付失败!'); } @@ -94,7 +120,7 @@ public function doWebPay() { 'acid' => $_W['acid'], 'openid' => $_W['member']['uid'], 'module' => 'demo_rgapi', - 'uniontid' => $out_trade_no, + 'uniontid' => $uniontid, 'tid' => $out_trade_no, 'fee' => 0.01, 'card_fee' => 0.01, @@ -127,17 +153,19 @@ public function doWebRefund() { iajax(-1, '退款类型错误!'); } load()->library('sdk-module'); - $api = new \W7\Sdk\Module\Api($_W['setting']['server_setting']['app_id'], $_W['setting']['server_setting']['app_secret'], "1"); $out_trade_no = safe_gpc_string($_GPC['__input']['no']); + $paylog = pdo_get('core_paylog', array('tid' => $out_trade_no)); + $account_type = 'wxapp' == $paylog['type'] ? 2 : 1; + $api = new \W7\Sdk\Module\Api($_W['setting']['server_setting']['app_id'], $_W['setting']['server_setting']['app_secret'], $account_type, V3_API_DOMAIN); if ('wechat' == $type) { $pay = $api->wechatPay($_W['siteroot'] . 'payment/wechat/refund.php'); - $data = $pay->refund($out_trade_no, 1, 1, '', $out_trade_no)->toArray(); + $data = $pay->refund($out_trade_no, 1, 1, '', $paylog['uniontid'])->toArray(); if (!empty($data['status']) && 'SUCCESS' == $data['status']) { iajax(0, '已申请退款!'); } } else { $pay = $api->aliPay($_W['siteroot'] . 'payment/alipay/refund.php'); - $data = $pay->refund($out_trade_no, 0.01)->toArray(); + $data = $pay->refund($paylog['uniontid'], 0.01)->toArray(); } $refund = array( 'uniacid' => $_W['uniacid'], @@ -162,7 +190,7 @@ public function doWebRefund() { public function payResult($params) { $paylog = pdo_get('core_paylog', array('uniontid' => $params['uniontid'])); if (!empty($paylog['status'])) { - pdo_update('demo_rgapi_paylog', array('status' => 1), array('no' => $params['uniontid'])); + pdo_update('demo_rgapi_paylog', array('status' => 1), array('no' => $paylog['tid'])); } exit('success'); } @@ -170,7 +198,7 @@ public function payResult($params) { public function refundResult($params) { $paylog = pdo_get('core_refundlog', array('refund_uniontid' => $params['refund_uniontid'])); if (!empty($paylog['status'])) { - pdo_update('demo_rgapi_paylog', array('status' => 2), array('no' => $params['uniontid'])); + pdo_update('demo_rgapi_paylog', array('status' => 2), array('no' => $paylog['uniontid'])); } exit('success'); } diff --git a/addons/demo_rgapi/template/mobile/index.html b/addons/demo_rgapi/template/mobile/index.html index 814576b..aa811c6 100644 --- a/addons/demo_rgapi/template/mobile/index.html +++ b/addons/demo_rgapi/template/mobile/index.html @@ -12,5 +12,11 @@

{$_W['openid']}

+ {template 'common/footer'} diff --git a/addons/demo_rgapi/template/wechatpay.html b/addons/demo_rgapi/template/wechatpay.html old mode 100755 new mode 100644 index 37d83c7..a839825 --- a/addons/demo_rgapi/template/wechatpay.html +++ b/addons/demo_rgapi/template/wechatpay.html @@ -9,11 +9,13 @@ + 订单号 创建时间 状态 + 来源 操作 @@ -24,11 +26,17 @@ 已退款 未支付 + + Native + Wechat + Wxapp + diff --git a/addons/demo_rgapi/upgrade.php b/addons/demo_rgapi/upgrade.php new file mode 100644 index 0000000..e221e4b --- /dev/null +++ b/addons/demo_rgapi/upgrade.php @@ -0,0 +1,31 @@ +w = $_W; $this->uid = $_W['openid']; $this->uniacid = $_W['uniacid']; - // 如果需要强制登录 加 下边代码 - if (empty($this->uid)) { - $this->result(41009, '请先登录'); - } } public function get($key, $default = null) { + $this->isLogin(); return isset($this->gpc[$key]) ? $this->gpc[$key] : $default; } @@ -32,6 +30,7 @@ public function get($key, $default = null) { * 响应json串. */ public function doPageIndex() { + $this->isLogin(); $this->result(0, '', array('hello' => 'word')); } @@ -39,6 +38,7 @@ public function doPageIndex() { * 日记列表 */ public function doPageList() { + $this->isLogin(); $data = pdo_getall(self::TABLE, array('uniacid' => $this->uniacid, 'uid' => $this->uid), '', 'orderBy createtime desc'); $this->result(0, '日记列表', $data); } @@ -47,6 +47,7 @@ public function doPageList() { * 获取单条日记 */ public function doPageShow() { + $this->isLogin(); $id = intval($this->get('id', 0)); $data = pdo_get(self::TABLE, array('id' => $id, 'uid' => $this->uid, 'uniacid' => $this->uniacid)); $this->result(0, '获取单条日记', $data); @@ -56,6 +57,7 @@ public function doPageShow() { * 修改单条日记 */ public function doPageEdit() { + $this->isLogin(); $id = intval($this->get('id', 0)); $title = $this->get('title'); $content = $this->get('content'); @@ -67,6 +69,7 @@ public function doPageEdit() { * 添加日记 */ public function doPageAdd() { + $this->isLogin(); $title = $this->get('title', ''); $content = $this->get('content'); $image = $this->get('image', ''); @@ -86,8 +89,61 @@ public function doPageAdd() { * 删除日记 */ public function doPageDel() { + $this->isLogin(); $result = pdo_delete(self::TABLE, array('id' => intval($this->get('id')), 'uid' => $this->uid, 'uniacid' => $this->uniacid)); $this->result(0, '', $result ? 1 : 0); } + + /** + * 微信支付 + */ + public function doPagePay() { + $this->isLogin(); + $out_trade_no = 'wechat' . date('YmdHis', time()) . time() . rand(11, 99); + $order = array( + 'tid' => $out_trade_no, + 'user' => $this->w['openid'], + 'fee' => 0.01, + 'title' => '测试支付', + ); + $pay_params = $this->pay($order); + if (is_error($pay_params)) { + return $this->result(1, $pay_params['message']); + } + $insert = array( + 'no' => $out_trade_no, + 'code' => '', + 'status' => 0, + 'type' => 4, + 'createtime' => TIMESTAMP, + 'updatetime' => TIMESTAMP, + 'uid' => $this->w['uid'], + 'uniacid' => $this->w['uniacid'], + ); + pdo_insert('demo_rgapi_paylog', $insert); + return $this->result(0, '', $pay_params); + } + + public function payResult($params) { + $paylog = pdo_get('core_paylog', array('uniontid' => $params['uniontid'])); + if (!empty($paylog['status'])) { + pdo_update('demo_rgapi_paylog', array('status' => 1), array('no' => $paylog['tid'])); + } + exit('success'); + } + + public function refundResult($params) { + $paylog = pdo_get('core_refundlog', array('refund_uniontid' => $params['refund_uniontid'])); + if (!empty($paylog['status'])) { + pdo_update('demo_rgapi_paylog', array('status' => 2), array('no' => $paylog['uniontid'])); + } + exit('success'); + } + + public function isLogin() { + if (empty($this->uid)) { + $this->result(41009, '请先登录'); + } + } } diff --git a/app/source/mc/__init.php b/app/source/mc/__init.php old mode 100755 new mode 100644 index c000b1f..7442126 --- a/app/source/mc/__init.php +++ b/app/source/mc/__init.php @@ -18,18 +18,3 @@ exit; } } -$filter = array(); -$setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'payment', 'passport')); -$behavior = $setting['creditbehaviors']; -$creditnames = $setting['creditnames']; -$credits = mc_credit_fetch($_W['member']['uid'], '*'); - -$ucpage = table('site_page') - ->where(array( - 'uniacid' => $_W['uniacid'], - 'type' => 3, - ))->get(); -if (!empty($ucpage['params'])) { - $ucpage['params'] = json_decode($ucpage['params'], true); -} -$title = $ucpage['title']; diff --git a/app/source/mc/cash.ctrl.php b/app/source/mc/cash.ctrl.php old mode 100755 new mode 100644 index f66f521..cffd0b0 --- a/app/source/mc/cash.ctrl.php +++ b/app/source/mc/cash.ctrl.php @@ -21,41 +21,13 @@ } $moduels = uni_modules(); +$moduels = empty($moduels) ? array() : array_column($moduels, 'name'); $params = @json_decode(base64_decode($_GPC['params']), true); -if (empty($params) || !array_key_exists($params['module'], $moduels)) { +if (empty($params) || !in_array($params['module'], $moduels)) { message('访问错误.'); } -$setting = uni_setting($_W['uniacid'], 'payment'); -if (empty($setting['payment'])) { - message('支付方式错误,请联系商家', '', 'error'); -} -foreach ($setting['payment'] as &$value) { - $value['switch'] = $params['module'] == 'recharge' ? $value['recharge_switch'] : $value['pay_switch']; -} -unset($value); -$dos = array(); -if (!empty($setting['payment']['credit']['switch'])) { - $dos[] = 'credit'; -} -if (!empty($setting['payment']['alipay']['switch'])) { - $dos[] = 'alipay'; -} -if (!empty($setting['payment']['wechat']['switch'])) { - $dos[] = 'wechat'; -} -if (!empty($setting['payment']['delivery']['switch'])) { - $dos[] = 'delivery'; -} -if (!empty($setting['payment']['unionpay']['switch'])) { - $dos[] = 'unionpay'; -} -if (!empty($setting['payment']['baifubao']['switch'])) { - $dos[] = 'baifubao'; -} -if (!empty($setting['payment']['mix']['switch'])) { - $dos[] = 'mix'; -} +$dos = array('wechat', 'alipay'); $type = in_array($do, $dos) ? $do : ''; if (empty($type)) { @@ -63,17 +35,13 @@ } if (!empty($type)) { - //混合支付会有两条paylog记录,所以使用getall - $log = table(core_paylog) + $log = table('core_paylog') ->where(array( 'uniacid' => $_W['uniacid'], 'module' => $params['module'], 'tid' => $params['tid'] )) - ->orderby(array('plid' => 'ASC')) - ->limit(1) - ->getall(); - $log = empty($log) ? $log : $log[0]; + ->get(); if (!empty($log) && ($type != 'credit' && !empty($_GPC['notify'])) && $log['status'] != '0') { message('这个订单已经支付成功, 不需要重复支付.'); @@ -205,147 +173,4 @@ header("Location: $callback"); exit(); } - - if ($type == 'credit') { - ignore_user_abort(true); - $setting = uni_setting($_W['uniacid'], array('creditbehaviors')); - $credtis = mc_credit_fetch($_W['member']['uid']); - $log = table('core_paylog') - ->where(array('plid' => $ps['tid'])) - ->get(); - if ($log['module'] == 'recharge') { - message('不能使用余额支付', referer(), 'error'); - } - if (!is_numeric($log['openid'])) { - $uid = mc_openid2uid($log['openid']); - if (empty($uid)) { - $fans_info = mc_init_fans_info($log['openid']); - $uid = $fans_info['uid']; - } - $log['openid'] = $uid; - } - //如果是return返回的话,处理相应付款操作 - if (empty($_GPC['notify'])) { - if (!empty($log) && $log['status'] == '0') { - if ($credtis[$setting['creditbehaviors']['currency']] < $ps['fee']) { - message("余额不足以支付, 需要 {$ps['fee']}, 当前 {$credtis[$setting['creditbehaviors']['currency']]}"); - } - $fee = floatval($ps['fee']); - $result = mc_credit_update($_W['member']['uid'], $setting['creditbehaviors']['currency'], -$fee, array($_W['member']['uid'], '消费' . $setting['creditbehaviors']['currency'] . ':' . $fee)); - if (is_error($result)) { - message($result['message'], '', 'error'); - } - table('core_paylog')->where(array('plid' => $log['plid']))->fill(array('status' => '1'))->save(); - if (!empty($_W['openid'])) { - if (is_error($is_grant_credit)) { - $grant_credit_nums = 0; - } else { - $grant_credit_nums = $is_grant_credit['message']; - } - if (!empty($params['grant_credit1_num'])) { - $grant_credit_nums += intval($params['grant_credit1_num']); - } - mc_notice_credit2($_W['openid'], $_W['member']['uid'], $fee, $grant_credit_nums, '线上消费'); - } - $site = WeUtility::createModuleSite($log['module']); - if (!is_error($site)) { - $site->weid = $_W['weid']; - $site->uniacid = $_W['uniacid']; - $site->inMobile = true; - $method = 'payResult'; - if (method_exists($site, $method)) { - $ret = array(); - $ret['result'] = 'success'; - $ret['type'] = $log['type']; - $ret['from'] = 'return'; - $ret['tid'] = $log['tid']; - $ret['user'] = $log['openid']; - $ret['fee'] = $log['fee']; - $ret['weid'] = $log['weid']; - $ret['uniacid'] = $log['uniacid']; - $ret['acid'] = $log['acid']; - //支付成功后新增是否使用优惠券信息【需要模块去处理】 - $ret['is_usecard'] = $log['is_usecard']; - $ret['card_type'] = $log['card_type']; //区分是系统优惠券还是微信卡券 - $ret['card_fee'] = $log['card_fee']; - $ret['card_id'] = $log['card_id']; - $notify_url = murl('mc/cash/credit', array('notify' => 'yes', 'params' => safe_gpc_string($_GPC['params']), 'code' => safe_gpc_string($_GPC['code']), 'coupon_id' => intval($_GPC['coupon_id'])), true, true); - ihttp_request($notify_url); - $site->$method($ret); - } - } - } - } else { - $site = WeUtility::createModuleSite($log['module']); - if (!is_error($site)) { - $site->weid = $_W['weid']; - $site->uniacid = $_W['uniacid']; - $site->inMobile = true; - $method = 'payResult'; - if (method_exists($site, $method)) { - $ret = array(); - $ret['result'] = 'success'; - $ret['type'] = $log['type']; - $ret['from'] = 'notify'; - $ret['tid'] = $log['tid']; - $ret['user'] = $log['openid']; - $ret['fee'] = $log['fee']; - $ret['weid'] = $log['weid']; - $ret['uniacid'] = $log['uniacid']; - $ret['acid'] = $log['acid']; - //支付成功后新增是否使用优惠券信息【需要模块去处理】 - $ret['is_usecard'] = $log['is_usecard']; - $ret['card_type'] = $log['card_type']; //区分是系统优惠券还是微信卡券 - $ret['card_fee'] = $log['card_fee']; - $ret['card_id'] = $log['card_id']; - $site->$method($ret); - } - } - } - } - - if ($type == 'delivery') { - $log = table('core_paylog') - ->where(array('plid' => $ps['tid'])) - ->get(); - if (!empty($log) && $log['status'] == '0') { - $site = WeUtility::createModuleSite($log['module']); - - if (!is_error($site)) { - $site->weid = $_W['weid']; - $site->uniacid = $_W['uniacid']; - $site->inMobile = true; - $method = 'payResult'; - if (method_exists($site, $method)) { - $ret = array(); - $ret['result'] = 'failed'; - $ret['type'] = $log['type']; - $ret['from'] = 'return'; - $ret['tid'] = $log['tid']; - $ret['user'] = $log['openid']; - $ret['fee'] = $log['fee']; //原价 - $ret['weid'] = $log['weid']; - $ret['uniacid'] = $log['uniacid']; - //支付成功后新增是否使用优惠券信息【需要模块去处理】 - $ret['is_usecard'] = $log['is_usecard']; - $ret['card_type'] = $log['card_type']; //区分是系统优惠券还是微信卡券 - $ret['card_fee'] = $log['card_fee']; - $ret['card_id'] = $log['card_id']; - exit($site->$method($ret)); - } - } - } - } - if ($type == 'unionpay') { - $sl = base64_encode(json_encode($ps)); - $auth = sha1($sl . $_W['uniacid'] . $_W['config']['setting']['authkey']); - header("location: ../payment/unionpay/pay.php?i={$_W['uniacid']}&auth={$auth}&ps={$sl}"); - exit(); - } - if ($type == 'baifubao') { - $sl = base64_encode(json_encode($ps)); - $auth = sha1($sl . $_W['uniacid'] . $_W['config']['setting']['authkey']); - header("location: ../payment/baifubao/pay.php?i={$_W['uniacid']}&auth={$auth}&ps={$sl}"); - exit(); - } } diff --git a/app/themes/default/common/paycenter.html b/app/themes/default/common/paycenter.html old mode 100755 new mode 100644 index 4b8b2c6..c8a4c98 --- a/app/themes/default/common/paycenter.html +++ b/app/themes/default/common/paycenter.html @@ -21,45 +21,6 @@
订单详情
商品价格{$params['fee']} 元 - {if !empty($token) || !empty($coupon)} -
可用卡券
- - {/if} - {if $pay['mix']['switch'] && $credtis[$setting['creditbehaviors']['currency']] > 0 && $credtis[$setting['creditbehaviors']['currency']] < $params['fee']} - - {/if}
选择支付方式
-{if !empty($cards)} -
-
- -

请选择卡券

-
- -
-
-
- {loop $coupon $li} -
- - -
折扣券使用规则
-
- {/loop} -
-
-
-
-
-
- -

请选择卡券

-
- -
-
-
- {loop $token $li} -
- - -
代金券使用规则
-
- {/loop} -
-
-
-
- -{/if}