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