123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * WxpayController.php UTF-8
- *
- *
- * @date : 2018/6/6 20:33
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\cfloat\controller;
- use api\common\controller\CFloatBaseController;
- use huo\controller\pay\Notify;
- use huolib\pay\Pay;
- use think\Config;
- class WxpayController extends CFloatBaseController {
- function _initialize() {
- parent::_initialize();
- Config::set('default_return_type', 'html');
- }
- /**
- * 微信支付回调地址
- * wxpay/notify
- */
- public function notifyUrl() {
- $_class = new Notify();
- $_class->notifyUrl('wxpay');
- }
- /**
- * 微信支付通知地址
- * wxpay/return
- *
- * @return mixed
- * @throws \think\Exception
- */
- public function returnUrl() {
- $_pay_class = Pay::ins()->get('wxpay');
- $_pay_rs = $_pay_class->returnUrl();
- $this->assign('info', $_pay_rs);
- $_msg = "支付成功!";
- if ("3" == $_pay_rs['status']) {
- $_msg = "支付失败!";
- $this->assign('msg', $_msg);
- return $this->fetch('order/failed');
- }
- $this->assign('msg', $_msg);
- return $this->fetch('order/success');
- }
- /**
- * 微信支付显示地址
- * wxpay/show
- *
- * @return mixed
- * @throws \think\Exception
- */
- public function showUrl() {
- $_order_id = $this->request->param('order_id');
- if (empty($_order_id)) {
- $_msg = '未支付';
- $this->assign('msg', $_msg);
- return $this->fetch('order/failed');
- }
- $_msg = '玩家取消支付,请重新下单';
- $this->assign('msg', $_msg);
- return $this->fetch('order/failed');
- }
- }
|