PHP实现分时段计费
来源:互联网 发布:土建造价软件视频教程 编辑:程序博客网 时间:2024/06/05 03:51
1、使用递归方法实现
/**
* 递归回调函数实现计费
* @param
* @param
* @return float
*/
public function test(
global
log_message(‘info’, ‘出现了超过100天的数据.’ . FUNCTION . ‘>>>’ .
}
//第一次的开始时间戳
if ($end >= $et) { $new_start = $et; $new_end = $end; $deep = $deep + 1; $end = $et; } //1,开始时间,结束时间在第一段中 if ($start < $at && $end <= $at) { $hour = ceil(($end - $start) / 3600); $total += $price[0]['price'] * $hour; } //2,开始时间第一段,结束时间第二段 if ($start < $at && $end > $at && $end <= $et) { $one = ceil(($at - $start) / 3600) * $price[0]['price']; $two = ceil(($end - $at) / 3600) * $price[1]['price']; $total += $one + $two; } //4,开始时间,结束时间都在第二段 if ($start >= $at && $end <= $et) { $hour = ceil(($end - $start) / 3600); $total += $price[1]['price'] * $hour; } if (isset($new_end) && isset($new_start)) { unset($start); unset($end); unset($at); unset($et); $this->test($new_start, $new_end, $price, $deep); } return $total;}
2、使用时间偏移计算
/**
* 以格林泥治时间为中心,计算差值
* @param
* @param
} else {total += ceil(
}
if ($dt2 > $one) { $total += $one_p; $total += ceil(($dt2 - $one) / 3600) * $price[1]['price']; } else { $total += ceil($dt2 / 3600) * $price[0]['price']; } return $total;}
- PHP实现分时段计费
- iptables + php 上网计费实现
- SQL分时段统计
- 分时段个性化推荐
- 分时段MFP
- #hive#分时段统计消耗
- mysql 时间范围内分时段分组排序
- ASP实现语音分时问候
- ASP实现语音分时问候
- ASP实现语音分时问候
- php利用参数,分时处理大量数据
- 分时段显示不同的提示的网页JS特效代码
- opencv2.4.9+VS2012 视频录像并分时段保存
- 查询Oracle数据库分时段的健康状况---脚本
- Oracle时间处理和报表分时段统计
- 热水锅炉控制系统 分时段控制水温和水位
- python实现超市扫码仪计费
- 嵌入式系统分时任务调度算法实现
- unity的ugui中文竖排
- VS多线程下如何调试单线程
- ORA-00257: archiver error. Connect internal only, until freed.
- 新一代大数据可视化展示系统,追求全员数据化
- TomCat简要使用
- PHP实现分时段计费
- RecycleView去除自动回滚至顶部
- Fiddler Web Debugger 的使用
- 2017年伊始,你需要尝试的25个Android第三方库
- Error:Cannot build Artifact 'ueditor:war exploded' because it is included into a circular depen
- JarFile解析jar文件。获取jar中后缀为class文件路径
- Understanding the JVM(十二)虚拟机字节码执行引擎
- 密码登陆程序
- 【重大更新】DevExpress v17.2震撼发布|附下载