function calcfedex($totalweight, $countryname, $orderid) { global $dbcon; include dirname(dirname(__FILE__)) . '/cache/shipfeee/fedex_1.php'; $cnum = ''; $sql = "SELECT ebay_postcode FROM ebay_order WHERE ebay_id={$orderid}"; $sql = $dbcon->execute($sql); $code = $dbcon->getResultArray($sql); $postcode = $code[0]['ebay_postcode']; foreach ($FEDEX_CONTRY_LIST_1 as $c => $country) { $countrylist = explode(',', $country); if (in_array($countryname, $countrylist)) { if ($countryname == 'United States') { $postcode_lists = explode('#', $countrylist[1]); foreach ($postcode_lists as $postcode_list) { list($post_start, $post_end) = explode('-', $postcode_list); if ($post_start < $postcode && $postcode < $post_end) { $cnum = $c; break; } } if ($cnum === '') { $cnum = $c + 1; } } if ($cnum === '') { $cnum = $c; } break; } } if ($cnum === '') { return calcfedexyx($totalweight, $countryname, $postcode); } foreach ($FEDEX_WEIGHT_LIST_1 as $w => $weight) { list($start_w, $end_w) = explode('-', $weight); if ($start_w < $totalweight && $totalweight <= $end_w) { $wnum = $w; break; } } $shipfee = $totalweight > 20.5 ? $totalweight * $FEDEX_PRICE_LIST_1[$wnum][$cnum] * (1 + $FEDEX_MYC_FEE_1) : $FEDEX_PRICE_LIST_1[$wnum][$cnum] * (1 + $FEDEX_MYC_FEE_1); return round($shipfee, 2); }
function calcfedex($totalweight, $countryname, $orderid) { global $dbConn; include WEB_PATH . 'cache/shipfeee/fedex_1.php'; $cnum = ''; $sql = "SELECT ebay_postcode FROM ebay_order WHERE ebay_id={$orderid}"; $sql = $dbConn->query($sql); $code = $dbConn->fetch_array_all($sql); $postcode = $code[0]['ebay_postcode']; foreach ($FEDEX_CONTRY_LIST_1 as $c => $country) { $countrylist = explode(',', $country); if (in_array($countryname, $countrylist)) { if ($countryname == 'United States') { $postcode_lists = explode('#', $countrylist[1]); foreach ($postcode_lists as $postcode_list) { list($post_start, $post_end) = explode('-', $postcode_list); if ($post_start < $postcode && $postcode < $post_end) { $cnum = $c; break; } } if ($cnum === '') { $cnum = $c + 1; } } if ($cnum === '') { $cnum = $c; } break; } } if ($cnum === '') { return calcfedexyx($totalweight, $countryname, $postcode); } foreach ($FEDEX_WEIGHT_LIST_1 as $w => $weight) { list($start_w, $end_w) = explode('-', $weight); if ($start_w < $totalweight && $totalweight < $end_w) { $wnum = $w; break; } } echo "国家区间({$cnum})----重量区间({$wnum})------价格({$FEDEX_PRICE_LIST_1[$wnum][$cnum]})----总价" . $FEDEX_PRICE_LIST_1[$wnum][$cnum] * (1 + $FEDEX_MYC_FEE_1); $shipfee = $totalweight > 20.5 ? $totalweight * $FEDEX_PRICE_LIST_1[$wnum][$cnum] * (1 + $FEDEX_MYC_FEE_1) : $FEDEX_PRICE_LIST_1[$wnum][$cnum] * (1 + $FEDEX_MYC_FEE_1); return round($shipfee, 2); }