|
@@ -21,7 +21,7 @@ class Balance extends Controller
|
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
|
'limit' => ['nullable', 'integer', 'min:1'],
|
|
'limit' => ['nullable', 'integer', 'min:1'],
|
|
|
'member_id' => ['nullable', 'string', 'min:1'],
|
|
'member_id' => ['nullable', 'string', 'min:1'],
|
|
|
- 'change_type' => ['nullable', 'string'],
|
|
|
|
|
|
|
+ 'change_type' => ['nullable', 'string', 'in:' . implode(',', BalanceLogService::$RW)],
|
|
|
'start_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:end_time'],
|
|
'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'],
|
|
'end_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:start_time'],
|
|
|
]);
|
|
]);
|
|
@@ -29,6 +29,10 @@ class Balance extends Controller
|
|
|
$limit = request()->input('limit', 10);
|
|
$limit = request()->input('limit', 10);
|
|
|
$query = BalanceLog::where(BalanceLogService::getWhere($params));
|
|
$query = BalanceLog::where(BalanceLogService::getWhere($params));
|
|
|
$data['total'] = $query->count();
|
|
$data['total'] = $query->count();
|
|
|
|
|
+ $totalAmount = '--';
|
|
|
|
|
+ if (isset($params['member_id'])) $totalAmount = $query->sum('amount');
|
|
|
|
|
+
|
|
|
|
|
+ $data['total_amount'] = $totalAmount;
|
|
|
$data['data'] = $query->orderByDesc('id')
|
|
$data['data'] = $query->orderByDesc('id')
|
|
|
->forPage($page, $limit)->with(['member'])
|
|
->forPage($page, $limit)->with(['member'])
|
|
|
->get()->toArray();
|
|
->get()->toArray();
|