public function index() { // ISendMessageController::instance(['tousername'=>"aaa"])->scanTableQrcode(); $result = PayEvent::instance()->JsApiPay(2, 1, '高圆圆', '嘎嘎嘎', 'ggg'); if ($result['status'] == 1) { dump($result['message']); $this->assign('json', $result['message']); $this->display(); } }
/** * 支付 * @return bool|string */ public function pay() { $order_id = intval(I('request.id')); if (!empty($order_id) && is_numeric($order_id)) { $order = OrderModel::instance()->getOrder($order_id); if (!$order) { E('无效订单'); } if (ctype_digit($order['mid'])) { $wx_usr = OrderModel::instance()->getWxUser($order['mid']); if (!empty($wx_usr) && is_array($wx_usr)) { $wx_pay = PayEvent::instance()->JsApiPay($wx_usr['id'], $order['id'], $order['sn'], $order['price'] * 100, '商品支付', '', $order['shop_id']); if ($wx_pay['status'] == 1) { $this->assign('jsApiParameters', $wx_pay['message']); } else { E("{$wx_pay['message']}"); } } else { E('查无此微信账号'); } } $this->assign('shop_id', $order['shop_id']); $this->assign('order_id', $order_id); $this->assign('price', $order['price']); } $this->display(); }