提交
This commit is contained in:
@@ -208,10 +208,36 @@ router.get('/directly_operated', agentAuth, async (req, res) => {
|
||||
const totalPages = Math.ceil(total / pageSize);
|
||||
const hasNextPage = pageNum < totalPages;
|
||||
const hasPrevPage = pageNum > 1;
|
||||
|
||||
const all_total = {
|
||||
balance_total : 0
|
||||
}
|
||||
//直营用户融豆数量
|
||||
const balance_total = await getDB().execute(`
|
||||
SELECT SUM(balance) as balance FROM users u
|
||||
WHERE inviter=${agentId}
|
||||
`)
|
||||
all_total.balance_total = balance_total[0].balance || 0;
|
||||
//今日提现
|
||||
const withdraw_total = await getDB().execute(`
|
||||
SELECT SUM(amount) as amount
|
||||
FROM transfers
|
||||
WHERE source_type = 'withdraw'
|
||||
AND from_user_id = ${agentId}
|
||||
AND created_at >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)
|
||||
`)
|
||||
all_total.withdraw_total = withdraw_total[0].amount || 0
|
||||
//总提现次数
|
||||
const withdraw_num_total = await getDB().execute(`
|
||||
SELECT COUNT(*) as total
|
||||
FROM transfers
|
||||
WHERE source_type = 'withdraw'
|
||||
AND from_user_id = ${agentId}
|
||||
`)
|
||||
all_total.withdraw_num_total = withdraw_num_total[0].total || 0
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
all_total,
|
||||
users,
|
||||
pagination: {
|
||||
current_page: pageNum,
|
||||
|
||||
Reference in New Issue
Block a user