


打包

更新

修复

节点

上线
stripslashes(r('content')) ); $sql = DB::update('calendar', $dict, "id='{$id}'"); DB::exe($sql); we('1'); } else if ($act == 'edityanfa') { $id = r('id'); $dict = array( 'yanfa_remark' => stripslashes(r('content')) ); $sql = DB::update('calendar', $dict, "id='{$id}'"); DB::exe($sql); we('1'); } else if ($act == 'editchanpin') { $id = r('id'); $dict = array( 'chanpin_remark' => stripslashes(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); $eventTypeCnt = array( '节点' => 0, '打包' => 0, '版本更新' => 0, '上线' => 0, '修复外网' => 0 ); $eventCount = array( '总更新&总修复' => array( 'dangerCount' => 0, 'purpleCount' => 0 ) ); $res = array(); foreach ($rss as $rs) { if (!$eventCount[$rs['game']]) { $eventCount[$rs['game']] = array( 'dangerCount' => 0, 'purpleCount' => 0 ); } if (strstr($rs['end'], $month)) { $eventTypeCnt[$rs['event']] += 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']); } foreach ($eventCharts as $value) { $eventTable[0][] = $value[0]; $eventTable[1][0][] = $value[1]; $eventTable[1][1][] = $value[2]; 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) . '%'; } // 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{ $json['count'] = $eventTypeCnt; we(json_encode($json)); } } ?>