feat: sms module

This commit is contained in:
mahyargdz
2025-07-09 11:55:58 +03:30
parent 43e49f96f7
commit ac1391f9ce
15 changed files with 1175 additions and 464 deletions
+2 -19
View File
@@ -14,17 +14,11 @@ const {
checkMobileNumber,
normalizeMobileNumber
} = require('../plugins/controllersHelperFunctions')
const { SMS } = require('../plugins/SMS_Module')
const { phrases } = require('../plugins/SMS_Phrases')
const sms = require('../plugins/SMS_Module')
///
const _faSr = _sr.fa
// date formaters
function SmsDateFormat(date) {
return moment(date).format('jYYYY/jMM/jDD')
}
module.exports.addLottery = [
[
body('title').notEmpty().withMessage(_faSr.required.title),
@@ -338,18 +332,7 @@ module.exports.enrollParticipant = [
lottery.markModified('participants')
await lottery.save()
const msg = [
fullName,
' عزیز، اطلاعات شما در تاریخ ',
SmsDateFormat(Date.now()),
' برای شرکت در قرعه کشی آسان سرویس ثبت گردید. ',
'\n',
'کد پیگیری: ',
enrollCode,
'\n',
phrases.signature
]
SMS([normalizedMN], msg.join(''))
await sms.lottery.enrollment(normalizedMN, fullName, enrollCode, Date.now())
return res.json({ message: 'اطلاعات شما با موفیقت در سیستم ثبت شد. کد پیگیری به تلفن همراه شما ارسال گردید' })
} catch (e) {
return res500(res, `there is an error here --- ${e}`)