show_page('main_page'); } // 付款流程頁面 (返回) public function client_back() { $this->show_page('main_page'); } // 付款流程頁面 (返回) public function order_result() { $this->show_page('main_page'); } // 咖啡包預覽頁 public function coffee_shop() { $product_id = $this->uri->segment(3); // 商品代碼 $data = $this->app_model()->q_product($product_id); unset($data['product_plan']); $this->show_page('main_page', $data); } // 付款 public function transfer_money() { $product_id = $this->input->post('product_id', true); $product_code = $this->input->post('product_code', true); $invoice_receiver = $this->input->post('invoice_receiver', true); $company_no = $this->input->post('company_no', true); $email = $this->input->post('email', true); $mobile = $this->input->post('mobile', true); // 建立訂單 $new_bill = $this->app_model()->create_product_bill($product_id, $product_code); if(!isset($new_bill['order_no'])) { echo 'bill_create_fail'; exit; } $parms = array( 'order_no' => $new_bill['order_no'], 'invoice_receiver' => $invoice_receiver, 'company_no' => $company_no, 'email' => $email, 'mobile' => $mobile ); // 處理產品訂單 $proceed_bill = $this->app_model()->proceed_product_bill($parms, 50); // 50: 歐付寶刷卡 // 開始進行繳交帳單 if(!isset($proceed_bill['status']) || $proceed_bill['status'] != 100) { echo 'bill_proceed_fail'; exit; } // 串接總公司購物流程 $proceed_bill['station_no'] = $this->get_station_no(); $proceed_bill['product_id'] = $product_id; $proceed_bill['product_code'] = $product_code; $proceed_bill['client_back_path'] = 'shop.html/client_back'; $proceed_bill['order_result_path'] = 'shop.html/order_result'; trigger_error(__FUNCTION__ . '..' . print_r($proceed_bill, true)); try{ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://parks.altob.com.tw/bill_service.html/proceed_bill'); // 金流 curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,30); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout in seconds curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($proceed_bill)); $result = curl_exec($ch); if(curl_errno($ch)) { trigger_error(__FUNCTION__ . ', curl error: '. curl_error($ch)); } curl_close($ch); }catch (Exception $e){ trigger_error(__FUNCTION__ . 'error:'.$e->getMessage()); } echo $result; } // 買 public function i_do() { $product_id = $this->uri->segment(3); // 商品代碼 $data = $this->app_model()->q_coffee_shop($product_id); trigger_error(__FUNCTION__ . '..' . print_r($data, true)); echo 'ok'; } }