POINT ADDED
This commit is contained in:
@@ -281,17 +281,52 @@ long RefreshPromoActivities(CVars in, CVars &out){
|
|||||||
}
|
}
|
||||||
|
|
||||||
long RegisterPromoPoint(CVars in){
|
long RegisterPromoPoint(CVars in){
|
||||||
|
/*
|
||||||
|
CREATE TABLE promo_points(
|
||||||
|
id SERIAL,
|
||||||
|
uid uuid DEFAULT uuid_generate_v4(),
|
||||||
|
admin_id INT REFERENCES promo_admin(id),
|
||||||
|
category VARCHAR(50) NOT NULL,
|
||||||
|
point INT DEFAULT 0,
|
||||||
|
added timestamp without time zone DEFAULT now()
|
||||||
|
);
|
||||||
|
ALTER TABLE ONLY promo_points
|
||||||
|
ADD CONSTRAINT promo_points_id_key UNIQUE (id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE promo_admin ADD points INT Default 0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
CVars yp;
|
long ret = PHP_API_BAD_PARAM;
|
||||||
yp["category"] ="SIGNUP_POINT";
|
//const PGresult *res;
|
||||||
yp["admin_id"] = in["admin_id"]; yp["admin_id"].set_valid( true );
|
CVars xx;
|
||||||
yp["description"] = "Sign up was completed";
|
try {
|
||||||
RegisterPromoAction(yp);
|
//long blog_id = REQ_LONG(in, "blog_id", 1, -1);
|
||||||
return 0;
|
REQ_STRING (in, "category", 5, 49, "(.*)");
|
||||||
|
long admin_id = REQ_LONG(in, "admin_id", 1, -1);
|
||||||
|
long points = REQ_LONG(in, "points", 1, -1);
|
||||||
|
|
||||||
|
xx["category"] = in["category"]; xx["category"].set_valid( true );
|
||||||
|
xx["point"] = in["points"]; xx["point"].set_valid( true );
|
||||||
|
xx["admin_id"] = in["admin_id"]; xx["admin_id"].set_valid( true );
|
||||||
|
long point_id = insert_db_record(DBS_VALID, "promo_points", "promo_points_id_seq", xx);
|
||||||
|
if( point_id > 0 ){
|
||||||
|
pgsql_query("UPDATE promo_admin SET points= points + %lu WHERE id = %lu ", in["points"].Long(), in["admin_id"].Long());
|
||||||
|
CVars yp;
|
||||||
|
yp["category"] ="SIGNUP_POINT";
|
||||||
|
yp["admin_id"] = in["admin_id"]; yp["admin_id"].set_valid( true );
|
||||||
|
yp["description"] = "Sign up was completed";
|
||||||
|
RegisterPromoAction(yp);
|
||||||
|
|
||||||
|
ret = PHP_API_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (bad_parameter) {
|
||||||
|
logfmt(logINFO, "ERROR CALL long RegisterPromoAction(CVars in, CVars &out)");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
long RegisterPromoAction(CVars in){
|
long RegisterPromoAction(CVars in){
|
||||||
|
|||||||
Reference in New Issue
Block a user