12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * AlipayController.php UTF-8
- *
- *
- * @date : 2018/6/6 20:22
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\wapapp\controller\v8;
- use api\common\controller\V2ApiBaseController;
- use huolib\pay\Pay;
- use think\Config;
- class AlipayController extends V2ApiBaseController {
- function _initialize() {
- parent::_initialize();
- Config::set('default_return_type', 'html');
- }
- /**
- * 支付宝支付通知地址
- * alipay/return
- *
- * @return mixed
- * @throws \think\Exception
- */
- public function returnUrl() {
- $_pay_class = Pay::ins()->get('alipay');
- $_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');
- }
- /**
- * 支付宝支付显示地址
- * alipay/show
- *
- * @return mixed
- */
- 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');
- }
- }
|