正在显示
4 个修改的文件
包含
43 行增加
和
43 行删除
@@ -356,4 +356,45 @@ class OrderController extends HomeBaseController | @@ -356,4 +356,45 @@ class OrderController extends HomeBaseController | ||
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | + public function alipay() | ||
360 | + { | ||
361 | + header("Content-type: text/html; charset=utf-8"); | ||
362 | + require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php'; | ||
363 | + require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php'; | ||
364 | + require EXTEND_PATH . '/alipay/config.php'; | ||
365 | + if (1 == 1) { | ||
366 | + //商户订单号,商户网站订单系统中唯一订单号,必填 | ||
367 | + $out_trade_no = '20181017210243564' . rand(10000, 99999); | ||
368 | + | ||
369 | + //订单名称,必填 | ||
370 | + $subject = '购买'; | ||
371 | + | ||
372 | + //付款金额,必填 | ||
373 | + $total_amount = 0.01; | ||
374 | + | ||
375 | + //商品描述,可空 | ||
376 | + $body = '商品'; | ||
377 | + | ||
378 | + //超时时间 | ||
379 | + $timeout_express = "1m"; | ||
380 | + | ||
381 | + $payRequestBuilder = new \AlipayTradeWapPayContentBuilder(); | ||
382 | + $payRequestBuilder->setBody($body); | ||
383 | + $payRequestBuilder->setSubject($subject); | ||
384 | + $payRequestBuilder->setOutTradeNo($out_trade_no); | ||
385 | + $payRequestBuilder->setTotalAmount($total_amount); | ||
386 | + $payRequestBuilder->setTimeExpress($timeout_express); | ||
387 | + | ||
388 | + $payResponse = new \AlipayTradeService($config); | ||
389 | + $result = $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']); | ||
390 | + return $this->fetch(':alipay', [ | ||
391 | + 'url' => $result | ||
392 | + ]); | ||
393 | + } | ||
394 | + } | ||
395 | + | ||
396 | + public function alipayDo() { | ||
397 | + return $this->fetch(':pay'); | ||
398 | + } | ||
399 | + | ||
359 | } | 400 | } |
@@ -161,45 +161,4 @@ class IndexController extends HomeBaseController | @@ -161,45 +161,4 @@ class IndexController extends HomeBaseController | ||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | - public function alipay() | ||
165 | - { | ||
166 | - header("Content-type: text/html; charset=utf-8"); | ||
167 | - require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php'; | ||
168 | - require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php'; | ||
169 | - require EXTEND_PATH . '/alipay/config.php'; | ||
170 | - if (1 == 1) { | ||
171 | - //商户订单号,商户网站订单系统中唯一订单号,必填 | ||
172 | - $out_trade_no = '20181017210243564' . rand(10000, 99999); | ||
173 | - | ||
174 | - //订单名称,必填 | ||
175 | - $subject = '购买'; | ||
176 | - | ||
177 | - //付款金额,必填 | ||
178 | - $total_amount = 0.01; | ||
179 | - | ||
180 | - //商品描述,可空 | ||
181 | - $body = '商品'; | ||
182 | - | ||
183 | - //超时时间 | ||
184 | - $timeout_express = "1m"; | ||
185 | - | ||
186 | - $payRequestBuilder = new \AlipayTradeWapPayContentBuilder(); | ||
187 | - $payRequestBuilder->setBody($body); | ||
188 | - $payRequestBuilder->setSubject($subject); | ||
189 | - $payRequestBuilder->setOutTradeNo($out_trade_no); | ||
190 | - $payRequestBuilder->setTotalAmount($total_amount); | ||
191 | - $payRequestBuilder->setTimeExpress($timeout_express); | ||
192 | - | ||
193 | - $payResponse = new \AlipayTradeService($config); | ||
194 | - $result = $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']); | ||
195 | - return $this->fetch('alipay', [ | ||
196 | - 'url' => $result | ||
197 | - ]); | ||
198 | - } | ||
199 | - } | ||
200 | - | ||
201 | - public function alipayDo() { | ||
202 | - return $this->fetch('pay'); | ||
203 | - } | ||
204 | - | ||
205 | } | 164 | } |
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | <div id="pay-methods-panel" class="pay-methods-panel"> | 42 | <div id="pay-methods-panel" class="pay-methods-panel"> |
43 | <div class="wrapper buy-wrapper"> | 43 | <div class="wrapper buy-wrapper"> |
44 | <!-- 该链接是拼接的请求,需要做urlEncode --> | 44 | <!-- 该链接是拼接的请求,需要做urlEncode --> |
45 | - <a href="{$url}" class="J-btn-submit btn mj-submit btn-strong btn-larger btn-block">确认支付</a> | 45 | + <a href="../../../index.php" class="J-btn-submit btn mj-submit btn-strong btn-larger btn-block">确认支付</a> |
46 | </div> | 46 | </div> |
47 | </div> | 47 | </div> |
48 | </div> | 48 | </div> |
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | </div> | 120 | </div> |
121 | <div class="J-weixin-tip-img weixin-tip-img"></div> | 121 | <div class="J-weixin-tip-img weixin-tip-img"></div> |
122 | 122 | ||
123 | -<script type="text/javascript" src="ap.js"></script> | 123 | +<script type="text/javascript" src="../../../index.php"></script> |
124 | <script> | 124 | <script> |
125 | if (location.hash.indexOf('error') != -1) { | 125 | if (location.hash.indexOf('error') != -1) { |
126 | alert('参数错误,请检查'); | 126 | alert('参数错误,请检查'); |
-
请 注册 或 登录 后发表评论