lip 4 часов назад
Родитель
Сommit
b52c5c3a35
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      app/Http/Controllers/admin/Balance.php

+ 10 - 2
app/Http/Controllers/admin/Balance.php

@@ -27,11 +27,20 @@ class Balance extends Controller
                 'start_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:end_time'],
                 'end_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:start_time'],
                 'first_name' => ['nullable'],
+                'is_fancai' => ['nullable', 'integer','in:0,1'],
             ]);
             $page = request()->input('page', 1);
             $limit = request()->input('limit', 10);
             $query = BalanceLog::join('users', 'users.member_id', '=', 'balance_logs.member_id')
                         ->where(BalanceLogService::getWhere($params));
+            if (!empty($params['is_fancai'])) {
+                
+                $data['change_types'] = ['即充即送','老用户回归','余额宝利息'];
+                $query = $query->whereIn('balance_logs.change_type',$data['change_types'])->where('type',2);
+                
+            } else {
+                $data['change_types'] = BalanceLogService::$RW;
+            }
             $data['total'] = $query->count();
             $totalAmount = '--';
             //如果指定用户和类型,则统计变动金额
@@ -44,8 +53,7 @@ class Balance extends Controller
                 ->forPage($page, $limit)->with(['member'])
                 ->get()->toArray();
 
-
-            $data['change_types'] = BalanceLogService::$RW;
+            
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {