Ofer notification
This commit is contained in:
@@ -21,7 +21,48 @@ long plan_notification(CVars in, CVars &out){
|
||||
//-----------+--------------------------------------+-----------
|
||||
// 1 | 3119b744-42ad-4834-bb83-b737588754ca | alert.svg
|
||||
//(1 row)
|
||||
/*
|
||||
CREATE TABLE members_notification (
|
||||
id SERIAL,
|
||||
uid uuid DEFAULT uuid_generate_v4(),
|
||||
member_id INT REFERENCES members(id) NOT NULL,
|
||||
member_uid VARCHAR(150) NOT NULL,
|
||||
icon VARCHAR(25) DEFAULT 'alert.svg',
|
||||
msg VARCHAR(350) NOT NULL,
|
||||
status INT DEFAULT 1,
|
||||
added timestamp without time zone DEFAULT now(),
|
||||
send timestamp without time zone,
|
||||
send_result VARCHAR(15)
|
||||
);
|
||||
*/
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
try{
|
||||
REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_STRING(in, "member_uid", 20, 120, "(.*)");
|
||||
REQ_STRING(in, "msg", 2, 300, "(.*)");
|
||||
CVars x;
|
||||
|
||||
x["member_id"] = in["member_id"];
|
||||
x["member_id"].set_valid(true);
|
||||
x["member_uid"] = in["member_uid"];
|
||||
x["member_uid"].set_valid(true);
|
||||
|
||||
x["msg"] = in["msg"];
|
||||
x["msg"].set_valid(true);
|
||||
|
||||
if ( in["icon"] != ""){
|
||||
x["icon"] = in["icon"];
|
||||
x["icon"].set_valid(true);
|
||||
}
|
||||
|
||||
|
||||
ret = insert_db_record(DBS_VALID, "members_notification", "members_notification_id_seq", x);
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long plan_notification(CVars in, CVars &out)");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +169,8 @@ const PGresult *res = pgsql_query("SELECT jo.id AS offer_id,jo.added,j.title,jo.
|
||||
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 ){
|
||||
xy["msg"] = "You have received a new offer waiting for you to start!";
|
||||
xy["msg"].set_valid(true);
|
||||
plan_notification(xy, out);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user