* @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'); } }