subscribeList.blade.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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::get('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::get('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="/subscribe" 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="/admin/userList?id={{$subscribe->user->id}}"
  55. target="_blank">{{$subscribe->user->email}}</a>
  56. @endif
  57. </td>
  58. <td> {{$subscribe->code}} </td>
  59. <td>
  60. <a href="/subscribe/log?id={{$subscribe->id}}"
  61. target="_blank">{{$subscribe->times}}</a>
  62. </td>
  63. <td> {{$subscribe->updated_at}} </td>
  64. <td> {{$subscribe->ban_time > 0 ? date('Y-m-d H:i', $subscribe->ban_time): ''}} </td>
  65. <td> {{$subscribe->ban_desc}} </td>
  66. <td>
  67. @if($subscribe->status == 0)
  68. <button class="btn btn-sm btn-outline-success"
  69. onclick="setSubscribeStatus('{{$subscribe->id}}', 1)">启用
  70. </button>
  71. @endif
  72. @if($subscribe->status == 1)
  73. <button class="btn btn-sm btn-outline-danger"
  74. onclick="setSubscribeStatus('{{$subscribe->id}}', 0)">禁用
  75. </button>
  76. @endif
  77. </td>
  78. </tr>
  79. @endforeach
  80. </tbody>
  81. </table>
  82. </div>
  83. <div class="panel-footer">
  84. <div class="row">
  85. <div class="col-sm-4">
  86. 共 <code>{{$subscribeList->total()}}</code> 条记录
  87. </div>
  88. <div class="col-sm-8">
  89. <nav class="Page navigation float-right">
  90. {{$subscribeList->links()}}
  91. </nav>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. @endsection
  98. @section('script')
  99. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  100. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  101. <script type="text/javascript">
  102. $(document).ready(function () {
  103. $('#status').val({{Request::get('status')}});
  104. });
  105. //回车检测
  106. $(document).on("keypress", "input", function (e) {
  107. if (e.which === 13) {
  108. Search();
  109. return false;
  110. }
  111. });
  112. // 搜索
  113. function Search() {
  114. window.location.href = '/subscribe' + '?user_id=' + $("#user_id").val() + '&email=' + $("#email").val() + '&status=' + $("#status option:selected").val();
  115. }
  116. // 启用禁用用户的订阅
  117. function setSubscribeStatus(id, status) {
  118. $.post("/subscribe/set", {
  119. _token: '{{csrf_token()}}',
  120. id: id,
  121. status: status
  122. }, function (ret) {
  123. swal.fire({title: ret.message, timer: 1000, showConfirmButton: false,})
  124. .then(() => {
  125. window.location.reload();
  126. })
  127. });
  128. }
  129. </script>
  130. @endsection