<tr> <td colspan="3"> <?php $form = ActiveForm::begin(['action' => ['/sql/longtimesql'], 'method' => 'get']); ?> <div class="content form-inline"> <div class="row"> <div class="col-md-12"> <label for="sqllogsearch-sqltext">耗时:</label> <?php echo Html::activeTextInput($accLogErr, 'sqlusedtime', ['class' => 'form-control', 'style' => 'width:100px']); ?> <label for="sqllogsearch-sqltext">数据库:</label> <?php echo Html::activeDropDownList($accLogErr, 'databasetype', \backend\services\SqlTraceService::getSqlTraceDbType(), ['class' => 'form-control']); ?> <label for="exampleInputEmail2">执行时间:</label> <?php echo DateTimePicker::widget(['language' => 'zh-CN', 'model' => $accLogErr, 'attribute' => 'start_date', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'template' => '{input}{button}', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss', 'todayBtn' => true]]); ?> <label for="exampleInputEmail2">至</label> <?php echo DateTimePicker::widget(['language' => 'zh-CN', 'model' => $accLogErr, 'attribute' => 'end_date', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'template' => '{input}{button}', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss', 'todayBtn' => true]]); ?> <button type="submit" class="btn btn-default btn-primary btn-sm">查询</button> </div> </div> </div> <?php
<div class="content form-inline" style="padding-top: 40px"> <div class="row"> <div class="col-md-12"> <label for="sqllogsearch-sqltext">耗时:</label> <?php echo Html::activeTextInput($searchModel, 'start_sqlusedtime', ['class' => 'form-control', 'style' => 'width:100px']); ?> 至 <?php echo Html::activeTextInput($searchModel, 'end_sqlusedtime', ['class' => 'form-control', 'style' => 'width:100px']); ?> <label for="sqllogsearch-sqltext">类型:</label> <?php echo Html::activeDropDownList($searchModel, 'databasetype', SqlTraceService::getSqlTraceDbType(), ['class' => 'form-control']); ?> <label for="exampleInputEmail2">执行时间:</label> <?php echo DateTimePicker::widget(['language' => 'zh-CN', 'model' => $searchModel, 'attribute' => 'start_date', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'template' => '{input}{button}', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss', 'todayBtn' => true]]); ?> <label for="exampleInputEmail2">至</label> <?php echo DateTimePicker::widget(['language' => 'zh-CN', 'model' => $searchModel, 'attribute' => 'end_date', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'template' => '{input}{button}', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss', 'todayBtn' => true]]); ?> <button type="submit" class="btn btn-default btn-primary btn-sm">查询</button> </div> </div> </div> <?php
/** * 数据库相关的统计 */ public function actionSqlgraph() { $page = Yii::$app->request->get("page"); if (empty($page)) { $page = 0; } $pre_page = $page - 1; $next_page = $page + 1; $search_date = Yii::$app->request->get("search_date"); if (empty($search_date)) { $search_date = date("Y-m-d"); } $day_data = SqlTraceService::getSqlDayGraph($page, $search_date); if (empty($day_data)) { return $this->render('sqlgraph', ['search_date' => $search_date, "pre_page" => $pre_page, "next_page" => $next_page]); } $appnames = $day_data["appnames"]; $series['name'] = $day_data["search_date"] . "访问统计"; $series['data'] = $day_data['data']["totalVisit"]; $series['dataLabels']['enabled'] = true; $series1['name'] = $day_data["search_date"] . "每秒访问频率"; $series1['data'] = $day_data['data']["totalsecondVisit"]; $series1['dataLabels']['enabled'] = true; $appnameshourshow = $day_data['data']["hourshow"]; $series2 = $day_data['data']["reline24Visit"]; $series3 = $day_data['data']["reline24VisitSc"]; $series4 = $day_data['data']["reline24Time"]; $series5 = $day_data['data']["reline24Timesec"]; return $this->render('sqlgraph', ['search_date' => $search_date, "appnames" => $appnames, "appnameshourshow" => $appnameshourshow, "series" => array($series), "series1" => array($series1), "series2" => $series2, "series3" => $series3, "series4" => $series4, "series5" => $series5, "pre_page" => $pre_page, "next_page" => $next_page]); }