ip-statistics.php 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. use yii\grid\GridView;
  3. use common\helpers\Url;
  4. use yii\widgets\LinkPager;
  5. use common\helpers\DebrisHelper;
  6. use kartik\daterange\DateRangePicker;
  7. use yii\widgets\ActiveForm;
  8. $this->title = 'IP 统计';
  9. $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['ip-statistics']];
  10. $addon = <<< HTML
  11. <div class="input-group-append">
  12. <span class="input-group-text">
  13. <i class="fas fa-calendar-alt"></i>
  14. </span>
  15. </div>
  16. HTML;
  17. ?>
  18. <div class="row">
  19. <div class="col-sm-12">
  20. <div class="nav-tabs-custom">
  21. <ul class="nav nav-tabs">
  22. <li><a href="<?= Url::to(['index']) ?>"> 全局日志</a></li>
  23. <li><a href="<?= Url::to(['statistics']) ?>"> 数据统计</a></li>
  24. <li class="active"><a href="<?= Url::to(['ip-statistics']) ?>"> IP 统计</a></li>
  25. </ul>
  26. <div class="tab-content">
  27. <div class="active tab-pane">
  28. <div class="box-body table-responsive">
  29. <?php $form = ActiveForm::begin([
  30. 'action' => Url::to(['ip-statistics']),
  31. 'method' => 'get',
  32. ]); ?>
  33. <div class="row">
  34. <div class="col-3">
  35. <div class="input-group drp-container">
  36. <?= DateRangePicker::widget([
  37. 'name' => 'queryDate',
  38. 'value' => $start_time . '-' . $end_time,
  39. 'readonly' => 'readonly',
  40. 'useWithAddon' => true,
  41. 'convertFormat' => true,
  42. 'startAttribute' => 'start_time',
  43. 'endAttribute' => 'end_time',
  44. 'startInputOptions' => ['value' => $start_time],
  45. 'endInputOptions' => ['value' => $end_time],
  46. 'pluginOptions' => [
  47. 'locale' => ['format' => 'Y-m-d'],
  48. ]
  49. ]) . $addon;?>
  50. </div>
  51. </div>
  52. <div class="col-3">
  53. <div class="input-group m-b">
  54. <input type="text" class="form-control" name="ip" placeholder="ip" value="<?= $ip ?>"/>
  55. <span class="input-group-btn"><button class="btn btn-white"><i class="fa fa-search"></i> 搜索</button></span>
  56. </div>
  57. </div>
  58. </div>
  59. <?php ActiveForm::end(); ?>
  60. <table class="table table-hover">
  61. <thead>
  62. <tr>
  63. <th>请求数量</th>
  64. <th>IP</th>
  65. <th>所在地区</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <?php foreach($models as $model){ ?>
  70. <tr>
  71. <td><?= $model['count']; ?></td>
  72. <td><?= $model['ip']; ?></td>
  73. <td><?= DebrisHelper::analysisIp($model['ip']); ?></td>
  74. </tr>
  75. <?php } ?>
  76. </tbody>
  77. </table>
  78. </div>
  79. <div class="box-footer">
  80. <?= LinkPager::widget([
  81. 'pagination' => $pages
  82. ]);?>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
粤ICP备19079148号