index.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. use yii\grid\GridView;
  3. use common\helpers\Html;
  4. use common\enums\WhetherEnum;
  5. use common\helpers\DebrisHelper;
  6. $this->title = '短信日志';
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <div class="row">
  10. <div class="col-12 col-xs-12">
  11. <div class="box">
  12. <div class="box-header">
  13. <h3 class="box-title"><?= $this->title; ?></h3>
  14. <div class="box-tools">
  15. <?= Html::linkButton(['stat'], '<i class="fa fa-area-chart"></i> 异常发送报表统计', [
  16. 'data-toggle' => 'modal',
  17. 'data-target' => '#ajaxModalMax',
  18. ]) ?>
  19. </div>
  20. </div>
  21. <!-- /.box-header -->
  22. <div class="box-body table-responsive">
  23. <?= GridView::widget([
  24. 'dataProvider' => $dataProvider,
  25. 'filterModel' => $searchModel,
  26. // 重新定义分页样式
  27. 'tableOptions' => ['class' => 'table table-hover'],
  28. 'columns' => [
  29. 'id',
  30. 'mobile',
  31. [
  32. 'attribute' => 'code',
  33. 'headerOptions' => ['class' => 'col-md-1'],
  34. ],
  35. // 'content',
  36. [
  37. 'attribute' => 'usage',
  38. 'headerOptions' => ['class' => 'col-md-1'],
  39. ],
  40. [
  41. 'attribute' => 'used',
  42. 'value' => function ($model, $key, $index, $column) {
  43. return WhetherEnum::html($model->used);
  44. },
  45. 'format' => 'raw',
  46. 'filter' => Html::activeDropDownList($searchModel, 'used', WhetherEnum::getMap(), [
  47. 'prompt' => '全部',
  48. 'class' => 'form-control'
  49. ]
  50. )
  51. ],
  52. [
  53. 'attribute' => 'use_time',
  54. 'filter' => false, //不显示搜索框
  55. 'value' => function ($model) {
  56. return empty($model->use_time) ? '---' : date('Y-m-d H:i:s', $model->use_time);
  57. },
  58. ],
  59. [
  60. 'attribute' => 'error_code',
  61. 'label' => '状态码',
  62. 'headerOptions' => ['class' => 'col-md-1'],
  63. 'value' => function ($model) {
  64. if ($model->error_code < 300) {
  65. return '<span class="label label-outline-success">' . $model->error_code . '</span>';
  66. } else {
  67. return '<span class="label label-outline-danger">' . $model->error_code . '</span>';
  68. }
  69. },
  70. 'format' => 'raw',
  71. ],
  72. [
  73. 'attribute' => 'error_msg',
  74. 'filter' => false, //不显示搜索框
  75. ],
  76. [
  77. 'label' => '位置信息',
  78. 'value' => function ($model) {
  79. $str = [];
  80. $str[] = DebrisHelper::analysisIp($model->ip);
  81. $str[] = DebrisHelper::long2ip($model->ip);
  82. return implode('</br>', $str);
  83. },
  84. 'format' => 'raw',
  85. ],
  86. [
  87. 'label' => '创建时间',
  88. 'attribute' => 'created_at',
  89. 'filter' => false, //不显示搜索框
  90. 'format' => ['date', 'php:Y-m-d H:i:s'],
  91. ],
  92. [
  93. 'header' => "操作",
  94. 'class' => 'yii\grid\ActionColumn',
  95. 'template' => '{view}',
  96. 'buttons' => [
  97. 'view' => function ($url, $model, $key) {
  98. return Html::linkButton(['view', 'id' => $model->id], '查看详情', [
  99. 'data-toggle' => 'modal',
  100. 'data-target' => '#ajaxModalLg',
  101. ]);
  102. },
  103. ],
  104. ],
  105. ],
  106. ]); ?>
  107. <!-- /.box-body -->
  108. </div>
  109. <!-- /.box -->
  110. </div>
  111. </div>
  112. </div>
粤ICP备19079148号