notification start
This commit is contained in:
@@ -23,10 +23,7 @@ img {height: auto;}
|
|||||||
.footercopy {font-family: sans-serif; font-size: 14px; color: #ffffff;}
|
.footercopy {font-family: sans-serif; font-size: 14px; color: #ffffff;}
|
||||||
.footercopy a {color: #ffffff; text-decoration: underline;}
|
.footercopy a {color: #ffffff; text-decoration: underline;}
|
||||||
</style>
|
</style>
|
||||||
+6666666666666666
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body yahoo bgcolor="#f6f8f1">
|
<body yahoo bgcolor="#f6f8f1">
|
||||||
<table width="100%" bgcolor="#f6f8f1" border="0" cellpadding="0" cellspacing="0">
|
<table width="100%" bgcolor="#f6f8f1" border="0" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
long bko_calls(CVars in, CVars &out);
|
long bko_calls(CVars in, CVars &out);
|
||||||
long LoginBkoAdmin(CVars in, CVars &out);
|
long LoginBkoAdmin(CVars in, CVars &out);
|
||||||
|
long BkoSendPush(CVars in, CVars &out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ enum { PARTNER_STRIPE };
|
|||||||
#define WRB_CRONJOB_PASTDUE_ALERT 774
|
#define WRB_CRONJOB_PASTDUE_ALERT 774
|
||||||
#define WRB_CRONJOB_OFFER_REFUND_ALERT 775
|
#define WRB_CRONJOB_OFFER_REFUND_ALERT 775
|
||||||
#define WRB_CRONJOB_PENDOFFER_ALERT 776
|
#define WRB_CRONJOB_PENDOFFER_ALERT 776
|
||||||
|
#define WRB_CRONJOB_NOTIFICATIONS 777
|
||||||
|
|
||||||
//**************************************************************
|
//**************************************************************
|
||||||
#define WRENCHBOARD_BKO_START 10000
|
#define WRENCHBOARD_BKO_START 10000
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
long BkoCommonSessionCheck(long backoffice_id,long shop,long acc, const char *sessionid, int create );
|
long BkoCommonSessionCheck(long backoffice_id,long shop,long acc, const char *sessionid, int create );
|
||||||
long BkoResendOffer(CVars in, CVars &out);
|
long BkoResendOffer(CVars in, CVars &out);
|
||||||
long BkoSendPush(CVars in, CVars &out);
|
|
||||||
long BkoResendMarketing(CVars in, CVars &out);
|
long BkoResendMarketing(CVars in, CVars &out);
|
||||||
|
|
||||||
struct MemoryStruct {
|
struct MemoryStruct {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ long SignUpPendingReminder(CVars in, CVars &out);
|
|||||||
long SignUpStats(CVars in, CVars &out);
|
long SignUpStats(CVars in, CVars &out);
|
||||||
long PastDueWarings(CVars in, CVars &out);
|
long PastDueWarings(CVars in, CVars &out);
|
||||||
long PastDueOffersRefund(CVars in, CVars &out);
|
long PastDueOffersRefund(CVars in, CVars &out);
|
||||||
|
long NotificationSystem(CVars in, CVars &out);
|
||||||
long CronTracker(CVars in, CVars &out);
|
long CronTracker(CVars in, CVars &out);
|
||||||
/*
|
/*
|
||||||
CREATE TABLE cron_jobs (
|
CREATE TABLE cron_jobs (
|
||||||
@@ -90,12 +90,66 @@ long sitecrons_calls(CVars in, CVars &out) {
|
|||||||
return OfferPending(in, out);
|
return OfferPending(in, out);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WRB_CRONJOB_NOTIFICATIONS:
|
||||||
|
ct["job_type"]="WRB_CRONJOB_PENDOFFER_ALERT"; ct["job_type"].set_valid( true );
|
||||||
|
ct["description"]="Offer is pending remind the client to attend to it before it expires "; ct["description"].set_valid( true );
|
||||||
|
CronTracker(ct, co);
|
||||||
|
return NotificationSystem(in, out);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logfmt(logINFO, "/sitecrons_calls()");
|
logfmt(logINFO, "/sitecrons_calls()");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long NotificationSystem(CVars in, CVars &out){
|
||||||
|
long ret = 0;
|
||||||
|
const PGresult *res;
|
||||||
|
long limit = in["one_limit"].Long();
|
||||||
|
logfmt(logINFO, "ENTER NotificationSystem()");
|
||||||
|
long contract_id = 0;
|
||||||
|
const PGresult *res = pgsql_query("SELECT count(member_uid) AS mcount,member_uid "
|
||||||
|
" FROM members_notification WHERE status=1 GROUP BY member_uid LIMIT %lu",limit);
|
||||||
|
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||||
|
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
|
||||||
|
map<const char*, const char*>f = pgsql_fetch_assoc(res, i);
|
||||||
|
if (f.empty()) continue;
|
||||||
|
CVars rec;
|
||||||
|
map_to_cvars(f, rec);
|
||||||
|
/*
|
||||||
|
wrenchboard=> SELECT uid,member_uid,msg FROM members_notification WHERE status =1 AND member_uid = '7b66905e-b2c4-4ae3-9b32-83aa50d4d0f5' ORDER BY id DESC LIMIT 1;
|
||||||
|
uid | member_uid | msg
|
||||||
|
--------------------------------------+--------------------------------------+---------------------------------------------------------
|
||||||
|
40a675fc-8073-4fb7-8b81-2fa699779e54 | 7b66905e-b2c4-4ae3-9b32-83aa50d4d0f5 | You have received a new offer waiting for you to start!
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
*/
|
||||||
|
if ( load_db_record(out, "SELECT id AS notification_id, uid,member_uid,msg FROM members_notification "
|
||||||
|
" WHERE status =1 AND member_uid = '%s' ORDER BY id DESC LIMIT 1", rec["member_uid"].c_str())> 0){
|
||||||
|
|
||||||
|
CVars xx;
|
||||||
|
xx["member_uid"] = out["member_uid"]; xx["member_uid"].set_valid( true );
|
||||||
|
xx["push_text"] = out["msg"]; xx["push_text"].set_valid( true );
|
||||||
|
long push_ret = BkoSendPush( xx, out);
|
||||||
|
|
||||||
|
if (push_ret == PHP_API_OK){
|
||||||
|
xx["send_result"] = "COMPLETED"; xx["send_result"].set_valid( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xx["send_result"] = "FAIL"; xx["send_result"].set_valid( true );
|
||||||
|
}
|
||||||
|
pgsql_query("UPDATE members_notification SET send=now(), send_result='%s' WHERE id = %lu", out["notification_id"].Long(),xx["send_result"].c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
long CronTracker(CVars in, CVars &out){
|
long CronTracker(CVars in, CVars &out){
|
||||||
long ret = 0;
|
long ret = 0;
|
||||||
const PGresult *res;
|
const PGresult *res;
|
||||||
|
|||||||
Reference in New Issue
Block a user