From 31c891cba1aa38784d34fd55a1b68d23c70f89d3 Mon Sep 17 00:00:00 2001 From: jrbin Date: Fri, 10 Nov 2023 16:20:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B6=E8=B3=87=E6=96=99=E6=9F=A5?= =?UTF-8?q?=E8=A9=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/mkt/pricereview_contractno-api.php | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 wms/mkt/pricereview_contractno-api.php diff --git a/wms/mkt/pricereview_contractno-api.php b/wms/mkt/pricereview_contractno-api.php new file mode 100644 index 00000000..2c33004b --- /dev/null +++ b/wms/mkt/pricereview_contractno-api.php @@ -0,0 +1,63 @@ + "ok", "err" => ""); + +try { + if (empty($_POST) || empty($_POST["pa"])) throw new \Exception("parameter empty"); + + foreach ($_POST as $k => $v) { + $$k = htmlspecialchars(stripslashes(trim($v))); + } + + // 基本資料 + $db_query = "select a.address, a.repairerid, c.contractno, c.company, c.taxid from account a, contract c "; + $db_query .= "where a.accountid = c.customerid and c.contractno = '$pa'"; + $res = mysqli_query($link, $db_query); + if ($row = mysqli_fetch_row($res)) { + $rarr["address"] = $row[0]; + $rarr["repairerid"] = $row[1]; + $rarr["contractno"] = $row[2]; + $rarr["company"] = $row[3]; + $rarr["taxid"] = $row[4]; + } + mysqli_free_result($res); + + // 電梯編號 + $db_query = "select facilityno from facility where contractno = '$pa' order by facilityno"; + $res = mysqli_query($link, $db_query); + while ($row = mysqli_fetch_row($res)) { + $rarr["faci"][] = $row[0]; + } + mysqli_free_result($res); + + if (!isset($rarr["contractno"])) { + $rarr["st"] = "err"; + $rarr["err"] = "無資料!"; + } +}catch(\Exception $e) { + $rarr["st"] = "err"; + $rarr["err"] = $e->getMessage(); +} +//print_r($rarr);exit; +echo json_encode($rarr, JSON_UNESCAPED_UNICODE); +exit; +?> \ No newline at end of file