category description
This commit is contained in:
@@ -23,6 +23,7 @@ long WrenchPromoAddList(CVars in, CVars &out);
|
||||
long WrenchPromoGetList( CVars in, CVars &out );
|
||||
long WrenchPromoGetMember( CVars in, CVars &out );
|
||||
long WrenchPromoAssignTask( CVars in, CVars &out );
|
||||
long WrenchPromoActionList( CVars in, CVars &out );
|
||||
|
||||
long market_calls(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "market_calls()");
|
||||
@@ -51,6 +52,10 @@ long market_calls(CVars in, CVars &out) {
|
||||
case WRENCHBOARD_PROMOADMIN_GETLIST:
|
||||
return WrenchPromoGetList(in, out);
|
||||
break;
|
||||
//#define 220016
|
||||
case WRENCHBOARD_PROMOADMIN_ACTIONLIST:
|
||||
return WrenchPromoActionList(in, out);
|
||||
break;
|
||||
case WRENCHBOARD_PROMOADMIN_GETMEMBER:
|
||||
return WrenchPromoGetMember(in, out);
|
||||
break;
|
||||
@@ -66,6 +71,67 @@ long market_calls(CVars in, CVars &out) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
long WrenchPromoActionList( CVars in, CVars &out )
|
||||
{
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
logfmt( logINFO, "WrenchPromoActionList()" );
|
||||
out["result"] = "Yes i go to this back end";
|
||||
|
||||
try {
|
||||
long admin_id = REQ_LONG(in, "promo_admin_id", 1, -1);
|
||||
REQ_STRING (in, "admin_uid", 5, 120, "(.*)");
|
||||
OPTIONAL( in, "loc" ) REQ_STRING (in, "loc", 3, 15, "(.*)");
|
||||
long limit = REQ_LONG(in, "limit", 1, -1);
|
||||
long offset = REQ_LONG(in, "offset", 1, -1);
|
||||
|
||||
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT count(id) FROM promo_actions WHERE admin_id = %lu", admin_id);
|
||||
out["sum_total_record"] = pgsql_num_rows(res);
|
||||
|
||||
res = pgsql_query("SELECT * FROM promo_member"
|
||||
" WHERE admin_id = %lu ORDER BY id DESC LIMIT %lu OFFSET %lu ",admin_id,limit,offset);
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
out["total_record"] = pgsql_num_rows(res);
|
||||
|
||||
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);
|
||||
|
||||
snprintf(vname, sizeof (vname), "updated_%05d", i);
|
||||
out[vname] = rec["updated"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "uid_%05d", i);
|
||||
out[vname] = rec["uid"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "added_%05d", i);
|
||||
out[vname] = rec["added"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "category_%05d", i);
|
||||
out[vname] = rec["category"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "description_%05d", i);
|
||||
out[vname] = rec["description"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "status_%05d", i);
|
||||
out[vname] = rec["status"];
|
||||
}
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long WrenchPromoActionList(CVars in, CVars &out)");
|
||||
}
|
||||
|
||||
logfmt( logINFO, "/WrenchPromoActionList()" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
long WrenchPromoAssignTask( CVars in, CVars &out )
|
||||
{
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
Reference in New Issue
Block a user