From 33136d62baaa4f2196f5dc6422ca790517950268 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 13 Jun 2023 12:32:23 -0400 Subject: [PATCH] result format --- www-api/app/Models/ResultFormatter.php | 28 ++++++++++++++++++++++++++ www-api/public/svs/user/formarter.php | 27 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/www-api/app/Models/ResultFormatter.php b/www-api/app/Models/ResultFormatter.php index a77bf611..8d0fc74a 100644 --- a/www-api/app/Models/ResultFormatter.php +++ b/www-api/app/Models/ResultFormatter.php @@ -82,6 +82,34 @@ class ResultFormatter extends Model // id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status switch ($in["action"]) { + + case WRENCHBOARD_JOB_OFFER_INTLIST: + + $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( + "client_id" => $out["client_id_${key}"], + "client_uid" => $out["client_uid_${key}"], + "client_name" => $out["client_name_${key}"], + "offer_code" => $out["offer_code_${key}"], + "offer_uid" => $out["offer_uid_${key}"], + "sent" => $out["sent_${key}"], + "title" => $out["title_${key}"], + "description" => $out["description_${key}"], + "job_id" => $out["job_id_${key}"], + "expire" => $out["expire_${key}"], + ); + } + + break; + case WRENCHBOARD_ACCOUNT_DASHDATA: $res = $out; $res['home_activities'] = []; diff --git a/www-api/public/svs/user/formarter.php b/www-api/public/svs/user/formarter.php index d4c555f7..a063d48a 100755 --- a/www-api/public/svs/user/formarter.php +++ b/www-api/public/svs/user/formarter.php @@ -76,6 +76,33 @@ function processOutJson($in, $out) { // id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status switch ($in["action"]) { + case WRENCHBOARD_JOB_OFFER_INTLIST: + + $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( + "client_id" => $out["client_id_${key}"], + "client_uid" => $out["client_uid_${key}"], + "client_name" => $out["client_name_${key}"], + "offer_code" => $out["offer_code_${key}"], + "offer_uid" => $out["offer_uid_${key}"], + "sent" => $out["sent_${key}"], + "title" => $out["title_${key}"], + "description" => $out["description_${key}"], + "job_id" => $out["job_id_${key}"], + "expire" => $out["expire_${key}"], + ); + } + + break; + case WRENCHBOARD_ACCOUNT_DASHDATA: $res = $out; $res['home_activities'] = [];