feat: init send mail (#113)

* feat: init send mail

* feat: init send mail
This commit is contained in:
Dream Hunter
2024-04-12 13:26:42 +08:00
committed by GitHub
parent ee2fdab279
commit b8f0fa49cf
21 changed files with 1143 additions and 296 deletions

View File

@@ -84,10 +84,15 @@ api.get('/api/settings', async (c) => {
const { count: mailCountV1 } = await c.env.DB.prepare(
`SELECT count(*) as count FROM mails where address = ?`
).bind(address).first();
const balance = await c.env.DB.prepare(
`SELECT balance FROM address_sender
where address = ? and enabled = 1`
).bind(address).first("balance");
return c.json({
auto_reply: auto_reply,
address: address,
has_v1_mails: mailCountV1 > 0
has_v1_mails: mailCountV1 && mailCountV1 > 0,
send_balance: balance || 0,
});
})