public function index() { $this->initial_order(); $pay_type_data = array('pay_type_id' => $this->order['pay_type_id'], 'method_id' => $this->order['method_id']); $this->initial_merchant_data($pay_type_data); $recharging_order['order_sn'] = $this->order['order_sn']; $recharging_order['merchant_id'] = $this->merchant_id; $client = new SoapClient($this->wsdl); $create_session_arr = array('UserName' => $this->partnerName, 'Password' => $this->partnerPwd); $ses = $client->CreateSession($create_session_arr); $res_array = get_object_vars($ses); $sessionResponse = get_object_vars($ses->CreateSessionResult); if (!array_key_exists("SessionID", $sessionResponse)) { // SessionID没有获取到,则跳转到支付页面 if ($err = $sessionResponse['ErrorCode']) { $log_array = array('type' => 'paytogo sessionResponse result', 'value' => $err . ":" . $sessionResponse['ErrorDescription']); log_message('gash', json_encode($log_array)); } return; } $token = $sessionResponse['SessionID']; $recharging_order['tradeseq'] = $token; $update_res = $this->CI->payorder->update_order_to_recharging($recharging_order); $start_payment_arr = array('SessionID' => $token, 'prsRequest' => array('CustomerPhoneNumber' => $this->CI->input->post('phone_number'), 'Price' => $this->order['pay_amount'], 'CustomerIPAddress' => $this->order['pay_ip'], 'OrderDetail' => $this->order['order_sn'], 'ProductCategory' => 'Oyun'), 'Type' => 'Web_Platform'); $processResponse = $client->StartPayment($start_payment_arr); $resultCode = $processResponse->StartPaymentResult->resultCode; if ($resultCode === '00') { $res = $this->recharge_lang['check_sms']; // 查看手机短信 } else { if ($resultCode === '08' || $resultCode === '12') { $res = $this->returnResult($resultCode); } else { $res = $this->recharge_lang['ask_to_try']; } } $log_array = array('type' => 'paytogo startPayment result', 'value' => $resultCode . ":" . $res); log_message('gash', json_encode($log_array)); $this->CI->payorder->over($res); }