LeGu Event
+-
+
+

diff --git a/pmcalendar.php b/pmcalendar.php index b12df78..42e883d 100644 --- a/pmcalendar.php +++ b/pmcalendar.php @@ -1,929 +1,1101 @@ r('content') + ); - $id = r('id'); - $keys = array('start','end'); - $dict=array(); - foreach($keys as $k){ - $dict[$k] = r($k); - } - if(isn($dict['end']))$dict['end']=$dict['start']; - $sql = DB::update('calendar',$dict,"id='{$id}'"); - DB::exe($sql); - we('1'); -}else if($act=='delevent'){ - $id = r('id'); - $sql = "delete from calendar where id='{$id}'"; - DB::exe($sql); - we('1'); -}else if($act=='getEventByid'){ - $id = r('id'); - $sql = "select * from calendar where id='{$id}'"; - $rs = DB::getOne($sql); - we(json_encode($rs)); -}else if($act=='getEvents'){ - $start = r('start'); - $end = r('end'); - $game = r('game'); - $where = ""; - - if(!isn($game)){ - $where .=" and game='{$game}'"; - } + $sql = DB::update('calendar', $dict, "id='{$id}'"); + DB::exe($sql); + we('1'); +} else if ($act == 'edityanfa') { + $id = r('id'); + $dict = array( + 'yanfa_remark' => r('content') + ); - $startDate = date('Y-m-d',$start); - $endDate = date('Y-m-d',$end); - $month = date('Y-m',($start+$end)/2); - - $sql = "select * from calendar where ((start>='{$startDate}' and start<='{$endDate}') or (end>='{$startDate}' and end<='{$endDate}')) {$where}"; - $rss = DB::getArray($sql); + $sql = DB::update('calendar', $dict, "id='{$id}'"); + DB::exe($sql); + we('1'); +} else if ($act == 'editchanpin') { + $id = r('id'); + $dict = array( + 'chanpin_remark' => r('content') + ); + + $sql = DB::update('calendar', $dict, "id='{$id}'"); + DB::exe($sql); + we('1'); +} else if ($act == 'modievent') { + $id = r('id'); + $keys = array('start', 'end', 'game', 'allday', 'shour', 'smin', 'event', 'title'); + $dict = array(); + foreach ($keys as $k) { + $dict[$k] = r($k); + } + $sql = DB::update('calendar', $dict, "id='{$id}'"); + DB::exe($sql); + we('1'); +} else if ($act == 'movevent') { + + $id = r('id'); + $keys = array('start', 'end'); + $dict = array(); + foreach ($keys as $k) { + $dict[$k] = r($k); + } + if (isn($dict['end'])) $dict['end'] = $dict['start']; + $sql = DB::update('calendar', $dict, "id='{$id}'"); + DB::exe($sql); + we('1'); +} else if ($act == 'delevent') { + $id = r('id'); + $sql = "delete from calendar where id='{$id}'"; + DB::exe($sql); + we('1'); +} else if ($act == 'getEventByid') { + $id = r('id'); + $sql = "select * from calendar where id='{$id}'"; + $rs = DB::getOne($sql); + we(json_encode($rs)); +} else if ($act == 'getEvents') { + $start = r('start'); + $end = r('end'); + $game = r('game'); + $where = ""; + + if (!isn($game)) { + $where .= " and game='{$game}'"; + } + + $startDate = date('Y-m-d', $start); + $endDate = date('Y-m-d', $end); + $month = date('Y-m', ($start + $end) / 2); + + $sql = "select * from calendar where ((start>='{$startDate}' and start<='{$endDate}') or (end>='{$startDate}' and end<='{$endDate}')) {$where}"; + $rss = DB::getArray($sql); $eventCount = array( - '总更新&总修复'=>array( - 'dangerCount'=>0, - 'purpleCount'=>0 + '总更新&总修复' => array( + 'dangerCount' => 0, + 'purpleCount' => 0 ) ); - $res = array(); - foreach($rss as $rs){ - if (!$eventCount[$rs['game']]){ + $res = array(); + foreach ($rss as $rs) { + if (!$eventCount[$rs['game']]) { $eventCount[$rs['game']] = array( - 'dangerCount'=>0, - 'purpleCount'=>0 + 'dangerCount' => 0, + 'purpleCount' => 0 ); - } - $class="light"; - if($rs['event']=='节点'){ - $class="success"; - }elseif($rs['event']=='打包'){ - $class="warning"; - }elseif($rs['event']=='版本更新'){ - $class="danger"; - if(strstr($rs['end'], $month)){ - $eventCount[$rs['game']]['dangerCount']+=1; - $eventCount['总更新&总修复']['dangerCount']+=1; - } - }elseif($rs['event']=='上线'){ - $class="pink"; - }elseif($rs['event']=='修复外网'){ - $class="purple"; - if(strstr($rs['end'], $month)){ - $eventCount[$rs['game']]['purpleCount']+=1; - $eventCount['总更新&总修复']['purpleCount']+=1; - } - } + } + $class = "light"; + if ($rs['event'] == '节点') { + $class = "success"; + } elseif ($rs['event'] == '打包') { + $class = "warning"; + } elseif ($rs['event'] == '版本更新') { + $class = "danger"; + if (strstr($rs['end'], $month)) { + $eventCount[$rs['game']]['dangerCount'] += 1; + $eventCount['总更新&总修复']['dangerCount'] += 1; + } + } elseif ($rs['event'] == '上线') { + $class = "pink"; + } elseif ($rs['event'] == '修复外网') { + $class = "purple"; + if (strstr($rs['end'], $month)) { + $eventCount[$rs['game']]['purpleCount'] += 1; + $eventCount['总更新&总修复']['purpleCount'] += 1; + } + } - $gameName = $rs['game']; - $row = array( - 'id' => $rs['id'], - 'title' => '【'.$gameName .'】'.$rs['event'].":".$rs['title'], - 'start' => $rs['start'], - 'end' => $rs['end'], - 'className' => 'label-'.$class, - ); - $row['allDay'] = true; - $res[] = $row; - } - $eventCharts = array(array('product','更新次数','修复次数')); - $eventTable = array([],[]); - foreach ($eventCount as $key=>$value){ - if($eventCount[$key]['purpleCount']!=0 || $eventCount[$key]['dangerCount']!=0) - $eventCharts[] = array($key,$eventCount[$key]['dangerCount'],$eventCount[$key]['purpleCount']); + $gameName = $rs['game']; + $row = array( + 'id' => $rs['id'], + 'title' => '【' . $gameName . '】' . $rs['event'] . ":" . $rs['title'], + 'start' => $rs['start'], + 'end' => $rs['end'], + 'className' => 'label-' . $class, + ); + $row['allDay'] = true; + $res[] = $row; } - foreach ($eventCharts as $value){ - $eventTable[0][] = $value[0]; + $eventCharts = array(array('product', '更新次数', '修复次数')); + $eventTable = array([], []); + foreach ($eventCount as $key => $value) { + if ($eventCount[$key]['purpleCount'] != 0 || $eventCount[$key]['dangerCount'] != 0) + $eventCharts[] = array($key, $eventCount[$key]['dangerCount'], $eventCount[$key]['purpleCount']); + } + foreach ($eventCharts as $value) { + $eventTable[0][] = $value[0]; $eventTable[1][0][] = $value[1]; $eventTable[1][1][] = $value[2]; - if($eventCount[$value[0]]['dangerCount']==0) + if ($eventCount[$value[0]]['dangerCount'] == 0) $eventTable[1][2][] = '0.00%'; else - $eventTable[1][2][] = number_format($eventCount[$value[0]]['purpleCount']*100/$eventCount[$value[0]]['dangerCount'],2).'%'; + $eventTable[1][2][] = number_format($eventCount[$value[0]]['purpleCount'] * 100 / $eventCount[$value[0]]['dangerCount'], 2) . '%'; } - // we(json_encode(array('charts'=>$eventCharts,'table'=>$eventTable))); - + // we(json_encode(array('charts'=>$eventCharts,'table'=>$eventTable))); - $json = array( - 'calendarData'=>$res - ); - if(!isn($game)){ - $where =" and game='{$game}'"; - $sql = "select * from calendar where 1=1 {$where} order by end"; - $rss = DB::getArray($sql); - $res = array(); - foreach($rss as $rs){ - $res[] = array( - "end"=> $rs['end'], - "gamename"=>$rs['game'], - "event"=>$rs['event'], - "title"=>$rs['title'] - ); - } - $json["gameInfo"] = $res; - } - if($type=='charts') - // we(json_encode($eventCharts)); - we(json_encode(array('charts'=>$eventCharts,'table'=>$eventTable))); - else - we(json_encode($json)); + $json = array( + 'calendarData' => $res + ); + + if (!isn($game)) { + $where = " and game='{$game}'"; + $sql = "select * from calendar where 1=1 {$where} order by end"; + $rss = DB::getArray($sql); + $res = array(); + foreach ($rss as $rs) { + $res[] = array( + "end" => $rs['end'], + "gamename" => $rs['game'], + "event" => $rs['event'], + "title" => $rs['title'] + ); + } + $json["gameInfo"] = $res; + } + if ($type == 'charts') + // we(json_encode($eventCharts)); + we(json_encode(array('charts' => $eventCharts, 'table' => $eventTable))); + else + we(json_encode($json)); } ?> -
-