mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-22 23:52:30 +02:00
Merge pull request #1165 from OpenSignLabs/validation
feat: show email used count
This commit is contained in:
@@ -103,15 +103,15 @@ export const updateMailCount = async (extUserId, plan, monthchange) => {
|
||||
if (plan === 'freeplan') {
|
||||
if (monthchange) {
|
||||
contractUser.set('LastEmailCountReset', new Date());
|
||||
contractUser.set('MontlyfreeEmails', 1);
|
||||
contractUser.set('MonthlyFreeEmails', 1);
|
||||
} else {
|
||||
if (contractUser?.get('MontlyfreeEmails')) {
|
||||
contractUser.increment('MontlyfreeEmails', 1);
|
||||
if (contractUser?.get('MonthlyFreeEmails')) {
|
||||
contractUser.increment('MonthlyFreeEmails', 1);
|
||||
if (contractUser?.get('LastEmailCountReset')) {
|
||||
contractUser.set('LastEmailCountReset', new Date());
|
||||
}
|
||||
} else {
|
||||
contractUser.set('MontlyfreeEmails', 1);
|
||||
contractUser.set('MonthlyFreeEmails', 1);
|
||||
contractUser.set('LastEmailCountReset', new Date());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ async function sendmailv3(req) {
|
||||
}
|
||||
} else {
|
||||
if (Plan && Plan === 'freeplan') {
|
||||
let MontlyfreeEmails = _extRes?.MontlyfreeEmails || 0;
|
||||
let MonthlyFreeEmails = _extRes?.MonthlyFreeEmails || 0;
|
||||
if (_extRes?.LastEmailCountReset?.iso) {
|
||||
const lastDate = new Date(_extRes?.LastEmailCountReset?.iso);
|
||||
const newDate = new Date();
|
||||
@@ -225,7 +225,7 @@ async function sendmailv3(req) {
|
||||
const nonCustomMail = await sendMailProvider(req, Plan, true);
|
||||
return nonCustomMail;
|
||||
} else {
|
||||
if (MontlyfreeEmails >= 20) {
|
||||
if (MonthlyFreeEmails >= 20) {
|
||||
return { status: 'quota-reached' };
|
||||
} else {
|
||||
const nonCustomMail = await sendMailProvider(req, Plan);
|
||||
|
||||
Reference in New Issue
Block a user