$this->oWxPay->appid, 'notify_url' => Config::get('site.scheme') . '://' . $this->oWxPay->pay_host . '/api/wechat/alih5pay', 'return_url' => $this->getRedirectUrl()->data, 'ali_public_key' => $this->oWxPay->quartet_app_public_key, 'private_key' => $this->oWxPay->quartet_app_key, 'http' => [ // optional 'timeout' => 5.0, 'connect_timeout' => 5.0, ], ]; $config = array_merge(PayConstants::getH5DefaultConfig(), $config); LogService::debug(json_encode($config, JSON_UNESCAPED_UNICODE)); $this->alipay = Pay::alipay($config); return $this->alipay; } /** * 创建支付宝订单 * @return \app\main\model\object\ReturnObject */ public function createOrder() { $url = ''; try { $this->initPay(); $out_trade_no = $this->getOutTradeNo($this->oOrder->user_id)->data; $order = [ 'out_trade_no' => $out_trade_no, 'total_amount' => $this->oOrder->money, 'subject' => $this->oOrder->type == 2 ? '充值VIP' : '充值书币', 'http_method' => 'GET', 'time_expire' => date('Y-m-d H:i:s', time() + PayConstants::getPayTimeoutSeconds()), ]; $content = $this->alipay->wap($order)->getContent(); //补充订单信息 $this->oOrder->payid = ''; preg_match('//', $content, $match); $url = htmlspecialchars_decode($match[1]); $this->oOrder->pay_json = $url; $this->oOrder->out_trade_no = $out_trade_no; $this->oOrder->pdorderid = ''; } catch (\Exception $e) { LogService::exception($e); } LogService::debug('alih5payurl:' . $url); return $this->setData(['redirect' => $url])->getReturn(); } }