Просмотр исходного кода

1.提现管理
2.流量日志可以按条件查询了

zhangjiangbin 8 лет назад
Родитель
Сommit
dc78c47eab

+ 35 - 1
app/Http/Controllers/AdminController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 use App\Http\Models\Article;
 use App\Http\Models\Config;
 use App\Http\Models\Invite;
+use App\Http\Models\ReferralApply;
 use App\Http\Models\SsConfig;
 use App\Http\Models\SsGroup;
 use App\Http\Models\SsGroupNode;
@@ -614,7 +615,29 @@ class AdminController extends BaseController
     // 流量日志
     public function trafficLog(Request $request)
     {
-        $trafficLogList = UserTrafficLog::with(['User', 'SsNode'])->orderBy('id', 'desc')->paginate(20);
+        $port = $request->get('port');
+        $user_id = $request->get('user_id');
+        $username = $request->get('username');
+
+        $query = UserTrafficLog::with(['User', 'SsNode']);
+
+        if (!empty($port)) {
+            $query->whereHas('user', function($q) use($port) {
+                $q->where('port', $port);
+            });
+        }
+
+        if (!empty($user_id)) {
+            $query->where('user_id', $user_id);
+        }
+
+        if (!empty($username)) {
+            $query->whereHas('user', function($q) use($username) {
+                $q->where('username', 'like', '%' . $username . '%');
+            });
+        }
+
+        $trafficLogList = $query->orderBy('id', 'desc')->paginate(20);
         foreach ($trafficLogList as &$trafficLog) {
             $trafficLog->u = $this->flowAutoShow($trafficLog->u);
             $trafficLog->d = $this->flowAutoShow($trafficLog->d);
@@ -623,6 +646,9 @@ class AdminController extends BaseController
 
         $view['trafficLogList'] = $trafficLogList;
 
+        // 已使用流量
+        $view['totalTraffic'] = $this->flowAutoShow($query->sum('u') + $query->sum('d'));
+
         return Response::view('admin/trafficLog', $view);
     }
 
@@ -1221,4 +1247,12 @@ TXT;
         return Response::json(['status' => 'success', 'data' => '', 'message' => '生成成功']);
     }
 
+    // 提现申请列表
+    public function applyList(Request $request)
+    {
+        $view['applyList'] = ReferralApply::with('user')->paginate(10);
+
+        return Response::view('admin/applyList', $view);
+    }
+
 }

+ 5 - 0
app/Http/Models/ReferralApply.php

@@ -23,4 +23,9 @@ class ReferralApply extends Model
         'created_at'
     ];
 
+    public function User()
+    {
+        return $this->hasOne(User::class, 'id', 'user_id');
+    }
+
 }

+ 101 - 0
resources/views/admin/applyList.blade.php

@@ -0,0 +1,101 @@
+@extends('admin.layouts')
+
+@section('css')
+@endsection
+@section('title', '控制面板')
+@section('content')
+    <!-- BEGIN CONTENT BODY -->
+    <div class="page-content">
+        <!-- BEGIN PAGE BREADCRUMB -->
+        <ul class="page-breadcrumb breadcrumb">
+            <li>
+                <a href="{{url('admin/applyList')}}">提现管理</a>
+                <i class="fa fa-circle"></i>
+            </li>
+        </ul>
+        <!-- END PAGE BREADCRUMB -->
+        <!-- BEGIN PAGE BASE CONTENT -->
+        <div class="row">
+            <div class="col-md-12">
+                <div class="portlet light bordered">
+                    <div class="portlet-title">
+                        <div class="caption">
+                            <span class="caption-subject font-dark bold uppercase">提现申请列表</span>
+                        </div>
+                    </div>
+                    <div class="portlet-body">
+                        <div class="table-scrollable">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
+                                <thead>
+                                    <tr class="uppercase">
+                                        <th> ID </th>
+                                        <th> 申请账号 </th>
+                                        <th> 提现金额 </th>
+                                        <th> 申请时间 </th>
+                                        <th> 审核时间 </th>
+                                        <th> 状态 </th>
+                                        <th> 操作 </th>
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                    @if($applyList->isEmpty())
+                                        <tr>
+                                            <td colspan="9" style="text-align: center;">暂无数据</td>
+                                        </tr>
+                                    @else
+                                        @foreach($applyList as $apply)
+                                            <tr>
+                                                <td> {{$apply->id}} </td>
+                                                <td> <a href="{{url('admin/editUser?id=' . $apply->user_id)}}" target="_blank">{{$apply->user->username}}</a> </td>
+                                                <td> {{$apply->amount}} </td>
+                                                <td> {{$apply->created_at}} </td>
+                                                <td> {{$apply->created_at == $apply->updated_at ? '' : $apply->updated_at}} </td>
+                                                <td>
+                                                    @if($apply->status == -1)
+                                                        <span class="label label-sm label-danger"> 驳回 </span>
+                                                    @elseif($apply->status == 0)
+                                                        <span class="label label-sm label-info"> 审核通过待打款 </span>
+                                                    @elseif($apply->status == 1)
+                                                        <span class="label label-sm label-success"> 已打款 </span>
+                                                    @else
+                                                        <span class="label label-sm label-default"> 待审核 </span>
+                                                    @endif
+                                                </td>
+                                                <td>
+                                                    <button type="button" class="btn btn-sm blue btn-outline" onclick="doAudit('{{$apply->id}}')">审核</button>
+                                                </td>
+                                            </tr>
+                                        @endforeach
+                                    @endif
+                                </tbody>
+                            </table>
+                        </div>
+                        <div class="row">
+                            <div class="col-md-4 col-sm-4">
+                                <div class="dataTables_info" role="status" aria-live="polite">共 {{$applyList->total()}} 个申请</div>
+                            </div>
+                            <div class="col-md-8 col-sm-8">
+                                <div class="dataTables_paginate paging_bootstrap_full_number pull-right">
+                                    {{ $applyList->links() }}
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <!-- END PAGE BASE CONTENT -->
+    </div>
+    <!-- END CONTENT BODY -->
+@endsection
+@section('script')
+    <script src="/assets/global/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
+
+    <script type="text/javascript">
+        // 审核
+        function doAudit(id) {
+            window.open('{{url('admin/applyDetail?id=')}}' + id);
+        }
+
+    </script>
+@endsection

+ 1 - 1
resources/views/admin/articleList.blade.php

@@ -24,7 +24,7 @@
                     <div class="portlet-title">
                         <div class="caption font-dark">
                             <i class="icon-docs font-dark"></i>
-                            <span class="caption-subject bold uppercase"> 文章管理</span>
+                            <span class="caption-subject bold uppercase"> 文章列表 </span>
                         </div>
                         <div class="actions">
                             <div class="btn-group">

+ 6 - 0
resources/views/admin/layouts.blade.php

@@ -123,6 +123,12 @@
                         <span class="title">邀请码管理</span>
                     </a>
                 </li>
+                <li class="nav-item {{Request::getRequestUri() == '/admin/applyList' ? 'active open' : ''}}">
+                    <a href="{{url('admin/applyList')}}" class="nav-link nav-toggle">
+                        <i class="icon-credit-card"></i>
+                        <span class="title">提现管理</span>
+                    </a>
+                </li>
                 <li class="nav-item {{Request::getRequestUri() == '/admin/articleList' ? 'active open' : ''}}">
                     <a href="{{url('admin/articleList')}}" class="nav-link nav-toggle">
                         <i class="icon-docs"></i>

+ 1 - 1
resources/views/admin/nodeList.blade.php

@@ -39,7 +39,7 @@
                     </div>
                     <div class="portlet-body">
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                 <tr>
                                     <th> ID </th>

+ 32 - 3
resources/views/admin/trafficLog.blade.php

@@ -28,8 +28,23 @@
                         </div>
                     </div>
                     <div class="portlet-body">
+                        <div class="row">
+                            <div class="col-md-2 col-sm-2">
+                                <input type="text" class="col-md-4 form-control input-sm" name="port" value="{{Request::get('port')}}" id="port" placeholder="端口" onkeydown="if(event.keyCode==13){do_search();}">
+                            </div>
+                            <div class="col-md-2 col-sm-2">
+                                <input type="text" class="col-md-4 form-control input-sm" name="user_id" value="{{Request::get('user_id')}}" id="user_id" placeholder="用户ID" onkeydown="if(event.keyCode==13){do_search();}">
+                            </div>
+                            <div class="col-md-2 col-sm-2">
+                                <input type="text" class="col-md-4 form-control input-sm" name="username" value="{{Request::get('username')}}" id="username" placeholder="用户名" onkeydown="if(event.keyCode==13){do_search();}">
+                            </div>
+                            <div class="col-md-2 col-sm-2">
+                                <button type="button" class="btn btn-sm blue" onclick="do_search();">查询</button>
+                                <button type="button" class="btn btn-sm grey" onclick="do_reset();">重置</button>
+                            </div>
+                        </div>
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                 <tr>
                                     <th> ID </th>
@@ -45,7 +60,7 @@
                                 <tbody>
                                     @if($trafficLogList->isEmpty())
                                         <tr>
-                                            <td colspan="9">暂无数据</td>
+                                            <td colspan="8">暂无数据</td>
                                         </tr>
                                     @else
                                         @foreach($trafficLogList as $trafficLog)
@@ -66,7 +81,7 @@
                         </div>
                         <div class="row">
                             <div class="col-md-4 col-sm-4">
-                                <div class="dataTables_info" role="status" aria-live="polite">共 {{$trafficLogList->total()}} 条记录</div>
+                                <div class="dataTables_info" role="status" aria-live="polite">共 {{$trafficLogList->total()}} 条记录,合计 {{$totalTraffic}}</div>
                             </div>
                             <div class="col-md-8 col-sm-8">
                                 <div class="dataTables_paginate paging_bootstrap_full_number pull-right">
@@ -84,5 +99,19 @@
     <!-- END CONTENT BODY -->
 @endsection
 @section('script')
+    <script type="text/javascript">
+        // 搜索
+        function do_search() {
+            var port = $("#port").val();
+            var user_id = $("#user_id").val();
+            var username = $("#username").val();
+
+            window.location.href = '{{url('admin/trafficLog')}}' + '?port=' + port + '&user_id=' + user_id + '&username=' + username;
+        }
 
+        // 重置
+        function do_reset() {
+            window.location.href = '{{url('admin/trafficLog')}}';
+        }
+    </script>
 @endsection

+ 2 - 2
resources/views/admin/userList.blade.php

@@ -24,7 +24,7 @@
                     <div class="portlet-title">
                         <div class="caption font-dark">
                             <i class="icon-users font-dark"></i>
-                            <span class="caption-subject bold uppercase"> 账号管理</span>
+                            <span class="caption-subject bold uppercase"> 账号列表 </span>
                         </div>
                         <div class="actions">
                             <div class="btn-group">
@@ -79,7 +79,7 @@
                             </div>
                         </div>
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                 <tr>
                                     <th> ID </th>

+ 1 - 1
resources/views/user/goodsList.blade.php

@@ -34,7 +34,7 @@
                     </div>
                     <div class="portlet-body">
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                 <tr>
                                     <th> ID </th>

+ 1 - 1
resources/views/user/layouts.blade.php

@@ -147,7 +147,7 @@
                 <li class="nav-item {{Request::getRequestUri() == '/user/ticketList' ? 'active open' : ''}}">
                     <a href="{{url('user/ticketList')}}" class="nav-link nav-toggle">
                         <i class="icon-question"></i>
-                        <span class="title">工单</span>
+                        <span class="title">我的工单</span>
                     </a>
                 </li>
                 <li class="nav-item {{Request::getRequestUri() == '/user/referral' ? 'active open' : ''}}">

+ 1 - 1
resources/views/user/nodeList.blade.php

@@ -32,7 +32,7 @@
                             <strong>流量比例:</strong> 1表示用100M就结算100M,0.1表示用100M结算10M,5表示用100M结算500M,以此类推,越是优质节点则比例越高。
                         </div>
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                 <tr>
                                     <th> ID </th>

+ 1 - 1
resources/views/user/orderList.blade.php

@@ -34,7 +34,7 @@
                     </div>
                     <div class="portlet-body">
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                     <tr>
                                         <th> ID </th>

+ 1 - 1
resources/views/user/referral.blade.php

@@ -70,7 +70,7 @@
                                 <tbody>
                                 @if($referralLogList->isEmpty())
                                     <tr>
-                                        <td colspan="5">暂无数据</td>
+                                        <td colspan="6">暂无数据</td>
                                     </tr>
                                 @else
                                     @foreach($referralLogList as $key => $referralLog)

+ 2 - 2
resources/views/user/ticketList.blade.php

@@ -11,7 +11,7 @@
         <!-- BEGIN PAGE BREADCRUMB -->
         <ul class="page-breadcrumb breadcrumb">
             <li>
-                <a href="{{url('user/ticketList')}}">工单</a>
+                <a href="{{url('user/ticketList')}}">我的工单</a>
                 <i class="fa fa-circle"></i>
             </li>
         </ul>
@@ -34,7 +34,7 @@
                     </div>
                     <div class="portlet-body">
                         <div class="table-scrollable">
-                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
+                            <table class="table table-striped table-bordered table-hover table-checkable order-column">
                                 <thead>
                                 <tr>
                                     <th> ID </th>

+ 2 - 0
routes/web.php

@@ -31,6 +31,8 @@ Route::group(['middleware' => ['user', 'admin']], function() {
     Route::post('ticket/closeTicket', 'TicketController@closeTicket'); // 关闭工单
     Route::get('admin/inviteList', 'AdminController@inviteList'); // 邀请码列表
     Route::post('admin/makeInvite', 'AdminController@makeInvite'); // 生成邀请码
+    Route::get('admin/applyList', 'AdminController@applyList'); // 提现申请管理
+    Route::get('admin/applyDetail', 'AdminController@applyDetail'); // 提现申请管理
     Route::any('admin/config', 'AdminController@config'); // 配置列表
     Route::any('admin/addConfig', 'AdminController@addConfig'); // 添加配置
     Route::post('admin/delConfig', 'AdminController@delConfig'); // 删除配置