展示打手提现统计
This commit is contained in:
@@ -154,6 +154,11 @@ export type WorkerFinanceRequestRow = {
|
||||
worker_username?: string
|
||||
worker_display_name?: string
|
||||
worker_phone?: string
|
||||
worker_type?: string
|
||||
worker_level_key?: string
|
||||
worker_level_name?: string
|
||||
worker_withdraw_request_count?: number
|
||||
worker_total_withdraw_amount?: number
|
||||
}
|
||||
|
||||
export type WorkerWithdrawalAccountRow = {
|
||||
|
||||
@@ -39,9 +39,23 @@ const WORKER_FINANCE_REQUEST_SELECT = `
|
||||
wfr.*,
|
||||
wu.username AS worker_username,
|
||||
wu.display_name AS worker_display_name,
|
||||
wu.phone AS worker_phone
|
||||
wu.phone AS worker_phone,
|
||||
wu.worker_type,
|
||||
wl.level_key AS worker_level_key,
|
||||
wl.name AS worker_level_name,
|
||||
withdraw_stats.withdraw_request_count AS worker_withdraw_request_count,
|
||||
withdraw_stats.total_withdraw_amount AS worker_total_withdraw_amount
|
||||
FROM worker_finance_requests wfr
|
||||
LEFT JOIN worker_users wu ON wu.id = wfr.worker_id
|
||||
LEFT JOIN worker_levels wl ON wl.id = wu.level_id
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT
|
||||
COUNT(*)::int AS withdraw_request_count,
|
||||
COALESCE(SUM(amount) FILTER (WHERE status = 'approved'), 0)::bigint AS total_withdraw_amount
|
||||
FROM worker_finance_requests history_request
|
||||
WHERE history_request.worker_id = wfr.worker_id
|
||||
AND history_request.request_type = 'withdraw'
|
||||
) withdraw_stats ON TRUE
|
||||
`
|
||||
|
||||
export type CreateWorkerSessionInput = {
|
||||
|
||||
Reference in New Issue
Block a user