added blog filter
This commit is contained in:
@@ -168,6 +168,7 @@ enum { PARTNER_STRIPE };
|
||||
#define WRB_CRONJOB_SCHEULETRANSFER 780
|
||||
#define WRB_CRONJOB_PROCESSTRANSFER 781
|
||||
#define WRB_CRONJOB_APPEMAILS 782
|
||||
#define WRB_CRONJOB_REFRESHBLOG 783
|
||||
|
||||
#define WRB_CRONJOB_AUTO_OFFEREXPIRE 785
|
||||
#define WRB_CRONJOB_HOLIDAY_BROADCAST 786
|
||||
|
||||
@@ -34,6 +34,7 @@ long ScheduleTransferJobs(CVars in, CVars &out);
|
||||
long TestNotificationsJobs(CVars in, CVars &out);
|
||||
long ProcessExpiredOffers(CVars in, CVars &out);
|
||||
long ScheduleHolidayJobs(CVars in, CVars &out);
|
||||
long RefreshBlogs(CVars in, CVars &out);
|
||||
|
||||
/*
|
||||
CREATE TABLE cron_jobs (
|
||||
@@ -163,6 +164,14 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
CronTracker(ct, co);
|
||||
return CronSendMail(in, out);
|
||||
break;
|
||||
|
||||
case WRB_CRONJOB_REFRESHBLOG:
|
||||
ct["job_type"]="WRB_CRONJOB_REFRESHBLOG"; ct["job_type"].set_valid( true );
|
||||
ct["description"]="Refresh Blog"; ct["description"].set_valid( true );
|
||||
CronTracker(ct, co);
|
||||
return RefreshBlogs(in, out);
|
||||
break;
|
||||
|
||||
// define('WRB_CRONJOB_APPEMAILS', 782);
|
||||
}
|
||||
|
||||
@@ -170,6 +179,40 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RefreshBlogs(CVars in, CVars &out){
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
CVars xx;
|
||||
try {
|
||||
long blog_id = REQ_LONG(in, "blog_id", 1, -1);
|
||||
REQ_STRING (in, "banner", 5, 149, "(.*)");
|
||||
REQ_STRING (in, "title", 5, 149, "(.*)");
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT * FROM blog_selections WHERE blog_id = %lu", blog_id);
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
xx["title"] = in["title"]; xx["title"].set_valid( true );
|
||||
xx["banner"] = in["banner"]; xx["banner"].set_valid( true );
|
||||
update_db_record(DBS_VALID, "members_detail", xx, blog_id);
|
||||
}
|
||||
else{
|
||||
xx["blog_id"] = in["blog_id"]; xx["blog_id"].set_valid( true );
|
||||
xx["title"] = in["title"]; xx["title"].set_valid( true );
|
||||
xx["banner"] = in["banner"]; xx["banner"].set_valid( true );
|
||||
blog_id = insert_db_record(DBS_VALID, "blog_selections", "blog_selections_id_seq", xx);
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long RefreshBlogs(CVars in, CVars &out)");
|
||||
}
|
||||
logfmt(logINFO, "/RefreshBlogs()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long ScheduleHolidayJobs(CVars in, CVars &out){
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
@@ -14,6 +14,7 @@ define('WRB_CRONJOB_TESTNOTIFICATIONS', 779);
|
||||
define('WRB_CRONJOB_SCHEULETRANSFER', 780);
|
||||
define('WRB_CRONJOB_PROCESSTRANSFER', 781);
|
||||
define('WRB_CRONJOB_APPEMAILS', 782);
|
||||
define('WRB_CRONJOB_REFRESHBLOG', 783);
|
||||
|
||||
define('WRB_CRONJOB_AUTO_OFFEREXPIRE', 785);
|
||||
define('WRB_CRONJOB_HOLIDAY_BROADCAST', 786);
|
||||
@@ -224,6 +225,16 @@ class AirFlow extends BaseController
|
||||
$res1= $rawData['payload']; //[0]['payload'];
|
||||
$this->saveCache($endpoint,$res1);
|
||||
}
|
||||
|
||||
$in['action'] = WRB_JOB_CRONJOB;
|
||||
$in['call_action'] = WRB_CRONJOB_REFRESHBLOG;
|
||||
|
||||
|
||||
foreach ( $out['payload']['blograndom'] AS $item){
|
||||
$item['action'] = WRB_JOB_CRONJOB;
|
||||
$item['call_action'] = WRB_CRONJOB_REFRESHBLOG;
|
||||
$ret_update = (new \App\Models\BackendModel())->wrenchboard_api($item, $outX);
|
||||
}
|
||||
log_message('critical', "AirFlow::flowRefreshBlog ********* ALL ".serialize($in) );
|
||||
return []; //json_encode( $final_out );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user