1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * AlipayController.php UTF-8
- * 支付宝对外处理页面
- *
- * @date : 2018/2/8 15:42
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\sdk\controller;
- use api\common\controller\V2ApiBaseController;
- use huo\controller\pay\Notify;
- use huolib\pay\Pay;
- use think\Config;
- class ShengpayController extends V2ApiBaseController {
- function _initialize() {
- parent::_initialize();
- \think\Log::write($this->request->getContent(), 'error');
- Config::set('default_return_type', 'html');
- }
- /**
- * 盛付通支付回调地址
- * shengpay/notify
- */
- public function notifyUrl() {
- $_class = new Notify();
- if (!isset($_REQUEST['Ext1'])) {
- exit('fail');
- }
- $_ext1 = $_REQUEST['Ext1'];
- $_ext1 = htmlspecialchars_decode($_ext1);
- $_ext = json_decode($_ext1, true);
- $_product_id = $_ext['product_id'];
- $_class->notifyUrl('shengpay', $_product_id);
- }
- /**
- * 盛付通支付成功后通知地址
- * shengpay/return
- *
- * @return mixed
- * @throws \think\Exception
- */
- public function returnUrl() {
- $_pay_class = Pay::ins()->get('shengpay');
- $_pay_rs = $_pay_class->returnUrl();
- $this->assign('info', $_pay_rs);
- $_msg = "支付成功!";
- $this->assign('return_url', '');
- if ("3" == $_pay_rs['status']) {
- $_msg = "支付失败!";
- $this->assign('msg', $_msg);
- return $this->fetch('order/failed');
- }
- $this->assign('msg', $_msg);
- return $this->fetch('order/success');
- }
- }
|