|
@@ -29,6 +29,12 @@ class WithdrawalListController extends Curd
|
|
|
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
|
|
$order = $request->get('order', 'desc');
|
|
|
$field = $field ?? 'member_account_list_addtimes';
|
|
|
+
|
|
|
+ if (!empty($where['member_account_list_addtimes'])) {
|
|
|
+ $where['member_account_list_addtimes'][0] = strtotime($where['member_account_list_addtimes'][0]);
|
|
|
+ $where['member_account_list_addtimes'][1] = strtotime($where['member_account_list_addtimes'][1]);
|
|
|
+ }
|
|
|
+
|
|
|
$query = $this->doSelect($where, $field, $order);
|
|
|
return $this->doFormat($query, $format, $limit);
|
|
|
}
|
|
@@ -78,6 +84,9 @@ class WithdrawalListController extends Curd
|
|
|
if ($field) {
|
|
|
$model = $model->orderBy($field, $order);
|
|
|
}
|
|
|
+ if (!empty($where['member_account_list_status']) && $where['member_account_list_status'] == 'CANCEL') {
|
|
|
+ $model = $model->whereJsonDoesntContain('member_account_list_extend_json->reason', '');
|
|
|
+ }
|
|
|
return $model;
|
|
|
}
|
|
|
|
|
@@ -111,6 +120,75 @@ class WithdrawalListController extends Curd
|
|
|
return $items;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Desc 提现顶部统计
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/10/31 10:49
|
|
|
+ *
|
|
|
+ * @param Request $request
|
|
|
+ * @return Response
|
|
|
+ */
|
|
|
+ public function statistics(Request $request)
|
|
|
+ {
|
|
|
+ $memberAccountListAddtimes = $request->get('member_account_list_addtimes');
|
|
|
+ $memberId = $request->get('join_member_account_list_member_id');
|
|
|
+ $status = $request->get('member_account_list_status');
|
|
|
+
|
|
|
+ if (!empty($memberAccountListAddtimes)) {
|
|
|
+ $memberAccountListAddtimes[0] = strtotime($memberAccountListAddtimes[0]);
|
|
|
+ $memberAccountListAddtimes[1] = strtotime($memberAccountListAddtimes[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $withdrawalModel = MemberAccountList::where('member_account_list_attr', 'OUT')
|
|
|
+ ->when(!empty($memberAccountListAddtimes), function ($query) use ($memberAccountListAddtimes) {
|
|
|
+ $query->whereBetween('member_account_list_addtimes', $memberAccountListAddtimes);
|
|
|
+ })->when(!empty($memberId), function ($query) use ($memberId) {
|
|
|
+ $query->where('join_member_account_list_member_id', $memberId);
|
|
|
+ })->when(!empty($status), function ($query) use ($status) {
|
|
|
+ $query->where('member_account_list_status', $status);
|
|
|
+ });
|
|
|
+
|
|
|
+ $totalModel = clone $withdrawalModel;
|
|
|
+ $total = $totalModel->selectRaw("SUM(member_account_list_amount) as amount,count(member_account_list_id) as total")
|
|
|
+ ->first()
|
|
|
+ ->toArray();
|
|
|
+ $pendingTotalModel = clone $withdrawalModel;
|
|
|
+ $pendingTotal = $pendingTotalModel->where('member_account_list_status', 'PENDING')
|
|
|
+ ->selectRaw("SUM(member_account_list_amount) as amount,count(member_account_list_id) as total")
|
|
|
+ ->first()
|
|
|
+ ->toArray();
|
|
|
+ $waitingTotalModel = clone $withdrawalModel;
|
|
|
+ $waitingTotal = $waitingTotalModel->where('member_account_list_status', 'WAITING')
|
|
|
+ ->selectRaw("SUM(member_account_list_amount) as amount,count(member_account_list_id) as total")
|
|
|
+ ->first()
|
|
|
+ ->toArray();
|
|
|
+ $activedTotalModel = clone $withdrawalModel;
|
|
|
+ $activedTotal = $activedTotalModel->where('member_account_list_status', 'ACTIVED')
|
|
|
+ ->selectRaw("SUM(member_account_list_amount) as amount,count(member_account_list_id) as total")
|
|
|
+// ->selectRaw("SUM(member_account_list_amount) as amount,SUM(JSON_UNQUOTE(JSON_EXTRACT(member_account_list_json,'$.surplus')) * JSON_UNQUOTE(JSON_EXTRACT(member_account_list_json,'$.out_rate')) / 1000) as rate_amount,count(member_account_list_id) as total")
|
|
|
+ ->first()
|
|
|
+ ->toArray();
|
|
|
+ // 实际打款是总额减去手续费
|
|
|
+ if (!empty($activedTotal['amount']) && !empty($activedTotal['rate_amount'])) {
|
|
|
+ $activedTotal['amount'] = sprintf('%.2f', $activedTotal['amount'] - $activedTotal['rate_amount']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $rejectTotalModel = clone $withdrawalModel;
|
|
|
+ $rejectTotal = $rejectTotalModel->where('member_account_list_status', 'CANCEL')
|
|
|
+ ->whereJsonDoesntContain('member_account_list_extend_json->reason', '')
|
|
|
+ ->selectRaw("SUM(member_account_list_amount) as amount,count(member_account_list_id) as total")
|
|
|
+ ->first()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return json_success('success', [
|
|
|
+ 'total' => $total,
|
|
|
+ 'pendingTotal' => $pendingTotal,
|
|
|
+ 'waitingTotal' => $waitingTotal,
|
|
|
+ 'activedTotal' => $activedTotal,
|
|
|
+ 'rejectTotal' => $rejectTotal
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Desc 记录详情
|
|
|
* @Author Gorden
|
|
@@ -138,7 +216,7 @@ class WithdrawalListController extends Curd
|
|
|
if (!empty($info->member_account_list_json)) {
|
|
|
$accountListJson = json_decode($info->member_account_list_json, true);
|
|
|
$info->out_rate = !empty($accountListJson['out_rate']) ? $accountListJson['out_rate'] / 10 : 0;
|
|
|
- $info->to_account = sprintf('%.2f',$info->member_account_list_amount - (round($info->member_account_list_amount * $info->out_rate / 100, 2)));
|
|
|
+ $info->to_account = sprintf('%.2f', $info->member_account_list_amount - (round($info->member_account_list_amount * $info->out_rate / 100, 2)));
|
|
|
$info->banks = [
|
|
|
[
|
|
|
'bank_name' => $accountListJson['bank_name'] ?? '',
|