gq 7 years ago
parent
commit
b7b42dcbb8

+ 1 - 1
server/app/Http/Controllers/Api/V1/MyController.php

xqd
@@ -489,7 +489,7 @@ class MyController extends Controller
 //        $info['note'] = $data['type'].$data['name'];
 //        $ok = AccountLog::create($info);
         $data['user_id'] = $user->id;
-        $data['status'] = 0;
+        $data['status'] = 1;
         $ok = UserCashOut::create($data);
         if ($ok) {
             return $this->api(ErrorCode::verify);

+ 10 - 0
server/app/Models/UserCashOutModel.php

xqd
@@ -38,4 +38,14 @@ class UserCashOutModel extends BaseModel
                            'comments'
                           ];
 
+    public function user()     //方法名加_id作为连接的外键名
+    {
+        return $this->belongsTo('App\Models\UserInfoModel');
+    }
+
+    public function bank()
+    {
+        return $this->belongsTo('App\Models\UserBanksModel');
+    }
+
 }

+ 11 - 4
server/app/Repositories/User/Cash/Criteria/MultiWhere.php

xqd
@@ -35,10 +35,17 @@ class MultiWhere extends Criteria {
     */
     public function apply($model, Repository $repository)
     {
-          if(isset($this->search['deleted_at']) && $this->search['deleted_at']) {
-                                    $model = $model->where('deleted_at',$this->search['deleted_at']);
-                                 }
-
+          if(isset($this->search['keyword']) && $this->search['keyword']) {
+              $keyword = '%'.$this->search['keyword'].'%';
+                $model = $model->whereHas('user', function ($query) use ($keyword) {
+                    $query->where('nickname','like','$keyword');
+                })->orWhereHas('bank', function ($query) use ($keyword) {
+                    $query->where('bank_name','like','$keyword')->
+                    orWhere('bank_number','like','$keyword');
+                });
+          }
+//          dump($keyword);
+//          dd($model->toSql());
          return $model;
     }
 

+ 1 - 7
server/database/migrations/2017_08_26_113215_create_user_cash_out_table.php

xqd
@@ -26,14 +26,8 @@ class CreateUserCashOutTable extends Migration
             $table->string('name')->comment('账号姓名');
             $table->decimal('cash', 8, 2)->comment('提现金额');
             $table->text('comments')->nullable()->comment('审核未通过原因, 备注等');
-            $table->tinyInteger('status')->comment('提现状态: 0, 申请提现; 1,审核通过; 2,已打款; 3,审核未通过');
+            $table->tinyInteger('status')->default(0)->comment('提现状态: 1, 申请提现; 2,已打款; 3,审核未通过');
             $table->nullableTimestamps();
-
-
-            
-
-            
-
         });
     }
 

+ 8 - 6
server/resources/views/admin/user/cash/out/index.blade.php

xqd xqd
@@ -38,7 +38,8 @@
 								
             <th class="sorting" data-sort="id"> id </th>
             <th class="sorting" data-sort="user_id"> 提现用户 </th>
-            <th class="sorting" data-sort="bank_id"> 绑定的提现方式 </th>
+            <th class="sorting" data-sort="bank_id"> 提现账号 </th>
+            <th class="sorting" data-sort="bank_id"> 账号姓名 </th>
             <th class="sorting" data-sort="status"> 提现状态</th>
             <th class="sorting" data-sort="cash"> 提现金额 </th>
             <th class="sorting" data-sort="created_at"> 提现时间 </th>
@@ -48,11 +49,12 @@
 						<tbody>
 						@if(isset($list))
 							@foreach($list as $key => $item)							<tr>
-								
-            <td>{{ $item->id }}</td>
-            <td>{{ $item->user_id }}</td>
-            <td>{{ $item->bank_id }}</td>
-            <td>{{ $item->status }}</td>
+
+			<td>{{ $item->id }}</td>
+			<td>{{ !empty($item->user) ? $item->user->nickname : '' }}</td>
+			<td>{{ !empty($item->bank) ? $item->bank->bank_number : '' }}</td>
+			<td>{{ !empty($item->bank) ? $item->bank->bank_name : '' }}</td>
+            <td>{{  dict()->get('global','cash_out',$item->status) }}</td>
             <td>{{ $item->cash }}</td>
             <td>{{ $item->created_at }}</td>
 								<td>