赞
踩
/** * 支付通知和回调 * @throws \think\exception\DbException */ public function epay() { $type = $this->request->param('type'); $paytype = $this->request->param('paytype'); $content = file_get_contents("php://input"); file_put_contents('file_order_wechat_pay.txt',$content,FILE_APPEND); if ($type == 'notify') { $pay = \addons\epay\library\Service::checkNotify($paytype); if (!$pay) { echo '签名错误'; return; } $data = $pay->verify(); try { $payamount = $paytype == 'alipay' ? $data['total_amount'] : $data['total_fee'] / 100; self::settle($data['out_trade_no'], $payamount); } catch (Exception $e) { } echo $pay->success(); } else { $pay = \addons\epay\library\Service::checkReturn($paytype); if (!$pay) { $this->error('签名错误'); } //微信支付没有返回链接 if ($pay === true) { $this->success("请返回网站查看支付状态!", ""); } //你可以在这里定义你的提示信息,但切记不可在此编写逻辑 $this->success("恭喜你!充值成功!", url("user/index")); } return; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。