subscribeList.blade.php 4.6 KB

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