[更新]修改微信支付demo

This commit is contained in:
邹景立 2017-04-14 17:41:52 +08:00
parent 9af977fac7
commit 8ea7017ff2

View File

@ -54,11 +54,9 @@ class Wap extends BasicWechat {
public function payjs() {
$this->openid = $this->oAuth(false);
dump($this->openid);
$this->assign('jsSign', load_wechat('script')->getJsSign($this->url));
switch ($this->request->get('action')) {
case 'options':
$pay = &load_wechat('pay');
$order_no = session('pay-test-order-no');
if (empty($order_no)) {
$order_no = DataService::createSequence(10, 'wechat-pay-test');
@ -67,6 +65,7 @@ class Wap extends BasicWechat {
if (PayService::isPay($order_no)) {
return json(['code' => 2, 'order_no' => $order_no]);
}
$pay = &load_wechat('pay');
$options = PayService::createWechatPayJsPicker($pay, $this->openid, $order_no, 1, 'JSAPI支付测试');
return json($options);
case 'reset':