public function ydf_excel($date = NULL) { header("Content-Type: text/html; charset=gb2312"); if ($date == NULL) { $date = date('Y-m-d'); } $orders = $this->get_ydf_order($date); $head = array('Sales Record Number', 'Buyer Fullname', 'Buyer Company', 'Buyer Address 1', 'Buyer Address 2', 'Buyer City', 'Buyer State', 'Buyer Zip', 'Buyer Phone Number', 'Buyer Country', 'Custom Label', 'Description EN', 'Description CN', 'HS Code', 'Quantity', 'Sale Price', 'Country of Manufacture', 'Mark', 'weight', 'Length', 'Width', 'Height', 'Shipping Service', 'Shipping Service Name', 'Track Number'); foreach ($orders as $order) { $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $shipping_method = shipping_method($order->is_register); //echo $order->id."<br>"; $count = count($skus); $product_name = ''; $product_name_en = ''; $qty = 0; $weight = 0; $rmb = price($this->order_model->calc_currency($order->currency, $order->gross)); for ($i = 0; $i < $count; $i++) { if ($i == 0) { $product_name .= iconv("UTF-8", "GB2312//IGNORE", get_product_name($skus[$i])); $product_name_en .= iconv("UTF-8", "GB2312//IGNORE", get_product_name_en($skus[$i])); } $qty += $qties[$i]; $weight += get_weight_by_sku($skus[$i]) * $skus[$i]; } $shipping_method_name_cn = iconv("UTF-8", "GB2312//IGNORE", $shipping_method->name_cn); $data[] = array($order->id, $order->name, " ", $order->address_line_1, $order->address_line_2, $order->town_city, $order->state_province, $order->zip_code, $order->contact_phone_number, $order->country, $skus[0], $product_name_en, $product_name, " ", $qty, $rmb, " ", " ", $weight, " ", " ", " ", $shipping_method->ydf_code, $shipping_method_name_cn, $order->track_number); } $this->excel->array_to_excel($data, $head, 'ydf_list_' . $date); }
public function complete_sale_merged_orders() { $all_wait_complete_merged_orders_transaction_ids = $this->order_model->fetch_all_wait_complete_merged_orders(); var_dump($all_wait_complete_merged_orders_transaction_ids); foreach ($all_wait_complete_merged_orders_transaction_ids as $all_wait_complete_merged_orders_transaction_id) { $ebay_orders = $this->ebay_order_model->get_ebay_order_by_paypal_transaction_id($all_wait_complete_merged_orders_transaction_id['transaction_id']); $order = $this->order_model->get_order($all_wait_complete_merged_orders_transaction_id['old_id']); if (empty($order)) { return; } // skip Epacket order if ($order->is_register == 'H') { return; } if (empty($order->to_email)) { return; } $ebay_ids = $this->config->item('ebay_id'); $ebay_id = $order->ebay_id; if (empty($ebay_id)) { $ebay_id = $ebay_ids[$order->to_email]; if (empty($ebay_id)) { return; } } $item_ids = explode(',', $order->item_id_str); $item_titles = explode(ITEM_TITLE_SEP, $order->item_title_str); $track_numbers = explode(',', $order->track_number); $order_id = $all_wait_complete_merged_orders_transaction_id['old_id']; foreach ($ebay_orders as $ebay_order) { $shipping_method = shipping_method($order->is_register); $shipping_carrier = $this->_shipping_carrier($shipping_method, $order->country); $shipping_date = get_utc_time($order->ship_confirm_date); $shipping_note = $shipping_method->name_en; $data = array('order_id' => $order_id, 'ebay_id' => $ebay_id, 'track_numbers' => $track_numbers, 'item_id' => $ebay_order->item_id, 'transaction_id' => $ebay_order->transaction_id, 'shipping_carrier' => $shipping_carrier, 'shipping_date' => $shipping_date, 'shipping_note' => $shipping_note); print_r($data); $this->_proccess_complete_sale($data); $data_order = array('is_shiped_ebay' => 1); $this->order_model->update_order_merged_list_information($all_wait_complete_merged_orders_transaction_id['transaction_id'], $data_order); } } }
public function complete_sale($order_id) { $order = $this->order_model->get_order($order_id); if ($order->domain == 'www.7daysget.com') { $status_array = array('SGS' => 13, 'CHS' => 13, 'HKS' => 13, 'CHR' => 8, 'CNR' => 8, 'EMS' => 9, 'DHL' => 10, 'SGR' => 8, 'EUB' => 8, 'HKR' => 8, 'MYR' => 8); } if ($order->domain == 'www.screamprice.com') { $status_array = array('SGS' => 13, 'CHS' => 13, 'HKS' => 13, 'CHR' => 8, 'CNR' => 8, 'EMS' => 9, 'DHL' => 10, 'SGR' => 8, 'EUB' => 8, 'HKR' => 8, 'MYR' => 8); } $shipping_method = shipping_method($order->is_register); $track_numbers = explode(',', $order->track_number); $qties = explode(',', $order->qty_str); $item_ids = explode(',', $order->item_id_str); $itemsQty = array(); foreach ($item_ids as $key => $item_id) { $itemsQty[$item_id] = $qties[$key]; } if ($order->auction_site_type == 'zencart') { $action = 'ordermodify'; $zencart_gateway_url = "http://" . $order->domain . "/GetOrdersApi.php"; $zencart_gateway_url = $zencart_gateway_url . "/" . $action . "/"; $status = $status_array[$order->is_register]; $track_url = ''; if ($order->track_number != '' || !empty($order->track_number) || $order->track_number != NULL) { $comments = 'items has been shipped on ' . date('Y-m-d H:i:s') . ';tracking url:http://www.17track.net; tracking numbers:' . $order->track_number; $track_url = 'http://www.17track.net'; } else { $comments = 'items has been shipped on ' . date('Y-m-d H:i:s'); } $notify = 1; $notify_comments = 1; $postfield = "id=" . $order->input_from_row . "&no=" . $order->transaction_id . "&status=" . $status . "&comments=" . $comments . "¬ify=" . $notify . "¬ify_comments=" . $notify_comments . "&domain=" . $order->domain . "&track_number=" . $order->track_number . "&track_url=" . $track_url; //$zencart_gateway_url=$zencart_gateway_url."?".$postfield; //die($zencart_gateway_url); echo $postfield . "\n"; $ch = curl_init(); $header[] = "Content-type: text/xml"; //定义content-type为xml curl_setopt($ch, CURLOPT_URL, $zencart_gateway_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); //启用POST提交 curl_setopt($ch, CURLOPT_POSTFIELDS, $postfield); //设置POST提交的字符串 curl_setopt($ch, CURLOPT_HEADER, 0); $response = curl_exec($ch); curl_close($ch); $this->ebay_order_model->delete_order_id($order_id); } //end magento if }
public function late_print_label() { $style = array('position' => 'S', 'align' => 'C', 'stretch' => false, 'fitwidth' => false, 'cellfitalign' => '', 'border' => false, 'padding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 12, 'stretchtext' => 4); $list_type = $this->input->post('list_type'); if ($list_type == 1) { $width = 100; $height = 100; $pagelayout = array($width, $height); $my_tcpdf['page_format'] = $pagelayout; $my_tcpdf['page_orientation'] = 'L'; $tcpdf['encoding'] = 'UTF-8'; $this->load->library('pdf', $my_tcpdf); $this->pdf->SetCreator('Mallerp'); $this->pdf->SetAuthor('Mansea'); $this->pdf->SetTitle('Ebay ShipOrder List'); $this->pdf->SetSubject('Mallerp'); $this->pdf->SetKeywords('Mansea, Mallerp, zhaosenlin, 278203374, 7410992'); $this->pdf->SetFont('arialunicid0', '', 23); $this->pdf->setPrintHeader(false); $this->pdf->setPrintFooter(false); $this->pdf->SetMargins(0, 0, 0); } if ($list_type == 2) { $head = array('Transaction Date', 'Transaction ID', 'Product', 'SKU', 'Quantity', 'Name', 'Shipping Cost', 'ERP order number', 'Price', 'Discount Price', 'Total Cost'); } if ($list_type == 3) { $my_tcpdf['page_orientation'] = 'L'; $tcpdf['encoding'] = 'UTF-8'; $this->load->library('pdf', $my_tcpdf); $this->pdf->SetCreator('Mallerp'); $this->pdf->SetAuthor('Mansea'); $this->pdf->SetTitle('Ebay ShipOrder List'); $this->pdf->SetSubject('Mallerp'); $this->pdf->SetKeywords('Mansea, Mallerp, zhaosenlin, 278203374, 7410992'); $this->pdf->SetFont('arialunicid0', '', 23); } $CI =& get_instance(); $this->load->library('excel'); if (!$this->input->is_post()) { return; } $post_keys = array_keys($_POST); $order_ids = array(); $i_d = 0; foreach ($post_keys as $key) { if (strpos($key, 'checkbox_select_') === 0) { $order_ids[] = $_POST[$key]; } } $orders = array(); $user_name = $this->get_current_user_name(); $products = array(); $data = array(); $all_total_cost = 0; foreach ($order_ids as $order_id) { $i_d++; $order = $this->order_model->get_order($order_id); $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $temp_skus = array(); $temp_qties = array(); foreach ($skus as $i => $sku) { if ($this->order_model->check_exists('product_makeup_sku', array('makeup_sku' => $sku))) { $makeup_sku = $this->product_makeup_sku_model->fetch_makeup_sku_by_sku($skus[$i]); $sku_arr = explode(',', $makeup_sku->sku); $qty_arr = explode(',', $makeup_sku->qty); foreach ($sku_arr as $key => $value) { $temp_skus[] = $value; $count_sku = (int) $qties[$i] * $qty_arr[$key]; $temp_qties[] = $count_sku; } } else { $temp_skus[] = $sku; $temp_qties[] = $qties[$i]; } } $skus = $temp_skus; $qties = $temp_qties; $j = 0; $error = FALSE; /*补打标签不更新库存*/ $orders[] = $this->order_model->get_order($order_id); if ($list_type == 1) { /*添加一页pdf打印*/ $this->pdf->AddPage(); $page_index = 1; /*定义打印变量*/ $shipping_method = shipping_method($order->is_register); $country_name_cn = get_country_name_cn($order->country); $shipaddress = ""; $phone = ''; $shipaddress = trim($order->address_line_1) . " " . trim($order->address_line_2) . " " . trim($order->town_city) . " " . trim($order->state_province) . " " . trim($order->zip_code); $print_date = date('Y.m.d'); if (!empty($order->contact_phone_number)) { $phone = "<br/>Telephone:{$order->contact_phone_number}"; } $htmlshipping_method = <<<EOD <span style="font-family:droidsansfallback;font-size:12;">{$shipping_method->name_cn} [{$order->is_register}]</span> EOD; $htmlauction_site = <<<EOD <span style="font-family:droidsansfallback;font-size:20;">{$order->auction_site}</span> EOD; $text_to = <<<EOD <span style="font-family:Arial, Helvetica, sans-serif; font-size:16;font-weight:bold;">TO:</span> EOD; $ship_to_add = <<<EOD <span style="text-align:left;white-space:nowrap;font-size:12;font-weight:bold;">{$order->name}<br>{$shipaddress} <br>{$order->country}[{$country_name_cn}] {$phone}</span> EOD; $htmlprint_date = <<<EOD <span style="text-align:left;white-space:nowrap;font-size:8;">日期:{$print_date}</span> EOD; $img_hr = <<<EOD <hr style="height:0.3mm;width:98mm;"> EOD; if ($order->note != '') { $break_key = 4; $first_page_sku_num = 5; $page_break_key = 8; $order_note = <<<EOD <span style="text-align:left;white-space:nowrap;font-size:8;">NOTE:{$order->note}</span> EOD; } else { $break_key = 6; $first_page_sku_num = 7; $page_break_key = 6; $order_note = ''; } $this->pdf->writeHTMLCell($w = 90, $h = 8, $x = 5, $y = 1, $htmlshipping_method, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); $this->pdf->write1DBarcode($order_id, 'C128A', 5, 8, 70, 8, 0.8, $style, 'C'); //write1DBarcode($code, $type, $x, $y, $w, $h, $xres, $newstyle, ''); $this->pdf->writeHTMLCell($w = 18, $h = 10, $x = 81, $y = 10, $htmlauction_site, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); $this->pdf->writeHTMLCell($w = 15, $h = 30, $x = 2, $y = 21, $text_to, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $this->pdf->writeHTMLCell($w = 75, $h = 30, $x = 18, $y = 21, $ship_to_add, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); $this->pdf->writeHTMLCell($w = 98, $h = 1, $x = 1, $y = 56, $img_hr, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); foreach ($skus as $key => $sku) { $no = $key + 1; $num_no = $key + 1; $sql1 = 'name_cn,shelf_code'; $myproduct = $CI->product_model->fetch_product_by_sku($sku, $sql1); $htmlproduct_list = ''; $htmlproduct_list = <<<EOD <span style="white-space:nowrap;font-size:9;">({$num_no}) {$myproduct->shelf_code}-{$sku}-{$myproduct->name_cn}*{$qties[$key]}</span> EOD; $this->pdf->writeHTMLCell($w = 98, $h = 3, $x = 1, $y = 52 + 5 * $no, $htmlproduct_list, $border = 0, $ln = 0, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); if ($key == $break_key) { break; } } /*备注打印在第一页*/ if ($order->note != '') { $this->pdf->writeHTMLCell($w = 98, $h = 6, $x = 1, $y = 81, $order_note, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); } $this->pdf->writeHTMLCell($w = 40, $h = 3, $x = 2, $y = 95, $htmlprint_date, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); if (count($skus) > $first_page_sku_num) { foreach ($skus as $key => $sku) { if ($key >= $first_page_sku_num && $page_index * 13 - $key == $page_break_key) { $this->pdf->AddPage(); $page_index++; $htmllink_uppage = <<<EOD <span style="text-align:left;white-space:nowrap;font-size:12;">接上页清单:order id:{$order_id},本页是第{$page_index}页</span> EOD; $this->pdf->writeHTMLCell($w = 90, $h = 8, $x = 5, $y = 1, $htmllink_uppage, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); $this->pdf->writeHTMLCell($w = 40, $h = 3, $x = 2, $y = 95, $htmlprint_date, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); } if (ceil(($key + $page_break_key + 1) / 13) == $page_index && $key >= $first_page_sku_num) { $no = $key + $page_break_key - ($page_index - 1) * 13 + 1; $num_no = $key + 1; $sql1 = 'name_cn,shelf_code'; $myproduct = $CI->product_model->fetch_product_by_sku($sku, $sql1); $htmlproduct_list = ''; $htmlproduct_list = <<<EOD <span style="white-space:nowrap;font-size:9;">({$num_no}) {$myproduct->shelf_code}-{$sku}-{$myproduct->name_cn}*{$qties[$key]}</span> EOD; $this->pdf->writeHTMLCell($w = 98, $h = 3, $x = 1, $y = 10 + 5 * $no, $htmlproduct_list, $border = 0, $ln = 0, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); } } } if (in_array(strtoupper($order->is_register), array('CHR', 'CHS', 'HKR', 'HKS', 'MYR', 'MYS', 'SGR', 'SGS'))) { $big_is_register = strtoupper($order->is_register); $this->pdf->AddPage(); $return_post_img = <<<EOD <img width="99mm" height="99mm" src="/static/images/returnpost/{$big_is_register}.jpg"/> EOD; $this->pdf->writeHTMLCell($w = 99, $h = 99, $x = 0, $y = 0, $return_post_img, $border = 0, $ln = 0, $fill = 0, $reseth = true, $align = 'C', $autopadding = false); } } elseif ($list_type == 2) { /*为wish pi excel增加一行*/ $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $price = ''; $discount_price = ''; $total_cost = 0; foreach ($skus as $key => $sku) { $sql1 = 'sale_price'; $myproduct = $CI->product_model->fetch_product_by_sku($sku, $sql1); $price .= $myproduct->sale_price; $discount_price .= price($myproduct->sale_price * 0.961); $total_cost += $myproduct->sale_price * 0.961 * $qties[$key]; if ($key + 1 != count($skus)) { $price .= ','; $discount_price .= ','; } } $total_cost += 1.99; $all_total_cost += $total_cost; $data[] = array($order->created_at, $order->transaction_id, $order->item_title_str, $order->sku_str, $order->qty_str, $order->name, '1.99', $order->item_no, $price, $discount_price, price($total_cost)); } elseif ($list_type == 3) { /*添加一页A4 pdf打印*/ $this->pdf->AddPage('P', 'A4'); //$skus = explode(',', $order->sku_str); //$qties = explode(',', $order->qty_str); $print_date = date('Y.m.d'); $user = fetch_user_name_by_id(fetch_user_id_by_login_name($order->input_user)); $country_cn_name = get_country_name_cn($order->country); $html8 = <<<EOD <table width="100%" border="1" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;font-size:12;"> <tr style="font-family:droidsansfallback;font-size:12;"><td>业务员</td><td>{$user}</td><td>订单识别号</td><td>{$order->item_no}</td><td colspan="2" rowspan="3">备注:{$order->note}</td></tr> EOD; $html8 .= <<<EOD <tr style="font-family:droidsansfallback;font-size:12;"><td>客户名称</td><td>{$order->name}</td><td>国家</td><td>{$country_cn_name}</td></tr> <tr style="font-family:droidsansfallback;font-size:12;"><td>运输方式</td><td>{$order->is_register}</td><td>日期</td><td>{$print_date}</td></tr> <tr style="font-family:droidsansfallback;font-size:12;"><td>货架号</td><td>SKU</td><td>数量</td><td>图片</td><td>中文名称</td><td>单价</td></tr> EOD; foreach ($skus as $key => $sku) { $sql1 = 'name_cn,shelf_code,sale_price,image_url,price'; $myproduct = $CI->product_model->fetch_product_by_sku($sku, $sql1); $image = ""; if ($myproduct->image_url != '' && $myproduct->image_url != NULL && $myproduct->image_url != 'none') { if (strpos($myproduct->image_url, 'http://') !== false) { $url = $myproduct->image_url; } else { $url = 'http://erp.screamprice.com' . $myproduct->image_url; } //$header= get_headers($url); if ($this->img_exits($url)) { $arr = getimagesize($url); if (count($arr) > 0) { $image = '<img src="' . $myproduct->image_url . '" border="0" height="15mm" width="15mm" />'; } } } else { $image = '<img src="http://erp.screamprice.com/static/images/404-error.png" border="0" height="25mm" width="25mm" />'; } $html8 .= <<<EOD <tr style="font-family:droidsansfallback;font-size:12;height:15mm;"><td style="font-family:droidsansfallback;font-size:12;height:15mm;">{$myproduct->shelf_code}</td><td style="font-family:droidsansfallback;font-size:12;height:15mm;">{$sku}</td><td style="font-family:droidsansfallback;font-size:12;height:15mm;">{$qties[$key]}</td><td style="font-family:droidsansfallback;font-size:12;height:15mm;">{$image}</td><td style="font-family:droidsansfallback;font-size:12;height:15mm;">{$myproduct->name_cn}</td><td style="font-family:droidsansfallback;font-size:12;height:15mm;">{$myproduct->sale_price}</td></tr> EOD; //if($sku=='YXDS0001'){break;} } $html8 .= <<<EOD </table> EOD; $this->pdf->writeHTMLCell($w = 200, $h = 0, $x = 5, $y = 5, $html8, $border = 1, $ln = 0, $fill = 0, $reseth = true, $align = 'L', $autopadding = false); //$this->pdf->writeHTML($html8, true, false, true, false, ''); } } /*保存文件*/ if ($list_type == 1) { $filename = "order_print_10x10_" . date("Ymd") . ".pdf"; $this->pdf->Output($filename, 'D'); } elseif ($list_type == 2) { $data[] = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', price($all_total_cost)); $this->excel->array_to_excel($data, $head, 'wish_pi_list_' . date('Y-m-d')); } elseif ($list_type == 3) { $filename = "order_print_a4_" . date("Ymd") . ".pdf"; $this->pdf->Output($filename, 'D'); } }
public function complete_sale_merged_orders() { $all_wait_complete_merged_orders_transaction_ids = $this->order_model->fetch_all_wait_complete_merged_orders(); var_dump($all_wait_complete_merged_orders_transaction_ids); foreach ($all_wait_complete_merged_orders_transaction_ids as $all_wait_complete_merged_orders_transaction_id) { $ebay_orders = $this->ebay_order_model->get_ebay_order_by_paypal_transaction_id($all_wait_complete_merged_orders_transaction_id['transaction_id']); $order = $this->order_model->get_order($all_wait_complete_merged_orders_transaction_id['old_id']); if (empty($order)) { continue; } if ($order->auction_site_type == 'wish') { echo "wish merged order:" . $order->id . "\n"; $this->script->complete_wish_sale(array('order_id' => $order->id)); continue; } //echo "********0";var_dump($ebay_orders); $ebay_ids = $this->config->item('ebay_id'); $ebay_id = $order->ebay_id; if (empty($ebay_id)) { //$ebay_id = $ebay_ids[$order->to_email]; //if (empty($ebay_id)) //{ echo $order->id . "ebay id is empty!\n"; continue; //} } $item_ids = explode(',', $order->item_id_str); $item_titles = explode(ITEM_TITLE_SEP, $order->item_title_str); $track_numbers = explode(',', $order->track_number); $order_id = $all_wait_complete_merged_orders_transaction_id['old_id']; //echo "********1";var_dump($ebay_orders); foreach ($ebay_orders as $ebay_order) { $shipping_method = shipping_method($order->is_register); $shipping_carrier = $this->_shipping_carrier($shipping_method, $order->country); $shipping_date = get_utc_time($order->ship_confirm_date); $shipping_note = $shipping_method->name_en; $data = array('order_id' => $order_id, 'ebay_id' => $ebay_id, 'track_numbers' => $track_numbers, 'item_id' => $ebay_order->item_id, 'transaction_id' => $ebay_order->transaction_id, 'shipping_carrier' => $shipping_carrier, 'shipping_date' => $shipping_date, 'shipping_note' => $shipping_note); echo "-----"; print_r($data); $this->_proccess_complete_sale($data); $data_order = array('is_shiped_ebay' => 1); $this->order_model->update_order_merged_list_information($all_wait_complete_merged_orders_transaction_id['transaction_id'], $data_order); } } }
public function complete_sale($order_id) { $order = $this->order_model->get_order($order_id); $shipping_method = shipping_method($order->is_register); $track_numbers = $order->track_number; $aliexpress_tokens = $this->system_model->fetch_all_aliexpress_token(); $url = 'http://gw.api.alibaba.com/openapi/'; $apiInfo = 'param2/1/aliexpress.open/api.sellerShipment/' . $this->appKey; foreach ($aliexpress_tokens as $aliexpress_token) { //$access_token=$aliexpress_token->access_token; if ($aliexpress_token->resource_owner == $order->domain || $aliexpress_token->aliid == $order->domain) { $this->access_token = $aliexpress_token->access_token; } } $code_arr = array('access_token' => urlencode($this->access_token), 'serviceName' => $shipping_method->taobao_company_code, 'logisticsNo' => $track_numbers, 'sendType' => 'all', 'outRef' => $order->transaction_id); $get_refresh_token_url = $url . $apiInfo; $code_sign = $this->api_code_sign($apiInfo, $code_arr); $curlPost = ''; $i = 0; foreach ($code_arr as $key => $val) { $curlPost .= $key . '=' . urlencode($val) . '&'; } $get_refresh_token_url .= "?" . substr(trim($curlPost), 0, -1); echo $get_refresh_token_url . "&_aop_signature=" . $code_sign; echo "<br>"; $ch = curl_init(); //初始化curl curl_setopt($ch, CURLOPT_URL, $get_refresh_token_url); //抓取指定网页 curl_setopt($ch, CURLOPT_HEADER, 0); //设置header curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上 //curl_setopt($ch, CURLOPT_POST, 0);//post提交方式 //curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($ch); //运行curl curl_close($ch); $data = json_decode($data); var_dump($data); $this->ebay_order_model->delete_order_id($order_id); $filename = '/var/www/html/log/aliexpress/'; if (!file_exists($filename)) { mkdir($filename); } $filename .= date('Y-m-d') . '.log'; $requestInformation = $get_refresh_token_url; writefile($filename, $requestInformation, 'a'); $requestInformation = var_export($data, true); writefile($filename, $requestInformation, 'a'); }
private function _parse_email_template($order, $sender_name = 'Mallerp') { $view = 'local/english/template/email/order_shipped_notification'; $item_titles = explode(',', $order->item_title_str); $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $item_list_entries = array(); $i = 0; foreach ($item_titles as $item_title) { $sku = ''; $qty = ''; if (isset($skus[$i])) { $sku = $skus[$i]; } if (isset($qties[$i])) { $qty = $qties[$i]; } $item_list_entries[] = array('item_name' => $item_title, 'sku' => $sku, 'qty' => $qty); $i++; } $address = append_if_not_empty($order->country, '<br/>') . append_if_not_empty($order->state_province, '<br/>') . append_if_not_empty($order->town_city, '<br/>') . append_if_not_empty($order->address_line_1, '<br/>') . append_if_not_empty($order->address_line_2, '<br/>') . $order->name . '<br/>' . $order->zip_code; $shipping_method = shipping_method($order->is_register); $usd = to_usd($order->currency, $order->gross); $data = array('buyer_name' => $order->name, 'item_no' => $order->item_no, 'shipped_date' => $order->ship_confirm_date, 'item_list_entries' => $item_list_entries, 'weight' => $order->ship_weight, 'shipping_address' => $address, 'track_number' => empty($order->track_number) ? 'None' : $order->track_number, 'track_url' => $shipping_method->check_url, 'shipping_method' => $shipping_method->name_en, 'email' => $order->to_email, 'sender_name' => $sender_name, 'usd' => $usd); return $this->parser->parse($view, $data, TRUE); }