From b24526669e533a10a1ac6d729d8d12fcb178e7c5 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 7 Dec 2023 11:56:57 -0500 Subject: [PATCH] Notification start --- .../REMINDER/offer_pending_reminder.mailfile | 6 ++--- wrenchboard/src/include/email.h | 2 +- wrenchboard/src/shared_tool/email.cc | 12 +++++++++- wrenchboard/src/shared_tool/site_crons.cc | 24 +++++++++++++------ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/wrenchboard/email/REMINDER/offer_pending_reminder.mailfile b/wrenchboard/email/REMINDER/offer_pending_reminder.mailfile index ea11b281..b148c4e9 100644 --- a/wrenchboard/email/REMINDER/offer_pending_reminder.mailfile +++ b/wrenchboard/email/REMINDER/offer_pending_reminder.mailfile @@ -17,12 +17,12 @@ img {height: auto;} .h1, .h2, .bodycopy {color: #153643; font-family: sans-serif;} .h1 {font-size: 33px; line-height: 38px; font-weight: bold;} .bodycopy {font-size: 14px; line-height: 20px;} -.button {text-align: center; font-size: 16px; font-family: sans-serif; font-weight: bold; padding: 0 30px 0 30px;} +.button {text-align: center; font-size: 16px; font-family: sans-serif; padding: 0 30px 0 30px;} .button a {color: #ffffff; text-decoration: none;} .footer {padding: 20px 30px 15px 30px; bgcolor:#007bff; background-color:#007bff;} .footercopy {font-family: sans-serif; font-size: 14px; color: #ffffff;} .footercopy a {color: #ffffff; text-decoration: underline;} -.expire{ color: red;} +.expire{ color: red; font-weight: bold; padding: 10px 0px 20 0px;} @@ -74,7 +74,7 @@ img {height: auto;} An offer was sent to you and waiting for your acceptance at {{site_name}}.
Title : {{title}}
- This will expire after {{expire}}. + This will expire after {{expire_formated}}.
diff --git a/wrenchboard/src/include/email.h b/wrenchboard/src/include/email.h index 9c61e19c..972afe10 100644 --- a/wrenchboard/src/include/email.h +++ b/wrenchboard/src/include/email.h @@ -41,7 +41,7 @@ long cron_email(long mailtype, CVars in, CVars &out); long coupon_email(long mailtype, CVars in, CVars &out); long family_email(long mailtype, CVars in, CVars &out); long market_email(long mailtype, CVars in, CVars &out); - +long plan_notification(CVars in, CVars &out); long SignupPendingAlertMailfile(CVars in); long SignupCompletedAlertMailfile(CVars in); diff --git a/wrenchboard/src/shared_tool/email.cc b/wrenchboard/src/shared_tool/email.cc index 23b7b317..d632583d 100644 --- a/wrenchboard/src/shared_tool/email.cc +++ b/wrenchboard/src/shared_tool/email.cc @@ -15,6 +15,16 @@ extern int mailsend(CVars in, CVars &out); long getContractMemberClientEmail(long contract_id, CVars &out); +long plan_notification(CVars in, CVars &out){ +//wrenchboard=> SELECT id AS member_id, uid AS member_uid, 'alert.svg' AS icon FROM members WHERE username = 'ses66181+1@gmail.com'; +// member_id | member_uid | icon +//-----------+--------------------------------------+----------- +// 1 | 3119b744-42ad-4834-bb83-b737588754ca | alert.svg +//(1 row) + +} + + long alert_email(long mailtype, CVars in, CVars &out) { logfmt(logINFO, "alert_email()"); CVars x, y, z; @@ -225,7 +235,7 @@ long cron_email(long mailtype, CVars in, CVars &out) { break; case WRB_CRONJOB_PENDOFFER_ALERT: - vars2form(x, form); // need to remove + vars2form(x, form); // need to remove vars2form(in, form); form.LetStr("email", in["email"].c_str()); form.Email("REMINDER/offer_pending_reminder.mailfile"); diff --git a/wrenchboard/src/shared_tool/site_crons.cc b/wrenchboard/src/shared_tool/site_crons.cc index c44ae11f..f797534c 100644 --- a/wrenchboard/src/shared_tool/site_crons.cc +++ b/wrenchboard/src/shared_tool/site_crons.cc @@ -133,7 +133,6 @@ logfmt(logINFO, "ENTER OfferPending()"); long limit = in["one_limit"].Long(); long mode = REQ_LONG(in, "mode", 0, -1); - char extraQ[1600]; if ( mode == 100 ){ @@ -148,8 +147,8 @@ if ( mode == 300 ){ snprintf(extraQ, sizeof (extraQ), " WHERE jo.expire < now() +'6 hrs' AND jo.expire > now() AND jo.status = 1 AND jo.public_view =0 AND jo.reminder_count > 0 AND jo.reminder_date IS NOT NULL"); } -const PGresult *res = pgsql_query("SELECT jo.id AS offer_id,jo.added,j.title,jo.expire,jo.email, jo.client_id, " - "jo.job_id,jo.reminder_count,jo.reminder_date,jo.email AS firstname " +const PGresult *res = pgsql_query("SELECT jo.id AS offer_id,jo.added,j.title,jo.expire,to_char(jo.expire, 'Dy Mon dd, yyyy HH:MI AM') AS expire_formated, jo.email, jo.client_id, " + "jo.job_id,jo.reminder_count,jo.reminder_date,jo.email AS firstname, jo.email AS rec_username " "FROM members_jobs_offer jo " "LEFT JOIN members_jobs j ON j.id = jo.job_id " " %s LIMIT %lu ",extraQ, limit); @@ -161,16 +160,27 @@ const PGresult *res = pgsql_query("SELECT jo.id AS offer_id,jo.added,j.title,jo. CVars rec; map_to_cvars(f, rec); - cron_email(WRB_CRONJOB_PENDOFFER_ALERT, rec, out); // send the cron email - - pgsql_exec("UPDATE members_jobs_offer SET reminder_count=reminder_count+1, reminder_date=now() "\ - "WHERE id=%lu AND job_id=%lu ", rec["offer_id"].Long(),rec["job_id"].Long()); + cron_email(WRB_CRONJOB_PENDOFFER_ALERT, rec, out); // send the cron email + + pgsql_exec("UPDATE members_jobs_offer SET reminder_count=reminder_count+1, reminder_date=now() "\ + "WHERE id=%lu AND job_id=%lu ", rec["offer_id"].Long(),rec["job_id"].Long()); + + + CVars xy; + if ( load_db_record(xy, "SELECT id AS member_id, uid AS member_uid, 'alert.svg' AS icon " + " FROM members WHERE LOWER(username) = LOWER('%s') ",rec["rec_username"].c_str()) > 0 ){ + plan_notification(xy, out); + } + } } logfmt(logINFO, "/OfferPending()"); return 0; } + + + long InterestPending(CVars in, CVars &out) {