diff --git a/BackEnd/Index.aspx b/BackEnd/Index.aspx index ac8e38d..14a6098 100644 --- a/BackEnd/Index.aspx +++ b/BackEnd/Index.aspx @@ -2,6 +2,9 @@ +file:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.designer.cs +file:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.designer.csfile:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.cs +file:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.designer.csfile:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.csfile:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx
diff --git a/BackEnd/api/clearAllData.ashx.cs b/BackEnd/api/clearAllData.ashx.cs index 57ce2cc..a29c524 100644 --- a/BackEnd/api/clearAllData.ashx.cs +++ b/BackEnd/api/clearAllData.ashx.cs @@ -98,20 +98,20 @@ namespace abbott_2024_event.BackEnd.api if (type == "all") { - conn.Execute("delete from babyRec where babyRec_createdate <= '2025/3/31 23:59:59' "); - conn.Execute("delete from babyData where babyData_createdate <= '2025/3/31 23:59:59' "); - conn.Execute("delete from lineUser where lineUser_createdate <= '2025/3/31 23:59:59' "); + conn.Execute("delete from babyRec where babyRec_createdate <= '2025/4/1 23:59:59' "); + conn.Execute("delete from babyData where babyData_createdate <= '2025/4/1 23:59:59' "); + conn.Execute("delete from lineUser where lineUser_createdate <= '2025/4/1 23:59:59' "); } if (type == "babyRec") { - conn.Execute("delete from babyRec where babyRec_createdate <= '2025/3/31 23:59:59' "); + conn.Execute("delete from babyRec where babyRec_createdate <= '2025/4/1 23:59:59' "); } if (type == "babyData") { - conn.Execute("delete from babyData where babyData_createdate <= '2025/3/31 23:59:59' "); - conn.Execute("delete from babyRec where babyRec_createdate <= '2025/3/31 23:59:59' "); + conn.Execute("delete from babyData where babyData_createdate <= '2025/4/1 23:59:59' "); + conn.Execute("delete from babyRec where babyRec_createdate <= '2025/4/1 23:59:59' "); } objRet.ret = "yes"; diff --git a/BackEnd/api/clearLineUid.ashx b/BackEnd/api/clearLineUid.ashx new file mode 100644 index 0000000..7701d92 --- /dev/null +++ b/BackEnd/api/clearLineUid.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="clearLineUid.ashx.cs" Class="abbott_2024_event.BackEnd.api.clearLineUid" %> diff --git a/BackEnd/api/clearLineUid.ashx.cs b/BackEnd/api/clearLineUid.ashx.cs new file mode 100644 index 0000000..d8953ab --- /dev/null +++ b/BackEnd/api/clearLineUid.ashx.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Runtime.Serialization.Json; +using System.Web.SessionState; +using Dapper; +using Dapper.Contrib.Extensions; +using System.Data.SqlClient; +using System.IO.Compression; + +namespace abbott_2024_event.BackEnd.api +{ + /// + /// clearLineUid 的摘要描述 + /// + public class clearLineUid : IHttpHandler + { + SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString")); + public authToken authToken; + public void ProcessRequest(HttpContext context) + { + result objRet = new result(); + DataContractJsonSerializer json = new DataContractJsonSerializer(objRet.GetType()); + context.Response.ContentType = "application/json;charset=utf-8"; + context.Response.AddHeader("Access-Control-Allow-Origin", "*"); + + string acceptEncoding = context.Request.Headers["Accept-Encoding"].ToString().ToUpperInvariant(); + if (!String.IsNullOrEmpty(acceptEncoding)) + { + if (acceptEncoding.Contains("GZIP")) + { + //输出流头部GZIP压缩 + context.Response.AppendHeader("Content-encoding", "gzip"); + context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress); + } + else if (acceptEncoding.Contains("DEFLATE")) + { + //输出流头部DEFLATE压缩 + context.Response.AppendHeader("Content-encoding", "deflate"); + context.Response.Filter = new DeflateStream(context.Response.Filter, CompressionMode.Compress); + } + } + + authToken objAuth = new authToken(); + + if (!objAuth.user_isLogin) + { + objRet.ret = "no"; + objRet.err_code = "0001"; + objRet.message = "尚未登入,請登入後使用"; + json.WriteObject(context.Response.OutputStream, objRet); + return; + } + + string line_uid = (context.Request["line_uid"] == null) ? "" : context.Request["line_uid"].ToString(); + + if (line_uid == "") + { + objRet.ret = "no"; + objRet.err_code = "2001"; + objRet.message = "line_uid為空字串!"; + json.WriteObject(context.Response.OutputStream, objRet); + return; + } + + string myIP = globalClass.GetIPAddress(); + + if (myIP == "::1") + { + myIP = "127.0.0.1"; + } + + Boolean isAllow = false; + + if (myIP == "127.0.0.1") + { + isAllow = true; + } + + string myIP_2 = myIP.Substring(0, myIP.LastIndexOf('.')); + + if (myIP_2 == "60.251.161") + { + isAllow = true; + } + + //isAllow = false; + + if (isAllow == false) + { + objRet.ret = "no"; + objRet.err_code = "0002"; + objRet.message = "IP錯誤無法操作!"; + json.WriteObject(context.Response.OutputStream, objRet); + return; + } + + conn.Execute("delete from babyRec where line_uid = @line_uid ", new { line_uid = line_uid }); + conn.Execute("delete from babyData where line_uid = @line_uid ", new { line_uid = line_uid }); + conn.Execute("delete from lineUser where line_uid = @line_uid ", new { line_uid = line_uid }); + + objRet.ret = "yes"; + json.WriteObject(context.Response.OutputStream, objRet); + return; + } + + public class result + { + public string ret = "no"; + public string err_code = "0000"; + public string message = ""; + } + public bool IsReusable + { + get + { + return false; + } + } + } +} \ No newline at end of file diff --git a/BackEnd/assets/javascript/custom/userList.js b/BackEnd/assets/javascript/custom/userList.js index f16f750..ad08016 100644 --- a/BackEnd/assets/javascript/custom/userList.js +++ b/BackEnd/assets/javascript/custom/userList.js @@ -5,6 +5,12 @@ var oPos; $(document).ready(function () { var actualDate = new Date(); // convert to actual date var prevDate = new Date(actualDate.getFullYear(), actualDate.getMonth() - 6, actualDate.getDate()); + var startDate = new Date("2025/4/1"); + + if (prevDate < startDate) { + prevDate = startDate; + } + var startTxt = prevDate.getFullYear().toString() + "/" + padding(prevDate.getMonth() + 1, 2) + "/01"; var endTxt = actualDate.getFullYear().toString() + "/" + padding(actualDate.getMonth() + 1, 2) + "/" + padding(actualDate.getDate(), 2); diff --git a/BackEnd/ip-management.aspx b/BackEnd/ip-management.aspx index 112971b..f107a43 100644 --- a/BackEnd/ip-management.aspx +++ b/BackEnd/ip-management.aspx @@ -28,6 +28,36 @@ } }); + $("#ctl00_ContentPlaceHolder1_clearLine").click(function () { + + var line_uid = $("#ctl00_ContentPlaceHolder1_line_uid").val(); + + if (confirm("確定要刪除此Line Uid的所有資料?")) { + if (confirm("再次確定要刪除?")) { + var formData = { + line_uid: line_uid + } + + $.ajax({ + url: "api/clearLineUid.ashx", + type: "POST", + data: formData, + success: function (data, textStatus, jqXHR) { + if (data.ret == "yes") { + alert("刪除完成!"); + + } else { + alert(data.message); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('網路或伺服器發生錯誤或!'); + } + }); + } + + } + }); $("#ctl00_ContentPlaceHolder1_clearAll").click(function () { if (confirm("確定要刪除2025/3/31(含)以前的所有資料?")) { @@ -197,16 +227,24 @@

- +

- +

- +
+
+
+
+ +
  + +
+ diff --git a/BackEnd/ip-management.aspx.cs b/BackEnd/ip-management.aspx.cs index 853b8d4..177a531 100644 --- a/BackEnd/ip-management.aspx.cs +++ b/BackEnd/ip-management.aspx.cs @@ -39,11 +39,15 @@ namespace abbott_2024_event.BackEnd clearAll.Visible = true; clearData.Visible = true; clearRec.Visible = true; + clearLine.Visible = true; + line_uid.Visible = true; } else { clearAll.Visible = false; clearData.Visible = false; clearRec.Visible = false; + clearLine.Visible = false; + line_uid.Visible = false; } } } diff --git a/BackEnd/ip-management.aspx.designer.cs b/BackEnd/ip-management.aspx.designer.cs index 92d5481..2f9a739 100644 --- a/BackEnd/ip-management.aspx.designer.cs +++ b/BackEnd/ip-management.aspx.designer.cs @@ -40,5 +40,23 @@ namespace abbott_2024_event.BackEnd /// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。 /// protected global::System.Web.UI.HtmlControls.HtmlButton clearRec; + + /// + /// line_uid 控制項。 + /// + /// + /// 自動產生的欄位。 + /// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。 + /// + protected global::System.Web.UI.HtmlControls.HtmlInputText line_uid; + + /// + /// clearLine 控制項。 + /// + /// + /// 自動產生的欄位。 + /// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。 + /// + protected global::System.Web.UI.HtmlControls.HtmlButton clearLine; } } diff --git a/BackEnd/userList.aspx b/BackEnd/userList.aspx index 791abdb..28b4832 100644 --- a/BackEnd/userList.aspx +++ b/BackEnd/userList.aspx @@ -200,5 +200,5 @@
- + diff --git a/Redirect/Default.aspx.cs b/Redirect/Default.aspx.cs index 3e8a96a..60586bf 100644 --- a/Redirect/Default.aspx.cs +++ b/Redirect/Default.aspx.cs @@ -35,6 +35,9 @@ namespace abbott_2024_event.Redirect if (utm_medium == "prod") { redirectUrl = "https://www.abbott-nutrition.com.tw/pediasure/2024_event/Redirect/?utm_source=" + utm_source + "&utm_medium=do_" + utm_medium + "&uid=" + uid + "&phone=" + phone + "&username=" + username; + //redirectUrl = "https://liff.line.me/1560329335-jrEGzkNM?traceId=168&utm_source=" + utm_source + "&utm_medium=do_" + utm_medium + "&uid=" + uid + "&phone=" + phone + "&username=" + username; + + Response.Redirect(redirectUrl); } diff --git a/abbott_2024_event.csproj b/abbott_2024_event.csproj index 10c93f3..32f399a 100644 --- a/abbott_2024_event.csproj +++ b/abbott_2024_event.csproj @@ -26452,6 +26452,7 @@ + @@ -26475,6 +26476,9 @@ clearAllData.ashx + + clearLineUid.ashx + exportBabyRec.ashx diff --git a/bin/abbott_2024_event.dll b/bin/abbott_2024_event.dll index 5a87220..4807824 100644 Binary files a/bin/abbott_2024_event.dll and b/bin/abbott_2024_event.dll differ diff --git a/bin/app.publish/BackEnd/Index.aspx b/bin/app.publish/BackEnd/Index.aspx index ac8e38d..14a6098 100644 --- a/bin/app.publish/BackEnd/Index.aspx +++ b/bin/app.publish/BackEnd/Index.aspx @@ -2,6 +2,9 @@ +file:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.designer.cs +file:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.designer.csfile:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.cs +file:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.designer.csfile:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx.csfile:///c:\users\dk96pccu\source\repos\abbott_2024_event\backend\Index.aspx
diff --git a/bin/app.publish/BackEnd/api/clearLineUid.ashx b/bin/app.publish/BackEnd/api/clearLineUid.ashx new file mode 100644 index 0000000..7701d92 --- /dev/null +++ b/bin/app.publish/BackEnd/api/clearLineUid.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="clearLineUid.ashx.cs" Class="abbott_2024_event.BackEnd.api.clearLineUid" %> diff --git a/bin/app.publish/BackEnd/ip-management.aspx b/bin/app.publish/BackEnd/ip-management.aspx index 112971b..f107a43 100644 --- a/bin/app.publish/BackEnd/ip-management.aspx +++ b/bin/app.publish/BackEnd/ip-management.aspx @@ -28,6 +28,36 @@ } }); + $("#ctl00_ContentPlaceHolder1_clearLine").click(function () { + + var line_uid = $("#ctl00_ContentPlaceHolder1_line_uid").val(); + + if (confirm("確定要刪除此Line Uid的所有資料?")) { + if (confirm("再次確定要刪除?")) { + var formData = { + line_uid: line_uid + } + + $.ajax({ + url: "api/clearLineUid.ashx", + type: "POST", + data: formData, + success: function (data, textStatus, jqXHR) { + if (data.ret == "yes") { + alert("刪除完成!"); + + } else { + alert(data.message); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('網路或伺服器發生錯誤或!'); + } + }); + } + + } + }); $("#ctl00_ContentPlaceHolder1_clearAll").click(function () { if (confirm("確定要刪除2025/3/31(含)以前的所有資料?")) { @@ -197,16 +227,24 @@

- +

- +

- +
+
+
+
+ +
  + +
+ diff --git a/bin/app.publish/BackEnd/userList.aspx b/bin/app.publish/BackEnd/userList.aspx index 791abdb..28b4832 100644 --- a/bin/app.publish/BackEnd/userList.aspx +++ b/bin/app.publish/BackEnd/userList.aspx @@ -200,5 +200,5 @@
- + diff --git a/bin/app.publish/bin/abbott_2024_event.dll b/bin/app.publish/bin/abbott_2024_event.dll index 5a87220..4807824 100644 Binary files a/bin/app.publish/bin/abbott_2024_event.dll and b/bin/app.publish/bin/abbott_2024_event.dll differ