From 7d361efb3d5333f9addae828ab669b2ede213cf2 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 18 May 2023 11:53:21 -0400 Subject: [PATCH] Result formating --- www-api/app/Models/ResultFormatter.php | 20 ++++++++++++++++++++ www-api/public/svs/user/formarter.php | 22 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/www-api/app/Models/ResultFormatter.php b/www-api/app/Models/ResultFormatter.php index 0c5f3729..9ef2b113 100644 --- a/www-api/app/Models/ResultFormatter.php +++ b/www-api/app/Models/ResultFormatter.php @@ -82,6 +82,26 @@ class ResultFormatter extends Model // id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status switch ($in["action"]) { + case WRENCHBOARD_CONTRACT_MSGLIST: + $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( + "message" => $out["message_${key}"], + "msg" => $out["msg_${key}"], + "msg_date" => $out["msg_date_${key}"], + "msg_firstname" => $out["msg_firstname_${key}"], + "msg_id" => $out["msg_id_${key}"], + "msg_type" => $out["msg_type_${key}"], + ); + } + break; case WRENCHBOARD_FAMILY_LIST: $total = $out["total_record"]; diff --git a/www-api/public/svs/user/formarter.php b/www-api/public/svs/user/formarter.php index 8200c32f..5e2d7ae9 100755 --- a/www-api/public/svs/user/formarter.php +++ b/www-api/public/svs/user/formarter.php @@ -76,6 +76,28 @@ function processOutJson($in, $out) { // id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status switch ($in["action"]) { + + case WRENCHBOARD_CONTRACT_MSGLIST: + $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( + "message" => $out["message_${key}"], + "msg" => $out["msg_${key}"], + "msg_date" => $out["msg_date_${key}"], + "msg_firstname" => $out["msg_firstname_${key}"], + "msg_id" => $out["msg_id_${key}"], + "msg_type" => $out["msg_type_${key}"], + ); + } + break; + case WRENCHBOARD_FAMILY_LIST: $total = $out["total_record"];