


打包

更新

修复

节点

上线
'action_card', 'action_card'=>array( 'title'=>$title, "markdown"=> $text, 'single_title'=>'查看详情', 'single_url'=>'http://10.0.0.5/leguevent/', ), ); $data_string = array( 'name'=>$to, 'cont'=>json_encode($contArr) ); $result = dopost($webhook, $data_string); } function sendNotice($title,$text,$token){ //今天设置过菜单 $webhook = "https://oapi.dingtalk.com/robot/send?access_token={$token}"; $data = array( 'msgtype'=>'actionCard', 'actionCard'=>array( 'title'=>$title, "text"=> $text, 'hideAvatar'=>'0', 'btnOrientation'=>'0', 'btns' => array( array( 'title'=>'查看详情', 'actionURL'=>'http://10.0.0.5/leguevent/', ) ) ), "at"=>array( "isAtAll"=>true ) ); $data_string = json_encode($data); $result = request_by_curl($webhook, $data_string); } function getOneEvent($id){ $rs = DB::getOne("select * from calendar where id='{$id}'"); return $rs; } $user = SESS::get('EVENTUserInfo'); // if(isn($user))exit(); $user = json_decode($user, true); //$user['name'] = "吴昊"; $canEdit = in_array($user['name'], $ROLES); $isgxvrole ='1'; //in_array($user['name'], $GXVROLES); //更新信息查看区浏览权限 $isgxyyerole = in_array($user['name'], $GXYYEROLES);//更新运营中心编辑权限 $isgxcperole = in_array($user['name'], $GXCPEROLES);//更新产品中心编辑权限 $isgxyferole = in_array($user['name'], $GXYFEROLES);//更新研发中心编辑权限 $isxfvrole = in_array($user['name'], $XFVROLES); //修复信息查看区浏览权限 $isxfyyerole = in_array($user['name'], $XFYYEROLES);//修复运营中心编辑权限 $isdbvrole ='1'; //in_array($user['name'], $DBVROLES); //打包信息查看区浏览权限 $isdbyyerole = in_array($user['name'], $DBYYEROLES);//打包运营中心编辑权限 $isdbcperole = in_array($user['name'], $DBCPEROLES);//打包产品中心编辑权限 $isdbyferole = in_array($user['name'], $DBYFEROLES);//打包研发中心编辑权限 //上线 $issxyyerole = in_array($user['name'], $SXYYEROLES); //上线运营编辑 $issxarole = in_array($user['name'], $SXAROLES); //可以添加上线卡片 function fix2($v) { $x = '00' . $v; return substr($x, -2); } //we(getOneEvent(7442)); $act = r('act'); $type = r('type'); if ($act == 'newevent') { $keys = array('start', 'end', 'game', 'allday', 'shour', 'smin', 'event', 'title'); $dict = array(); foreach ($keys as $k) { $dict[$k] = r($k); } $sql = DB::insert('calendar', $dict); DB::exe($sql); if($dict['event'] == '上线'){ sendNotice('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'1a9389969a7b6decc779c86c0969c23cfd7c3d4bf02fe3bb78da348fb526e227'); sendNotice('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'0be37dacbaa5c76893fb85d4dab5bc23e6b981b5fa3c33908132af8e29eacf8c'); sendNotice('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'66766a72c2e5e6950ffbdc26cf8fa3fb5503d25162d80f6dd441057849ef0d4d'); push('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'邓定坤,邓定斌'); } we('1'); } else if ($act == 'edityunying') { $id = r('id'); $content = stripslashes(r('content')); $data_array = json_decode($content,true); $data_array['date'] =date("Y-m-d H:i:s"); $dict = array( 'yunying_remark' => json_encode($data_array) ); $sql = DB::update('calendar', $dict, "id='{$id}'"); DB::exe($sql); $info = getOneEvent($id); if($info['event'] == '上线'){ sendNotice('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'1a9389969a7b6decc779c86c0969c23cfd7c3d4bf02fe3bb78da348fb526e227'); sendNotice('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'0be37dacbaa5c76893fb85d4dab5bc23e6b981b5fa3c33908132af8e29eacf8c'); sendNotice('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'66766a72c2e5e6950ffbdc26cf8fa3fb5503d25162d80f6dd441057849ef0d4d'); push('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'邓定坤,邓定斌'); } we('1'); } else if ($act == 'edityanfa') { $id = r('id'); $content = stripslashes(r('content')); $data_array = json_decode($content,true); $data_array['date'] =date("Y-m-d H:i:s"); $dict = array( 'yanfa_remark' => json_encode($data_array) ); $sql = DB::update('calendar', $dict, "id='{$id}'"); DB::exe($sql); we('1'); } else if ($act == 'editchanpin') { $id = r('id'); $content = stripslashes(r('content')); $data_array = json_decode($content,true); $data_array['date'] =date("Y-m-d H:i:s"); $dict = array( 'chanpin_remark' => json_encode($data_array) ); $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 ); $eventTypeCntMonth = 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 ); } $eventTypeCnt[$rs['event']] += 1; if (strstr($rs['end'], $month)) { $eventTypeCntMonth[$rs['event']] += 1; } $class = "light"; if ($rs['event'] == '节点') { $class = "success"; } elseif ($rs['event'] == '打包') { $class = "warning"; } elseif ($rs['event'] == '版本更新') { $class = "danger"; $eventCount[$rs['game']]['dangerCount'] += 1; $eventCount['总更新&总修复']['dangerCount'] += 1; } elseif ($rs['event'] == '上线') { $class = "pink"; } elseif ($rs['event'] == '修复外网') { $class = "purple"; $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; } uasort($eventCount,function ($x,$y){ return $x['dangerCount']<$y['dangerCount']; }); $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,'count'=>$eventTypeCnt))); else{ $json['count'] = $eventTypeCntMonth; we(json_encode($json)); } } ?>