更新完善页面
This commit is contained in:
@@ -15,12 +15,19 @@ async function getTodayStats(ctx) {
|
||||
[todayStart, todayEnd]
|
||||
)
|
||||
|
||||
const stockThreshold = parseInt(process.env.STOCK_WARN_THRESHOLD) || 10
|
||||
const lowStockResult = await query(
|
||||
'SELECT COUNT(*) as lowStockCount FROM goods WHERE stock < ? AND status != 0',
|
||||
[stockThreshold]
|
||||
)
|
||||
|
||||
ctx.body = {
|
||||
code: 200,
|
||||
data: {
|
||||
sales: orderResult[0].totalSales,
|
||||
orders: orderResult[0].orderCount,
|
||||
customers: customerResult[0].customerCount
|
||||
customers: customerResult[0].customerCount,
|
||||
lowStockCount: lowStockResult[0].lowStockCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user