recent_data
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#ifndef __mx_recent_data_h__
|
||||
#define __mx_recent_data_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long WrenchRecentDash(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "sel_data.h"
|
||||
#include "history.h"
|
||||
#include "recent_data.h";
|
||||
|
||||
#include "jobs.h"
|
||||
#include "reco_engine.h" //error in file name
|
||||
@@ -472,7 +473,7 @@ long account_calls(CVars in, CVars &out) {
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_ACCOUNT_DASHRECENT:
|
||||
logfmt(logINFO, "ENTER CALL long WRENCHBOARD_ACCOUNT_DASHRECENT");
|
||||
return WrenchRecentDash(in, out);
|
||||
break;
|
||||
}
|
||||
logfmt(logINFO, "/account_calls()");
|
||||
|
||||
@@ -0,0 +1,772 @@
|
||||
// Twillo management toosl
|
||||
#include "clog.h"
|
||||
#include "cgi.h"
|
||||
#include "input.h"
|
||||
#include "wrenchboard_api.h"
|
||||
#include "reco_engine.h" //error in file name
|
||||
#include "email.h"
|
||||
#include "safestring.h"
|
||||
#include <string>
|
||||
#include "pgsql.h"
|
||||
#include "pgsql_wrapper.h"
|
||||
#include <curl/curl.h>
|
||||
#include "account.h"
|
||||
#include "cards.h"
|
||||
#include "twilo.h"
|
||||
#include "mobile.h"
|
||||
#include "recent_data.h";
|
||||
|
||||
/*
|
||||
#define RECOMMEND_COUPON 1000
|
||||
#define RECOMMEND_BLOG 1005
|
||||
#define RECOMMEND_NEWTASK 1010
|
||||
#define RECOMMEND_TOKEN 1015
|
||||
#define RECOMMEND_OFFERS 1020
|
||||
//========================
|
||||
*/
|
||||
long sendOffersRecommendation( CVars in, CVars &out);
|
||||
long sendCouponRecommendation( CVars in, CVars &out);
|
||||
|
||||
long RecoCheckOffers( int itm_count, CVars in, CVars &out );
|
||||
long RecoCheckFamilyLogin( int itm_count, CVars in, CVars &out );
|
||||
long RecoCheckFamilyCount( int itm_count, CVars in, CVars &out );
|
||||
long RecoCheckCoupons( int itm_count, CVars in, CVars &out );
|
||||
long RecoCheckTaskDue( int itm_count, CVars in, CVars &out );
|
||||
long RecoCheckTaskReview( int itm_count, CVars in, CVars &out );
|
||||
long RecoCheckBlog( int itm_count, CVars in, CVars &out );
|
||||
long RecoOffersInterest( int itm_count, CVars in, CVars &out );
|
||||
long RecoReferAFreind(int itm_count, CVars in, CVars &out );
|
||||
long RecoPendingInterestCount( int itm_count, CVars in, CVars &out );
|
||||
|
||||
|
||||
|
||||
// also used from accounts
|
||||
long WrenchRecentDash(CVars in, CVars &out){
|
||||
out["status"] = "long WrenchHomeBanners(CVars in, CVars &out)";
|
||||
CVars offV;
|
||||
char vname[30];
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
int itm_count= 0;
|
||||
if( RecoCheckOffers( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoPendingInterestCount( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoCheckFamilyLogin( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoCheckFamilyCount( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoCheckCoupons( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoCheckTaskReview( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoCheckTaskDue( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoOffersInterest( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
if( RecoReferAFreind( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
|
||||
out["total_record"] = itm_count;
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
long RecoOffersInterest(int itm_count, CVars in, CVars &out ){
|
||||
logfmt(logINFO, "RecoOffersInterest()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query(" SELECT mo.* FROm members_offer_interest mo LEFT JOIN members_jobs_offer mj ON mj.id= mo.offer_id"
|
||||
" WHERE mj.member_id = %lu AND mj.expire > now()",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Users are interested in some of your job(s)";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "Some users are interested in your job(s).";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "OFFERS";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="URL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "offer-interest";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "View now";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Interest Pending";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "Some users are interested in your job(s)";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style ly";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoOffersInterest()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoCheckOffers(int itm_count, CVars in, CVars &out ){
|
||||
logfmt(logINFO, "RecoCheckOffers()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT * FROM members_jobs_offer WHERE expire > now() AND status = 1 AND client_id > 0 AND client_id = %lu ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Some offers are waiting for you.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "You have received some offers. View, accept, or reject before the offer(s) expire.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "OFFERS";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="banner-waiting.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="LOCAL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "mytask";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "short_button_text";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Some offers are waiting for you.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = " View, accept, or reject before the offer(s) expire";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckOffers()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoCheckFamilyLogin(int itm_count, CVars in, CVars &out ){
|
||||
//SELECT count(id) AS family_count FROM members_family WHERE member_id =1 AND status = 1 AND last_login IS NULL ;
|
||||
logfmt(logINFO, "RecoCheckFamilyLogin()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT id FROM members_family WHERE member_id = %lu AND status = 1 AND last_login IS NULL ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Some family accounts are yet to log in.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "Help your team remember their account information. Assign tasks.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "FAMILY_NOLOGIN";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="URL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "acc-family";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "View Now";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Some family accounts are yet to log in";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "Help your team remember their account information.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckFamilyLogin()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoReferAFreind(int itm_count, CVars in, CVars &out ){
|
||||
logfmt(logINFO, "RecoOffersInterest()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query(" SELECT id FROm members "
|
||||
" WHERE id = %lu ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Share WrenchBoard with a friend.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "Show this to a friend and earn free coupons. Get started.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "OFFERS";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="banner-refer.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="LOCAL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "referral";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "View now";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Refer A Friend";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "Share WrenchBoard with a friend.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style by";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoReferAFreind()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
long RecoPendingInterestCount( int itm_count, CVars in, CVars &out ){
|
||||
//SELECT count(id) AS family_count FROM members_family WHERE member_id =1 AND status = 1 AND last_login IS NULL ;
|
||||
logfmt(logINFO, "RecoCheckFamilyCount()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT moi.*,mjo.expire FROM members_offer_interest moi LEFT JOIN members_jobs_offer mjo ON mjo.id = moi.offer_id "
|
||||
" LEFT JOIN members_jobs j ON j.id= mjo.job_id "
|
||||
" WHERE moi.member_id = %lu AND mjo.expire > now() AND j.status= 1",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "You are waiting for feedback.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "You have shown interest in a few tasks and are waiting for confirmation to start.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "PEND_INTEREST";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="URL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "pend-interest";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "Details";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "You are waiting for feedback.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "You are waiting for confirmation to start.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style lb";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoPendingInterestCount()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoCheckFamilyCount( int itm_count, CVars in, CVars &out ){
|
||||
//SELECT count(id) AS family_count FROM members_family WHERE member_id =1 AND status = 1 AND last_login IS NULL ;
|
||||
logfmt(logINFO, "RecoCheckFamilyCount()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT count(id) AS family_count FROM members_family WHERE member_id = %lu AND status = 1 ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) == 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Activate your family account.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "Add Kids, family, set, manage goals, and reward them.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "FAMILY_ADD";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="URL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "acc-family";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "short_button_text";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Activate your family account.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "Add Kids, family, set, manage goals, and reward them. ";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style lb";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckFamilyCount()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoCheckCoupons( int itm_count, CVars in, CVars &out ){
|
||||
//SELECT id AS coupons_count FROM coupons_allocation WHERE member_id =1 AND amount> 0 AND active IS NULL;
|
||||
logfmt(logINFO, "RecoCheckCoupons()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT id AS coupons_count FROM coupons_allocation WHERE member_id = %lu AND amount> 0 AND active IS NULL ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Yo man , you have Coupons to play with";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "his is the family not login text DESCRIPTIOON - This is the offer available text";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "COUPONS";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="banner-coupons.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="LOCAL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "my-coupon";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "Continue";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "Redeem";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Free Cash";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "You have received cash coupon waiting to be redeemed";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style lg";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckCoupons()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoCheckTaskDue( int itm_count, CVars in, CVars &out ){
|
||||
logfmt(logINFO, "RecoCheckTaskDue()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT * FROM members_jobs_contract WHERE member_id = %lu AND status =1 AND delivery_date < now() ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Some of your task as owner of the tasks are due ";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "Some of your task as owner of the tasks are due, Some of your task as owner of the tasks are due";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "PASTDUEJOB";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="banner-job-due.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="LOCAL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "my-pastdue-jobs";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "View Tasks";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "View";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Past Due Tasks";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "Some of you task are now past due";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style lr";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckTaskDue()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RecoCheckTaskReview( int itm_count, CVars in, CVars &out ){
|
||||
logfmt(logINFO, "RecoCheckTaskReview()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
res = pgsql_query("SELECT * FROM members_jobs_contract WHERE member_id = %lu AND status = 4 ",member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = "Some of your task as owner Need Review now ";
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = "Some of your task as owner Need Review now,Some of your task as owner Need Review now, S Need Review now";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "REVIEWJOB";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = "0";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] ="banner-job-due.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="LOCAL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "my-review-jobs";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "View Tasks";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "Start Review";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = "Review Ready Tasks";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] = "Some of your jobs are waiting for approval ";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style lr";
|
||||
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckTaskReview()");
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
long RecoCheckBlog( int itm_count, CVars in, CVars &out ){
|
||||
logfmt(logINFO, "RecoCheckBlog()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
char vname[30];
|
||||
try {
|
||||
|
||||
// SELECT title,id,banner FROM blog_selections ORDER BY RANDOM() LIMIT 1;
|
||||
// title | id | banner
|
||||
// -------------------------------------------------+----+----------------------------------------------------------------------------
|
||||
// ime and price management when working an online | 3 | https://blog.wrenchboard.com/wp-content/uploads/2022/01/time_manageent.jpg
|
||||
|
||||
load_db_record( out, "SELECT title,id,banner,blog_id FROM blog_selections ORDER BY RANDOM() LIMIT 1 ");
|
||||
|
||||
int ic = itm_count;
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
|
||||
snprintf(vname, sizeof (vname), "title_%05d", ic);
|
||||
out[vname] = out["title"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", ic);
|
||||
out[vname] = out["title"]; //"The similarity index is a term you should be familiar with as an online writer. It is defined as the composite number that is highlighted after matching two texts to determine how similar the content from both pieces is.";
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_type_%05d", ic);
|
||||
out[vname] = "BLOG";
|
||||
|
||||
snprintf(vname, sizeof (vname), "offer_id_%05d", ic);
|
||||
out[vname] = out["id"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "blog_id_%05d", ic);
|
||||
out[vname] = out["blog_id"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "card_icon_%05d", ic);
|
||||
out[vname] = "icon1";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_%05d", ic);
|
||||
out[vname] = out["banner"]; //"https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg";
|
||||
|
||||
snprintf(vname, sizeof (vname), "banner_location_%05d", ic);
|
||||
out[vname] ="URL";
|
||||
|
||||
snprintf(vname, sizeof (vname), "link_path_%05d", ic);
|
||||
out[vname] = "blog-page";
|
||||
|
||||
snprintf(vname, sizeof (vname), "button_text_%05d", ic);
|
||||
out[vname] = "View Article";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
|
||||
out[vname] = "Read Now";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
|
||||
out[vname] = out["title"]; //"Article - Similarity Index";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
|
||||
out[vname] =out["title"]; // "Similarity index is a term you should be familiar with as an online writer";
|
||||
|
||||
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
|
||||
out[vname] = "short_style";
|
||||
|
||||
|
||||
ret = PHP_API_OK;
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
logfmt(logINFO, "/RecoCheckBlog()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long sendOffersRecommendation( CVars in, CVars &out){
|
||||
|
||||
try{
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_LONG(in, "offer_id", 1, -1);
|
||||
|
||||
if ( load_db_record(out, "SELECT client_id FROM members_jobs_offer WHERE id=%lu", in["offer_id"].Long())> 0){
|
||||
CVars xx;
|
||||
CVars xout;
|
||||
xx["action"] = WRENCHBOARD_CARDS_CREATECARD; xx["action"].set_valid( true );
|
||||
xx["member_id"] = out["client_id"]; xx["member_id"].set_valid( true ); // the card is going to job recipient
|
||||
xx["title"] = "New job offer"; xx["title"].set_valid( true );
|
||||
xx["description"] = "You have received a new Task/Job offer"; xx["description"].set_valid( true );
|
||||
xx["card_type"] = "OFFERS"; xx["card_type"].set_valid( true );
|
||||
xx["card_style"] = "card2"; xx["card_style"].set_valid( true );
|
||||
xx["card_icon"] = "icon1"; xx["card_icon"].set_valid( true );
|
||||
xx["offer_id"] = in["offer_id"]; xx["offer_id"].set_valid( true );
|
||||
xx["blog_id"] = "0"; xx["blog_id"].set_valid( true );
|
||||
card_calls(xx, xout);
|
||||
}
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long sendCouponRecommendation");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long sendCouponRecommendation( CVars in, CVars &out){
|
||||
/*
|
||||
CVars xx;
|
||||
xx["member_id"] = in["member_id"]; xx["member_id"].set_valid(true);
|
||||
xx["code"] = rec["code"]; xx["code"].set_valid(true);
|
||||
xx["amount"] = rec["amount"]; xx["amount"].set_valid(true);
|
||||
xx["status"] = COUPON_ACTIVE; xx["status"].set_valid(true);
|
||||
coupon_id = insert_db_record(DBS_VALID, "coupons_allocation", "coupons_allocation_id_seq", xx);
|
||||
|
||||
['title'=>'This is your coupon',
|
||||
'description'=>'This is the description of the description',
|
||||
'card_type'=>'COUPON',
|
||||
'card_style' =>'card1',
|
||||
'card_icon' =>'icon1',
|
||||
'assign_id'=> 0,
|
||||
*/
|
||||
|
||||
try{
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_LONG(in, "coupon_id", 1, -1);
|
||||
|
||||
CVars xx;
|
||||
CVars xout;
|
||||
xx["action"] = WRENCHBOARD_CARDS_CREATECARD; xx["action"].set_valid( true );
|
||||
xx["member_id"] = member_id; xx["member_id"].set_valid( true );
|
||||
xx["title"] = "This is your coupon"; xx["title"].set_valid( true );
|
||||
xx["description"] = "Click to redeem your coupon to your account"; xx["description"].set_valid( true );
|
||||
xx["card_type"] = "COUPON"; xx["card_type"].set_valid( true );
|
||||
xx["card_style"] = "card1"; xx["card_style"].set_valid( true );
|
||||
xx["card_icon"] = "icon1"; xx["card_icon"].set_valid( true );
|
||||
xx["blog_id"] = "0"; xx["blog_id"].set_valid( true );
|
||||
xx["offer_id"] = "0"; xx["offer_id"].set_valid( true );
|
||||
card_calls(xx, xout);
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long sendCouponRecommendation");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user