diff --git a/wrenchboard/src/shared_tool/family_acc.cc b/wrenchboard/src/shared_tool/family_acc.cc index 7d2f8a1b..432ff86a 100644 --- a/wrenchboard/src/shared_tool/family_acc.cc +++ b/wrenchboard/src/shared_tool/family_acc.cc @@ -145,12 +145,14 @@ long WrenchRelativesSettings(CVars in, CVars &out){ try{ REQ_STRING(in, "uid", 3, 150, "(.*)"); REQ_STRING(in, "relative_uid", 3, 150, "(.*)"); + out["total_kid"] ="0"; load_db_record(out, "SELECT id AS member_id FROM members WHERE uid::text = '%s' ", in["uid"].c_str()); if ( out["member_id"].Long() > 0) { res = pgsql_query("SELECT * FROM family_relative_kids WHERE relative_uid::text = '%s'::text AND member_id=%lu AND add_status > 0", in["relative_uid"].c_str(),out["member_id"].Long() ); if (res != NULL && pgsql_num_rows(res) > 0) { + out["total_kid"] = && pgsql_num_rows(res); for (int i = 0, n = pgsql_num_rows(res); i < n; i++) { mapf = pgsql_fetch_assoc(res, i); CVars rec; @@ -160,6 +162,8 @@ long WrenchRelativesSettings(CVars in, CVars &out){ out[vname] = rec["uid"]; } } + ret = PHP_API_OK; + out["status"] = "OK"; } } catch (bad_parameter) { logfmt(logINFO, "ERROR CALL long WrenchRelativesSettings"); diff --git a/www-api/app/Models/ResultFormatter.php b/www-api/app/Models/ResultFormatter.php index 5f30aeee..f83dd350 100644 --- a/www-api/app/Models/ResultFormatter.php +++ b/www-api/app/Models/ResultFormatter.php @@ -291,6 +291,20 @@ class ResultFormatter extends Model ); } break; + case WRENCHBOARD_RELATIVES_SETTINGS: + $total = $out["total_kid"]; + $res = array( + "status" => $out["status"], + "internal_return" => $out["internal_return"], + "kids_list" => array(), + ); + for ($i = 0; $i < $total; $i++) { + $key = sprintf("%05d", $i); + $res["kids_list"][] = array( + "family_uid" => $out["family_uid_${key}"] + ); + } + break; case WRENCHBOARD_FAMILY_SAMPLETASKS: $total = $out["total_record"]; $res = array(