diff --git a/wrenchboard/src/shared_tool/site_crons.cc b/wrenchboard/src/shared_tool/site_crons.cc index 3eb57c0e..6fd8def1 100644 --- a/wrenchboard/src/shared_tool/site_crons.cc +++ b/wrenchboard/src/shared_tool/site_crons.cc @@ -40,6 +40,7 @@ long RefreshPromoActivities(CVars in, CVars &out); long RegisterPromoPoint(CVars in); long RegisterPromoAction(CVars in); long ReferEmailsCleanup(); +long ReferEmailsNotification(); /* CREATE TABLE cron_jobs ( @@ -278,7 +279,7 @@ long RefreshPromoActivities(CVars in, CVars &out){ } ReferEmailsCleanup(); // clean up account refer - + ReferEmailsNotification(); // end emsil if needed ret = PHP_API_OK; out["status"] = "OK"; } catch (bad_parameter) { @@ -289,12 +290,15 @@ long RefreshPromoActivities(CVars in, CVars &out){ } long ReferEmailsNotification(){ + long ret = PHP_API_BAD_PARAM; + const PGresult *res; + CVars out; res = pgsql_query(" SELECT id AS promo_id, a.firstname AS send_firstname,a.lastname AS send_lastname," " p.firstname,p.lastname, 'REFPROMO-'||p.uid AS refer_link , p.email " " FROM promo_member p " " LEFT JOIN promo_admin a ON a.id = p.admin_id " - " WHERE email_sent IS NULL LIMIT 20", in["promo"].c_str(), in["limit"].Long()); + " WHERE email_sent IS NULL AND status = 1 LIMIT 20", in["promo"].c_str(), in["limit"].Long()); if (res != NULL && pgsql_num_rows(res) > 0) { out["total_record"] = pgsql_num_rows(res); for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {