📄 post_mail.php
字号:
<?php
/**
* ECSHOP 邮局平邮插件
* ============================================================================
* 版权所有 2005-2008 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: sunxiaodong $
* $Id: post_mail.php 15538 2009-01-08 07:54:54Z sunxiaodong $
*/
if (!defined('IN_ECS'))
{
die('Hacking attempt');
}
$shipping_lang = ROOT_PATH.'languages/' .$GLOBALS['_CFG']['lang']. '/shipping/post_mail.php';
if (file_exists($shipping_lang))
{
global $_LANG;
include_once($shipping_lang);
}
/* 模块的基本信息 */
if (isset($set_modules) && $set_modules == TRUE)
{
$i = (isset($modules)) ? count($modules) : 0;
/* 配送方式插件的代码必须和文件名保持一致 */
$modules[$i]['code'] = basename(__FILE__, '.php');
$modules[$i]['version'] = '1.0.0';
/* 配送方式的描述 */
$modules[$i]['desc'] = 'post_mail_desc';
/* 配送方式是否支持货到付款 */
$modules[$i]['cod'] = false;
/* 插件的作者 */
$modules[$i]['author'] = 'ECSHOP TEAM';
/* 插件作者的官方网站 */
$modules[$i]['website'] = 'http://www.ecshop.com';
/* 配送接口需要的参数 */
$modules[$i]['configure'] = array(
array('name' => 'item_fee', 'value'=>4),
array('name' => 'base_fee', 'value'=>3.5),
array('name' => 'step_fee', 'value'=>2),
array('name' => 'step_fee1', 'value'=>2.5),
array('name' => 'pack_fee', 'value'=>0),
);
return;
}
/**
* 邮局平邮费用计算方式: 每公斤资费 × 包裹重量 + 挂号费3.00 + 邮单费0.5 + 包装费(按实际收取) + 保价费
*
* 保价费 由客户自愿选择,保价费为订单产品价值的1%。客户选择不保价,则保价费=0
*
*/
class post_mail
{
/*------------------------------------------------------ */
//-- PUBLIC ATTRIBUTEs
/*------------------------------------------------------ */
/**
* 配置信息
*/
var $configure;
/*------------------------------------------------------ */
//-- PUBLIC METHODs
/*------------------------------------------------------ */
/**
* 构造函数
*
* @param: $configure[array] 配送方式的参数的数组
*
* @return null
*/
function post_mail($cfg=array())
{
foreach ($cfg AS $key=>$val)
{
$this->configure[$val['name']] = $val['value'];
}
}
/**
* 计算订单的配送费用的函数
*
* @param float $goods_weight 商品重量
* @param float $goods_amount 商品金额
* @param float $goods_number 商品件数
* @return decimal
*/
function calculate($goods_weight, $goods_amount, $goods_number)
{
if ($this->configure['free_money'] > 0 && $goods_amount >= $this->configure['free_money'])
{
return 0;
}
else
{
/* 基本费用 */
$fee = $this->configure['base_fee'] + $this->configure['pack_fee'];
$this->configure['fee_compute_mode'] = !empty($this->configure['fee_compute_mode']) ? $this->configure['fee_compute_mode'] : 'by_weight';
if ($this->configure['fee_compute_mode'] == 'by_number')
{
$fee = $goods_number * ($this->configure['item_fee'] + $this->configure['pack_fee']);
}
else
{
if ($goods_weight > 5)
{
$fee += (ceil(($goods_weight - 1))) * $this->configure['step_fee1'];
}
else
{
if ($goods_weight > 1)
{
$fee += (ceil(($goods_weight - 1))) * $this->configure['step_fee'];
}
}
}
return $fee;
}
}
/**
* 查询发货状态
* 该配送方式不支持查询发货状态
*
* @access public
* @param string $invoice_sn 发货单号
* @return string
*/
function query($invoice_sn)
{
return $invoice_sn;
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -