b0VIM 7.4O2[ rootiZbp1gd4kac7xt7wm6e3rgZ/alidata/www/SubQueue/sms_ana_op/opqueue.phputf-8 U3210#"! Utp&'C^x+!ad&y7$+ U R O  .R$ fP" //$delivery_sql="select count(*) as cnt,hour(CONVERT_TZ(`send`,'+00:00','+08:00')) as hourflg ,date(CONVERT_TZ(`send`,'+00:00','+08:00')) as dateflg, week(CONVERT_TZ(`send`,'+00:00','+08:00')) as weekflg,month(CONVERT_TZ(`send`, '+00:00','+08:00')) as monthflg ,year(CONVERT_TZ(`send`,'+00:00','+08:00')) as yearflg FROM transactional_message_queue WHERE `appid` = '$appid' AND send BETWEEN '$starttime' AND '$endtime' AND status = 6 group by hourflg,dateflg,weekflg,monthflg,yearflg"; //deliveryed } unset($query); unset($sql); $this->te_db->query($sql); $sql = substr($sql,0,-1); } $sql.="('$account','$appid','request','$item->cnt','$item->hourflg','$item->dateflg','$item->weekflg','$item->monthflg','$item->yearflg'),"; foreach($query as $item){ $sql="INSERT INTO `sms_ana_by_hour` (`account`,`appid`,`events`,`cnt`,`hourflg`,`dateflg`,`weekflg`,`monthflg`,`yearflg`)VALUES"; if($query=$this->read_db->get_results($request_sql)){ $request_sql="select count(*) as cnt,hour(CONVERT_TZ(`send`,'+00:00','+08:00')) as hourflg ,date(CONVERT_TZ(`send`,'+00:00','+08:00')) as dateflg, week(CONVERT_TZ(`send`,'+00:00','+08:00')) as weekflg,month(CONVERT_TZ(`send`, '+00:00','+08:00')) as monthflg ,year(CONVERT_TZ(`send`,'+00:00','+08:00')) as yearflg FROM `sms_submit` WHERE `appid` = '$appid' AND send BETWEEN '$starttime' AND '$endtime' group by hourflg,dateflg,weekflg,monthflg,yearflg"; //$request_sql="select count(*) as cnt,hour(CONVERT_TZ(`send`,'+00:00','+08:00')) as hourflg ,date(CONVERT_TZ(`send`,'+00:00','+08:00')) as dateflg, week(CONVERT_TZ(`send`,'+00:00','+08:00')) as weekflg,month(CONVERT_TZ(`send`, '+00:00','+08:00')) as monthflg ,year(CONVERT_TZ(`send`,'+00:00','+08:00')) as yearflg FROM transactional_message_queue WHERE `appid` = '$appid' AND send BETWEEN '$starttime' AND '$endtime' group by hourflg,dateflg,weekflg,monthflg,yearflg"; //request $this->te_db->query("DELETE FROM `sms_ana_by_hour` WHERE `account`='$account' AND `appid`='$appid' AND `dateflg`='".date('Y-m-d',strtotime($endtime))."'"); $start=date('Y-m-d',strtotime($start ." +1 day")); $starttime=date('Y-m-d H:i:s',strtotime($endtime . " -1 day +1 second" )); $endtime=date('Y-m-d H:i:s',strtotime($start . " 15:59:59")); while($start<=$end){ $this->read_db = new ezSQL_mysql(constant("read_username"),constant("read_password"),constant("read_database"),constant("read_host")); $this->te_db = new ezSQL_mysql(constant("te_username"),constant("te_password"),constant("te_database"),constant("te_host")); $this->db = new ezSQL_mysql(constant("username"),constant("password"),constant("database"),constant("host")); $end=date('Y-m-d',strtotime($this->args['end'])); $start=date('Y-m-d',strtotime($this->args['start'])); $account=$this->args['account']; $appid=$this->args['appid']; fwrite(STDOUT, "STARTING ANA QUEUE : Appid:".$this->args['appid']." Account:".$this->args['account']." Start:".$this->args['start']." End:".$this->args['end']."\n"); public function perform(){ public $db,$te_db,$read_db; class opqueue{ include_once constant("rootpath").'/public/ez_sql_mysql.php'; include_once constant("rootpath").'/public/ez_sql_core.php'; include_once 'subclass.php'; include_once 'config.php';query($sql)){ $db->query("set names utf8"); $db = $this->db; $sql="insert into ".$database." ".$tempKey."VALUES".$tempValue; $tempValue="(".$tempValue.")"; if(get_magic_quotes_gpc()){$tempValue = stripslashes($tempValue);} $tempValue = substr($tempValue,0,count($tempValue)-2); $tempKey="(".$tempKey.")"; if(get_magic_quotes_gpc()){$tempKey = stripslashes($tempKey);} $tempKey = substr($tempKey,0,count($tempKey)-2); } $tempValue.="'".$val."',"; $tempKey.="`".$key."`".","; while (list ($key, $val) = each ($data)) { //set sql insert key $tempValue=""; $tempKey=""; function insert($database,$data,$db_type=''){ } return date($format, strtotime($param)) === $param;