assign taskn
This commit is contained in:
@@ -1610,6 +1610,7 @@ long WrenchSendJobsOfferGroup(CVars in, CVars &out) {
|
|||||||
REQ_LONG(in, "group_id", 1, -1);
|
REQ_LONG(in, "group_id", 1, -1);
|
||||||
//REQ_STRING (in, "email", 1, 59, "(.*)");
|
//REQ_STRING (in, "email", 1, 59, "(.*)");
|
||||||
REQ_STRING(in, "job_description", 1, 5000, "(.*)");
|
REQ_STRING(in, "job_description", 1, 5000, "(.*)");
|
||||||
|
long bypass = REQ_LONG(in, "bypass", 1, -1);
|
||||||
|
|
||||||
srand((unsigned) time(NULL));
|
srand((unsigned) time(NULL));
|
||||||
int r = rand();
|
int r = rand();
|
||||||
@@ -1676,7 +1677,7 @@ long WrenchSendJobsOfferGroup(CVars in, CVars &out) {
|
|||||||
|
|
||||||
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long() * total_member, z["amount"].Long());
|
logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long() * total_member, z["amount"].Long());
|
||||||
|
|
||||||
if (total_member > 2 ){
|
if (total_member > 2 && bypass == 0 ){
|
||||||
// REQ_LONG(in, "member_id", 1, -1);
|
// REQ_LONG(in, "member_id", 1, -1);
|
||||||
// REQ_LONG(in, "job_id", 1, -1);
|
// REQ_LONG(in, "job_id", 1, -1);
|
||||||
// REQ_LONG(in, "group_id", 1, -1);
|
// REQ_LONG(in, "group_id", 1, -1);
|
||||||
|
|||||||
@@ -131,7 +131,43 @@ return 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
long ProcessGroupJobs(CVars in, CVars &out){
|
long ProcessGroupJobs(CVars in, CVars &out){
|
||||||
|
long ret = 0;
|
||||||
|
long limit = in["limit"].Long();
|
||||||
|
logfmt(logINFO, "ENTER ProcessGroupJobs()");
|
||||||
|
long push_ret = -1;
|
||||||
|
long status = 0;
|
||||||
|
CVars outx;
|
||||||
|
|
||||||
|
const PGresult *res = pgsql_query("SELECT * FROM group_offer_schedule WHERE status = 0 ORDER BY ID ASC 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);
|
||||||
|
|
||||||
|
pgsql_query("UPDATE group_offer_schedule SET status= 1 "
|
||||||
|
" WHERE id = %lu AND uid = '%s'", rec["id"].Long(),rec["uid"].c_str()); // move the status so no retry
|
||||||
|
|
||||||
|
if ( load_db_record(outx, "SELECT * FROM group_offer_schedule "
|
||||||
|
" WHERE status = 1 AND uid = '%s' ORDER BY id DESC LIMIT 1", rec["uid"].c_str())> 0){
|
||||||
|
|
||||||
|
pgsql_query("UPDATE group_offer_schedule SET status= 2 "
|
||||||
|
" WHERE id = %lu AND uid = '%s'", rec["id"].Long(),rec["uid"].c_str()); // move the status so no retry
|
||||||
|
|
||||||
|
CVars xx;
|
||||||
|
xx["bypass"] = "1000";
|
||||||
|
xx["member_uid"] = outx["member_id"]; xx["member_id"].set_valid( true );
|
||||||
|
xx["job_id"] = outx["job_id"]; xx["job_id"].set_valid( true );
|
||||||
|
xx["group_id"] = outx["group_id"]; xx["group_id"].set_valid( true );
|
||||||
|
xx["job_description"] = outx["job_description"]; xx["job_description"].set_valid( true );
|
||||||
|
WrenchSendJobsOfferGroup( xx, out);
|
||||||
|
|
||||||
|
pgsql_query("UPDATE group_offer_schedule SET completed=now(), notes='%s', status= 5 "
|
||||||
|
" WHERE id = %lu AND uid='%s'",out["status_msg"].c_str(), rec["id"].Long(),rec["uid"].c_str() );
|
||||||
|
}
|
||||||
|
} // for loopp
|
||||||
|
} // main nserach
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class WrenchApi extends BaseController
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'assigntask':
|
case 'assigntask':
|
||||||
|
$in["bypass"] = 0;
|
||||||
$in["action"] = WRENCHBOARD_JOB_OFFER_SYSTEM;
|
$in["action"] = WRENCHBOARD_JOB_OFFER_SYSTEM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user