diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html index ae0d194..0f79cb0 100644 --- a/Frontend/_historyData.html +++ b/Frontend/_historyData.html @@ -393,46 +393,46 @@ // console.log("loadTable",pageAct.devicePoiName.split(" ")[0]) v.type = pageAct.devicePoiName.split(" ")[0]; }); + + let tag = "#historyTable"; + + let column_defs = [ + { "targets": [0], "width": "20%", "sortable": true }, + { "targets": [1], "width": "20%", "sortable": true }, + { "targets": [2], "width": "20%", "sortable": true } + ]; + + let columns = [ + { + "title": "類別", + "data": "type" + }, + { + "title": "設備名稱", + "data": "deviceName", + }, + { + "title": "數值", + "data": "value", + "render": function (data) { + if (isNaN(data.toString())) { + return data + } + return data.roundDecimal(2); + } + }, + { + "title": "紀錄時間", + "data": "timestamp", + "render": function (data) { + // console.log(data) + return displayDate(data, "datetime"); + } + } + ]; + + historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); } - - let tag = "#historyTable"; - - let column_defs = [ - { "targets": [0], "width": "20%", "sortable": true }, - { "targets": [1], "width": "20%", "sortable": true }, - { "targets": [2], "width": "20%", "sortable": true } - ]; - - let columns = [ - { - "title": "類別", - "data": "type" - }, - { - "title": "設備名稱", - "data": "deviceName", - }, - { - "title": "數值", - "data": "value", - "render": function (data) { - if (isNaN(data.toString())) { - return data - } - return data.roundDecimal(2); - } - }, - { - "title": "紀錄時間", - "data": "timestamp", - "render": function (data) { - // console.log(data) - return displayDate(data, "datetime"); - } - } - ]; - - historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); } function exportExcel() { diff --git a/FrontendWebApi/ApiControllers/HiNetController.cs b/FrontendWebApi/ApiControllers/HiNetController.cs index 6eba35a..a5cc095 100644 --- a/FrontendWebApi/ApiControllers/HiNetController.cs +++ b/FrontendWebApi/ApiControllers/HiNetController.cs @@ -9,6 +9,8 @@ using FrontendWebApi.Models; using Microsoft.CodeAnalysis.CSharp.Syntax; using Repository.BackendRepository.Interface; using System.Linq; +using System.Threading; +using System.Collections.Generic; /// /// HiNet 企業簡訊 API for .NetCore 2.0 @@ -767,11 +769,11 @@ namespace FrontendWebApi.ApiControllers public ActionResult> HiNetMsg([FromBody] HiNetInput input) { ApiResult apiResult = new ApiResult(jwt_str); - //if (!jwtlife) - //{ - // apiResult.Code = "5000"; - // return BadRequest(apiResult); - //} + if (!jwtlife) + { + apiResult.Code = "5000"; + return BadRequest(apiResult); + } try { @@ -789,8 +791,25 @@ namespace FrontendWebApi.ApiControllers //發送文字簡訊並回傳狀態碼 retCode = this.SendMsg(input.Number, input.Msg); //取得messageID或文字描述 - retContent = this.Get_Message(); - apiResult.Data = retCode + " : " + retContent; + retContent = this.Get_Message(); //return id when sent message + apiResult.Data = retCode.ToString(); + Dictionary hiNetMsg = new Dictionary(); + if (retCode == 0) + hiNetMsg.Add("@MsgId", retContent); + else + hiNetMsg.Add("@ErrMessage", retCode + " : " + retContent); + + hiNetMsg.Add("@deleted", 0); + hiNetMsg.Add("@Number", input.Number); + hiNetMsg.Add("@Message", input.Msg); + hiNetMsg.Add("@status", retCode); + hiNetMsg.Add("@created_at", DateTime.Now); + hiNetMsg.Add("@created_by", myUser.userinfo_guid); + backendRepository.AddOneByCustomTableReturnId(hiNetMsg, "hinet_message"); + + //Thread.Sleep(5000); + //retCode = this.QueryMsg(retContent); + //retContent = this.Get_Message(); //return success status id(Successful:20230517103949") when querymsg status } else {