From ee9225ec7844855dfed1c6bb7761cd4d08bb73c7 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 9 Dec 2023 10:52:11 -0500 Subject: [PATCH] True back end - notifications --- wrenchboard/src/shared_tool/account_mngt.cc | 2 +- .../app/Controllers/WrenchNotifications.php | 5 +++-- www-api/app/Models/ResultFormatter.php | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/wrenchboard/src/shared_tool/account_mngt.cc b/wrenchboard/src/shared_tool/account_mngt.cc index 8e3906fa..6d21a563 100644 --- a/wrenchboard/src/shared_tool/account_mngt.cc +++ b/wrenchboard/src/shared_tool/account_mngt.cc @@ -73,7 +73,7 @@ wrenchboard=> SELECT uid,icon,msg,added FROM members_notification WHERE member_i logfmt(logINFO, "/WrenchReturnMemberNotifications()"); return ret; -return 0; +return ret; } long WrenchReturnMemberBankAccount(CVars in, CVars &out) { diff --git a/www-api/app/Controllers/WrenchNotifications.php b/www-api/app/Controllers/WrenchNotifications.php index f6d1d65e..26ba2db7 100644 --- a/www-api/app/Controllers/WrenchNotifications.php +++ b/www-api/app/Controllers/WrenchNotifications.php @@ -77,8 +77,9 @@ class WrenchNotifications extends BaseController switch ($endpoint){ case 'mynotifications': - $call_backend = false; - $local_out = $this->dummyData(); + $call_backend = true; + // $local_out = $this->dummyData(); + $in["action"]=WRENCHBOARD_ACCT_NOTIFICATIONS; break; } diff --git a/www-api/app/Models/ResultFormatter.php b/www-api/app/Models/ResultFormatter.php index 686806b5..cb6daca6 100644 --- a/www-api/app/Models/ResultFormatter.php +++ b/www-api/app/Models/ResultFormatter.php @@ -119,6 +119,27 @@ class ResultFormatter extends Model // id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status switch ($in["action"]) { + + case WRENCHBOARD_ACCT_NOTIFICATIONS: + $total = $out["total_record"]; + $res = array( + "status" => $out["status"], + "total_record" => ($total - 1), + "internal_return" => $out["internal_return"], + "result_list" => array(), + ); + for ($i = 0; $i < $total; $i++) { + $key = sprintf("%05d", $i); + $res["result_list"][] = array( + "msg" => $out["msg_${key}"], + "uid" => $out["uid_${key}"], + "icon" => $out["icon_${key}"], + "added" => $out["added_${key}"], + + ); + } + break; + case WRENCHBOARD_ACCOUNT_RECENTS: $total = $out["total_record"]; $res = array(