代码中出现的奇怪问题原因
2014-09-25 15:31
337 查看
好好看看这段代码,之前是没有第29行的。
/* * 系统账号监控规则: * 1.每小时监控 * 2.系统账号数量<=10以下时不报警 * 3.10以上时每小时增长率超过20%则报警 * */ public function watching(){ $this->load->model('monite/watch_dingdan_model'); $this->load->model('readdb/dingdan_model'); $this->load->model('readdb/product_model'); foreach($this->userid as $userid){ //监控预订单表dingdan系统账号 $orders = $this->dingdan_model->getSystemAccount($userid); foreach($orders as $order){ if(!trim($order['s_id'])) continue; $sql = "select * from watch_dingdan where shopid = '".$order['s_id']."' and userid='{$userid}'"; $watch = $this->watch_dingdan_model->query($sql); if(count($watch)<=0){ //如果监控表中没有数据,则直接写入记录 //将最新的系统账号数量添加到监控表中 $data = array(); $data['shopid'] = $order['s_id']; $data['userid'] = $userid; $data['num'] = $order['num']; $this->watch_dingdan_model->insert($data); if($order['num']<=$this->threshold) continue; }else{ $where = $data = array(); //将最新的系统账号数量更新到监控表中 $where['shopid'] = $order['s_id']; $where['userid'] = $userid; $data['num'] = $order['num']; $this->watch_dingdan_model->update($where,$data); if(($order['num']-$watch[0]['num'])>=$this->threshold && $watch[0]['num']>0 && $order['num']>$watch[0]['num']){ if(!(($order['num']-$watch[0]['num'])/$watch[0]['num'] >= $this->rate)){ continue; } }else{ continue; } } $shopname = $this->product_model->getShopName($order['s_id']); $shopname = iconv("gbk","utf-8",$shopname); //发送监控 $title = '【跟单监控时报】'.$shopname."系统账号{$userid}监控"; $content = '【跟单监控时报】'.date("Y-m-d H:i",strtotime("-15 minute"))."至".date("Y-m-d H:i").$shopname."[$order[s_id]]系统账号{$userid}的数量为".($order['num']-$watch[0]['num']).",总数量为$order[num]"; $this->sendEmail($title, $content); $this->sendSms($content); } } }
相关文章推荐
- 下载文件的奇怪问题--出现第二个保存对话框的原因!
- java web 程序---javabean代码,出现错误。奇怪,无法解释的运行问题
- 排序出现的一个奇怪的问题,找出原因后差点吐血
- 语音播放和录音中出现的奇怪的问题
- 求救,我的电脑出现了奇怪的问题,报rasapi32.dll错误
- 在Hiberate事务中,出现抛异常或者其它原因导致没有执行commit或rollback方法时的安全问题
- 奇怪的包含脚本的问题!有人知道原因吗?
- 通过反射动态实例化对象中出现的一个奇怪问题
- 解决eclipse在代码提示时每个方法出现两个的问题(图)
- 关于安装.NET Framework 2.0时偶然碰到的问题(提示"Error 205015. 安装程序集..../System.EnterpriseServices.dll失败,原因是出现了系统错误:拒绝访问。")
- 采集器C++代码在Red Hat各版本操作系统移植出现得问题
- 奇怪的问题:js代码只能放在代码中不能引用文件
- SPS服务器上出现的奇怪问题?
- MFC spin控件出现的一些奇怪的问题
- 使用.NET部署程序出现的奇怪问题
- 奇怪window.open 总出现[object]的问题终于解决了
- 电脑开机出现奇怪的问题
- 老是出现奇怪的问题,心脏不好容易崩溃啊
- 关于VB.net代码转化为C#代码出现的一些问题
- 出现“不能执行已释放的Script代码”错误的原因及解决办法