From 766a75d709b0516d7a58143c6c6cf85cee91906a Mon Sep 17 00:00:00 2001 From: wuhao <15392746632@qq.com> Date: Tue, 1 Dec 2020 16:15:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=87=E6=B3=A8=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmcalendar.php | 1924 ++++++++++++++++++++++++++---------------------- 1 file changed, 1048 insertions(+), 876 deletions(-) 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)); } ?> - - 乐谷游戏管理系统 - - - - - - - - - - - - - - - - + + 乐谷游戏管理系统 + + + + + + + + + + + + + + + + + + + - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+ +
+ 筛选: + 编辑游戏 + + {$g} "; + } ?> + +
+ +
+ + + +
+
    + +
+
+ + + +
+ 修复数据 +
+
+ +
+ +
+ + + +
+
+ +
+ +
+
+
+
+
+ +
+ + + + +
+ + + + + + + + + + + + + + - - + - + - - - - - - - - - - - - - - - - - + + $(function () { + /* initialize the calendar + -----------------------------------------------------------------*/ -
- -
-
- -
- 筛选: - 编辑游戏 - - {$g} "; - }?> - -
- -
- - - -
-
    - -
-
+ var date = new Date(); + var d = date.getDate(); + var m = date.getMonth(); + var y = date.getFullYear(); + var calendar = window.calendar = $('#calendar').fullCalendar({ + buttonText: { + prev: '', + next: '', + prevYear: '去年', + nextYear: '明年', + today: '今天', + month: '月', + week: '周', + day: '日' + }, + timeFormat: 'H:mm', + monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + dayNames: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], + dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], - -
- 修复数据 -
-
- -
- -
- - - -
-
- -
- -
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - + $('#gameinfo ul').html(_html.join('')); + } else { + $('#gameinfo ul').html(''); + } + } + }); + }, + + eventRender: function (event, element) { + element.html(event.title); + }, + + editable: , + eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc) { + + dict = {id: event.id}; + dict.start = $.fullCalendar.formatDate(event.start, 'yyyy-MM-dd'); + dict.end = $.fullCalendar.formatDate(event.end, 'yyyy-MM-dd'); + loading.show(); + $.post('./?app=pmcalendar&act=movevent', dict, function (txt) { + loading.hide(); + if (txt == '1') { + calendar.fullCalendar('refetchEvents'); + } + }); + return false; + } + , + selectable: true, + selectHelper: true, + select: function (start, end, allDay) { + if ("" != "1") return; + dict = {}; + console.log('select', start, end, allDay); + + dict.start = $.fullCalendar.formatDate(start, 'yyyy-MM-dd'); + dict.end = $.fullCalendar.formatDate(end, 'yyyy-MM-dd'); + + showEventInfo(dict.start, { + "save": { + "label": " 保存", + "className": "btn-sm btn-success", + "callback": function () { + dict.game = $('#game').val(); + dict.allday = 1; + + dict.title = $('#title').val(); + dict.event = $('#event').val(); + + if (dict.game == '' || dict.title == '') return; + + loading.show(); + $.post('./?app=pmcalendar&act=newevent', dict, function (txt) { + loading.hide(); + if (txt == '1') { + calendar.fullCalendar('refetchEvents'); + } + }); + } + }, + "close": { + "label": " Close", + "className": "btn-sm" + } + }, 'new'); + calendar.fullCalendar('unselect'); + } + , + eventClick: function (calEvent, jsEvent, view) { + // if(""!="1")return; + console.log('calEvent', calEvent, jsEvent, view); + + dict = {}; + $.post('./?app=pmcalendar&act=getEventByid', {id: calEvent.id}, function (txt) { + var j = JSON.parse(txt); + dict.start = j.start; + dict.end = j.end; + dict.id = calEvent.id; + $('#game').val(j.game); + $('#hour').val(j.shour); + $('#min').val(j.smin); + $('#event').val(j.event); + $('#title').val(j.title); + hourChange($('#hour')); + }); + dstr = $.fullCalendar.formatDate(calEvent.start, 'yyyy-MM-dd'); + showEventData(); + + + } + + }); + + }); + + function datarepair() { + var dis = $("#data_box").css('display'); + if (dis == 'none') { + $('#data_box').show(); + $('#calendardiv').hide(); + + var time = (Math.round(starttime.getTime()) + Math.round(endtime.getTime())) / 2; + time = new Date(time); + var year = time.getFullYear() + '年'; + var month = time.getMonth() + 1 + '月'; + + $.ajax({ + url: './?app=pmcalendar&act=getEvents', + dataType: 'json', + data: { + start: Math.round(starttime.getTime() / 1000), + end: Math.round(endtime.getTime() / 1000), + game: showGame, + type: 'charts' + }, + + success: function (res) { + var myChart = echarts.init(document.getElementById('chart')); + var chartsdata = res.charts; + + var option = { + title: { + text: [year, month].join(''), + left: 'center', + textStyle: { + fontWeight: 'normal', + color: '#6fb3e0', + } + }, + toolbox: { + feature: { + saveAsImage: {} + } + }, + legend: { + left: 10 + }, + tooltip: {}, + grid: { + left: '0', + right: '0', + bottom: '5%', + containLabel: true + }, + color: ['#ff7f7f', '#a494f9'], + dataset: { + source: chartsdata + }, + xAxis: {type: 'category'}, + yAxis: { + "axisLine": { //y轴 + "show": true + }, + "axisTick": { //y轴刻度线 + "show": true + }, + "splitLine": { //网格线 + "show": false + } + }, + // Declare several bar series, each will be mapped + // to a column of dataset.source by default. + series: [ + { + type: 'bar', + itemStyle: { + normal: { + label: { + show: true, //开启显示 + position: 'top', //在上方显示 + textStyle: { //数值样式 + color: '#000', + fontSize: 13 + } + } + } + } + }, + { + type: 'bar', + itemStyle: { + normal: { + label: { + show: true, //开启显示 + position: 'top', //在上方显示 + textStyle: { //数值样式 + color: '#000', + fontSize: 13 + } + } + } + } + } + ] + }; + myChart.setOption(option); + + var titleAdd = res.table[0]; + titleAdd[0] = ""; + var tbdyArr = res.table[1]; + tbdyArr[2][0] = '占比'; + tmpltxt = doT.template(document.getElementById("thead-dot").innerHTML);//生成模板方法 + document.getElementById("thead-title").innerHTML = tmpltxt(titleAdd);//数据渲染 + + tmpltxt = doT.template(document.getElementById("tbody-dot").innerHTML);//生成模板方法 + document.getElementById("tbody-content").innerHTML = tmpltxt(tbdyArr);//数据渲染 + + }, + error: function () { + alert('数据异常,请稍后重试!!!') + } + }); + + } else { + $('#data_box').hide(); + $('#calendardiv').show(); + } + + } + + + function showEventData() { + $('#popup-bg').show(); + } + + $("#yiny").click(function () { + $("#popup-bg").hide(); + }) + + function Info() { + console.log(dstr); + showEventInfo(dstr, { + "save": { + "label": " 保存", + "className": "btn-sm btn-success", + "callback": function () { + + dict.game = $('#game').val(); + dict.allday = 1; + + dict.event = $('#event').val(); + dict.title = $('#title').val(); + + if (dict.game == '' || dict.event == '') return; + + loading.show(); + $.post('./?app=pmcalendar&act=modievent', dict, function (txt) { + loading.hide(); + if (txt == '1') { + calendar.fullCalendar('refetchEvents'); + } + }); + } + }, + "delete": { + "label": " 删除事件", + "className": "btn-sm btn-danger", + "callback": function () { + if (confirm('确认要【删除】这个事件吗?')) { + loading.show(); + $.post('./?app=pmcalendar&act=delevent', {id: calEvent.id}, function (txt) { + loading.hide(); + if (txt == '1') { + calendar.fullCalendar('refetchEvents'); + } + }); + } + } + }, + + "close": { + "label": " Close", + "className": "btn-sm" + } + }, 'modify'); + } + + $('#excelFile').change(function (e) { + // e.target得到的是input标签,e.target.files得到是一串filelist, + // e.target.files[0]得到的是图片的一些参数,这些参数可以根据自己的需要提取 + var fileName = e.target.files[0].name; + var arr = []; + arr.push(fileName) + tmpltxt = doT.template(document.getElementById("fujian-dot").innerHTML);//生成模板方法 + document.getElementById("fujian").innerHTML = tmpltxt(arr);//数据渲染 + // $(this).prev().find('span').text(fileName); + + }) + + $('#excelFile2').change(function (e) { + // e.target得到的是input标签,e.target.files得到是一串filelist, + // e.target.files[0]得到的是图片的一些参数,这些参数可以根据自己的需要提取 + var fileName = e.target.files[0].name; + var arr = []; + arr.push(fileName) + tmpltxt = doT.template(document.getElementById("fujian-dot").innerHTML);//生成模板方法 + document.getElementById("yyfujian").innerHTML = tmpltxt(arr);//数据渲染 + // $(this).prev().find('span').text(fileName); + + }) + + $('#excelFile3').change(function (e) { + // e.target得到的是input标签,e.target.files得到是一串filelist, + // e.target.files[0]得到的是图片的一些参数,这些参数可以根据自己的需要提取 + var fileName = e.target.files[0].name; + var arr = []; + arr.push(fileName) + tmpltxt = doT.template(document.getElementById("fujian-dot").innerHTML);//生成模板方法 + document.getElementById("yffujian").innerHTML = tmpltxt(arr);//数据渲染 + // $(this).prev().find('span').text(fileName); + + }) + + function showEventInfo(start, btns, stype) { + var form = $("
"); + form.append(' '); + form.append("
"); + + var div = bootbox.dialog({ + message: form, + buttons: btns + }); + + + form.on('submit', function () { + //calEvent.title = form.find("input[type=text]").val(); + //calendar.fullCalendar('updateEvent', calEvent); + div.modal("hide"); + return false; + }); + }; + + + function hourChange(o) { + if ($(o).val() == '-1') { + $('#min').hide(); + } else { + $('#min').show(); + } + } + + + \ No newline at end of file