ini_set('date.timezone','Asia/Shanghai'); require_once(APP_PATH."Order/Lib/WxPay.Api.php"); require_once(APP_PATH."Order/Lib/WxPay.JsApiPay.php"); require_once(APP_PATH."Order/Lib/log.php"); $chat=WxPayConfig::MCHID().date("YmdHis"); $tools = new JsApiPay(); $openId = $tools->GetOpenid(); $input = new WxPayUnifiedOrder(); $input->SetBody("充值余额"); $input->SetOut_trade_no($chat); $input->SetTotal_fee($amount); $input->SetTime_start(date("YmdHis")); $input->SetTime_expire(date("YmdHis", time() + 600)); $input->SetNotify_url($notify_url); $input->SetTrade_type("JSAPI"); $input->SetOpenid($openId); $order = WxPayApi::unifiedOrder($input); $jsApiParameters = $tools->GetJsApiParameters($order); $data['wechat_order']=$chat; D('order_recharge')->where(array('id'=>$id))->save($data);
请确认付款