index.blade.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">订阅列表</h3>
  10. </div>
  11. <div class="panel-body">
  12. <div class="form-row">
  13. <div class="form-group col-lg-2 col-sm-6">
  14. <input type="number" class="form-control" name="user_id" id="user_id"
  15. value="{{Request::input('user_id')}}" placeholder="ID"/>
  16. </div>
  17. <div class="form-group col-lg-4 col-sm-6">
  18. <input type="text" class="form-control" name="email" id="email"
  19. value="{{Request::input('email')}}" placeholder="用户名"/>
  20. </div>
  21. <div class="form-group col-lg-3 col-sm-6">
  22. <select name="status" id="status" class="form-control" onChange="Search()">
  23. <option value="" hidden>状态</option>
  24. <option value="0">禁用</option>
  25. <option value="1">正常</option>
  26. </select>
  27. </div>
  28. <div class="form-group col-lg-2 col-sm-6 btn-group">
  29. <button class="btn btn-primary" onclick="Search()">搜 索</button>
  30. <a href="{{route('admin.subscribe.index')}}" class="btn btn-danger">重 置</a>
  31. </div>
  32. </div>
  33. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  34. <thead class="thead-default">
  35. <tr>
  36. <th> #</th>
  37. <th> 用户</th>
  38. <th> 订阅码</th>
  39. <th> 请求次数</th>
  40. <th> 最后请求时间</th>
  41. <th> 封禁时间</th>
  42. <th> 封禁理由</th>
  43. <th> 操作</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. @foreach($subscribeList as $subscribe)
  48. <tr>
  49. <td> {{$subscribe->id}} </td>
  50. <td>
  51. @if(empty($subscribe->user))
  52. 【账号已删除】
  53. @else
  54. <a href="{{route('admin.user.index', ['id'=>$subscribe->user->id])}}" target="_blank">{{$subscribe->user->email}}</a>
  55. @endif
  56. </td>
  57. <td> {{$subscribe->code}} </td>
  58. <td>
  59. <a href="{{route('admin.subscribe.log', $subscribe->id)}}" target="_blank">{{$subscribe->times}}</a>
  60. </td>
  61. <td> {{$subscribe->updated_at}} </td>
  62. <td> {{$subscribe->ban_time ? date('Y-m-d H:i', $subscribe->ban_time): ''}} </td>
  63. <td> {{$subscribe->ban_desc}} </td>
  64. <td>
  65. <button class="btn btn-sm @if($subscribe->status == 0) btn-outline-success @else btn-sm btn-outline-danger @endif"
  66. onclick="setSubscribeStatus('{{route('admin.subscribe.set', $subscribe->id)}}')">
  67. @if($subscribe->status == 0) 启用 @else 禁用 @endif
  68. </button>
  69. </td>
  70. </tr>
  71. @endforeach
  72. </tbody>
  73. </table>
  74. </div>
  75. <div class="panel-footer">
  76. <div class="row">
  77. <div class="col-sm-4">
  78. 共 <code>{{$subscribeList->total()}}</code> 条记录
  79. </div>
  80. <div class="col-sm-8">
  81. <nav class="Page navigation float-right">
  82. {{$subscribeList->links()}}
  83. </nav>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. @endsection
  90. @section('script')
  91. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  92. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  93. <script type="text/javascript">
  94. $(document).ready(function() {
  95. $('#status').val({{Request::input('status')}});
  96. });
  97. //回车检测
  98. $(document).on('keypress', 'input', function(e) {
  99. if (e.which === 13) {
  100. Search();
  101. return false;
  102. }
  103. });
  104. // 搜索
  105. function Search() {
  106. window.location.href = '{{route('admin.subscribe.index')}}' + '?user_id=' + $('#user_id').val() + '&email=' + $('#email').val() + '&status=' + $('#status option:selected').val();
  107. }
  108. // 启用禁用用户的订阅
  109. function setSubscribeStatus(url) {
  110. $.post(url, {_token: '{{csrf_token()}}'}, function(ret) {
  111. if (ret.status === 'success') {
  112. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false}).then(() => {
  113. window.location.reload();
  114. });
  115. }
  116. else {
  117. swal.fire({title: ret.message, type: 'error', timer: 1000, showConfirmButton: false}).then(() => {
  118. window.location.reload();
  119. });
  120. }
  121. });
  122. }
  123. </script>
  124. @endsection