diff --git a/Redirect/Default.aspx b/Redirect/Default.aspx
new file mode 100644
index 0000000..37c25ee
--- /dev/null
+++ b/Redirect/Default.aspx
@@ -0,0 +1,16 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="abbott_2024_event.Redirect.Default" %>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Redirect/Default.aspx.cs b/Redirect/Default.aspx.cs
new file mode 100644
index 0000000..5b9e442
--- /dev/null
+++ b/Redirect/Default.aspx.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Runtime.Serialization.Json;
+using System.Web.SessionState;
+using Dapper;
+using Dapper.Contrib.Extensions;
+
+
+namespace abbott_2024_event.Redirect
+{
+ public partial class Default : System.Web.UI.Page
+ {
+ SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString"));
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ string utm_source = (Request["utm_source"] == null) ? "" : Request["utm_source"].ToString();
+ string utm_medium = (Request["utm_medium"] == null) ? "" : Request["utm_medium"].ToString();
+ string uid = (Request["uid"] == null) ? "" : Request["uid"].ToString();
+ string phone = (Request["phone"] == null) ? "" : Request["phone"].ToString();
+ string username = (Request["username"] == null) ? "" : Request["username"].ToString();
+
+ if (utm_source == "") {
+ Response.Write("無utm_source");
+ Response.End();
+ }
+
+ string redirectUrl = "";
+
+
+
+ if (utm_medium == "prod") {
+ redirectUrl = "https://abbott-2024-event.azurewebsites.net/";
+ }
+
+ if (utm_medium == "dev")
+ {
+ redirectUrl = "https://abbott-2024-event.bremennetwork.tw/abbott-2024/";
+ }
+
+ if (redirectUrl == "") {
+ Response.Write("無此utm_medium資料");
+ Response.End();
+ }
+
+ string temp_key = utm_source;
+
+ babyRec tmpRec = conn.QueryFirstOrDefault("select * from babyRec where babyRec_key = @babyRec_key", new { babyRec_key = temp_key });
+
+ if (tmpRec == null) {
+ Response.Write("無此temp_key資料");
+ Response.End();
+ }
+
+
+ redirectUrl += "?uid=" + uid + "&phone=" + phone + "&username=" + username + "&temp_key=" + temp_key +"&utm_source=" + tmpRec.utm_source + "&utm_medium=" + tmpRec.utm_medium + "&utm_campaign=" + tmpRec.utm_campaign + "&utm_content=" + tmpRec.utm_content + "&utm_term=" + tmpRec.utm_term;
+
+ Response.Redirect(redirectUrl);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Redirect/Default.aspx.designer.cs b/Redirect/Default.aspx.designer.cs
new file mode 100644
index 0000000..e374015
--- /dev/null
+++ b/Redirect/Default.aspx.designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// 這段程式碼是由工具產生的。
+//
+// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
+// 程式碼,變更將會遺失。
+//
+//------------------------------------------------------------------------------
+
+namespace abbott_2024_event.Redirect
+{
+
+
+ public partial class Default
+ {
+
+ ///
+ /// form1 控制項。
+ ///
+ ///
+ /// 自動產生的欄位。
+ /// 若要修改,請將欄位宣告從設計工具檔案移至程式碼後置檔案。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+ }
+}
diff --git a/abbott_2024_event.csproj b/abbott_2024_event.csproj
index 360897c..10c93f3 100644
--- a/abbott_2024_event.csproj
+++ b/abbott_2024_event.csproj
@@ -26453,11 +26453,13 @@
+
+
@@ -26551,6 +26553,13 @@
Default.aspx
+
+ Default.aspx
+ ASPXCodeBehind
+
+
+ Default.aspx
+
babyData.ashx
@@ -26566,6 +26575,9 @@
lineLogin.ashx
+
+ tempKeyQuery.ashx
+
diff --git a/bin/abbott_2024_event.dll b/bin/abbott_2024_event.dll
index 7187a02..4b35c4c 100644
Binary files a/bin/abbott_2024_event.dll and b/bin/abbott_2024_event.dll differ
diff --git a/bin/app.publish/Redirect/Default.aspx b/bin/app.publish/Redirect/Default.aspx
new file mode 100644
index 0000000..37c25ee
--- /dev/null
+++ b/bin/app.publish/Redirect/Default.aspx
@@ -0,0 +1,16 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="abbott_2024_event.Redirect.Default" %>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/app.publish/bin/abbott_2024_event.dll b/bin/app.publish/bin/abbott_2024_event.dll
index 7187a02..4b35c4c 100644
Binary files a/bin/app.publish/bin/abbott_2024_event.dll and b/bin/app.publish/bin/abbott_2024_event.dll differ
diff --git a/bin/app.publish/webapi/tempKeyQuery.ashx b/bin/app.publish/webapi/tempKeyQuery.ashx
new file mode 100644
index 0000000..52c1396
--- /dev/null
+++ b/bin/app.publish/webapi/tempKeyQuery.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="tempKeyQuery.ashx.cs" Class="abbott_2024_event.webapi.tempKeyQuery" %>
diff --git a/webapi/babyData.ashx.cs b/webapi/babyData.ashx.cs
index 476aae9..9b6d5bf 100644
--- a/webapi/babyData.ashx.cs
+++ b/webapi/babyData.ashx.cs
@@ -117,15 +117,17 @@ namespace abbott_2024_event.webapi
if (line_displayname != lineUser.line_displayName && line_displayname != "")
{
lineUser.line_displayName = line_displayname;
- lineUser.lineUser_modifydate = DateTime.Now;
+ lineUser.lineUser_modifydate = DateTime.Now.AddMinutes(3);
conn.Update(lineUser);
}
else {
- lineUser.lineUser_modifydate = DateTime.Now;
+ lineUser.lineUser_modifydate = DateTime.Now.AddMinutes(3);
conn.Update(lineUser);
}
- List babyDatas = conn.Query("select * from babyData where line_uid = @line_uid", new { line_uid = line_uid }).ToList();
+
+
+ List babyDatas = conn.Query("select * from babyData where line_uid = @line_uid", new { line_uid = line_uid }).ToList();
if (babyDatas.Count > 0) {
objRet.more_data = "Y";
diff --git a/webapi/lineLogin.ashx.cs b/webapi/lineLogin.ashx.cs
index 7afd051..09f2809 100644
--- a/webapi/lineLogin.ashx.cs
+++ b/webapi/lineLogin.ashx.cs
@@ -98,14 +98,14 @@ namespace abbott_2024_event.webapi
}
if (lineUser != null) {
- if (lineUser.line_displayName != line_displayName) {
+ if (lineUser.line_displayName != line_displayName && line_displayName != "") {
lineUser.line_displayName= line_displayName;
lineUser.lineUser_modifydate = DateTime.Now;
conn.Update(lineUser);
}
- if (lineUser.line_phone != line_phone) {
+ if (lineUser.line_phone != line_phone && line_phone != "") {
lineUser.line_phone= line_phone;
lineUser.lineUser_modifydate = DateTime.Now;
diff --git a/webapi/tempKeyQuery.ashx b/webapi/tempKeyQuery.ashx
new file mode 100644
index 0000000..52c1396
--- /dev/null
+++ b/webapi/tempKeyQuery.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="tempKeyQuery.ashx.cs" Class="abbott_2024_event.webapi.tempKeyQuery" %>
diff --git a/webapi/tempKeyQuery.ashx.cs b/webapi/tempKeyQuery.ashx.cs
new file mode 100644
index 0000000..b922496
--- /dev/null
+++ b/webapi/tempKeyQuery.ashx.cs
@@ -0,0 +1,104 @@
+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;
+
+namespace abbott_2024_event.webapi
+{
+ ///
+ /// tempKeyQuery 的摘要描述
+ ///
+ public class tempKeyQuery : IHttpHandler
+ {
+ SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString"));
+ 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 temp_key = (context.Request["temp_key"] == null) ? "" : context.Request["temp_key"].ToString();
+
+ if (temp_key == "")
+ {
+ objRet.ret = "no";
+ objRet.err_code = "3001";
+ objRet.message = "沒有temp_key!";
+ json.WriteObject(context.Response.OutputStream, objRet);
+ return;
+ }
+
+ babyRec tmpRec = conn.QueryFirstOrDefault("select * from babyRec where babyRec_key = @babyRec_key", new { babyRec_key = temp_key });
+
+ if (tmpRec == null)
+ {
+ objRet.ret = "no";
+ objRet.err_code = "3002";
+ objRet.message = "沒有此temp_key資料!";
+ json.WriteObject(context.Response.OutputStream, objRet);
+ return;
+ }
+
+ string babyData_uid = tmpRec.babyData_uid;
+
+ babyData tmpData = conn.QueryFirstOrDefault("select * from babyData where babyData_uid = @babyData_uid", new { babyData_uid = babyData_uid });
+
+ if (tmpData == null)
+ {
+ objRet.ret = "no";
+ objRet.err_code = "3003";
+ objRet.message = "沒有此babyData資料!";
+ json.WriteObject(context.Response.OutputStream, objRet);
+ return;
+ }
+
+ objRet.baby_data.babyData_uid = tmpData.babyData_uid;
+ objRet.baby_data.baby_name = tmpData.babyData_name;
+ objRet.baby_data.baby_gender = tmpData.babyData_sexual;
+ objRet.baby_data.baby_birthday = tmpData.babyData_birthday.ToString("yyyy/MM/dd");
+ objRet.baby_data.baby_age = tmpRec.babyRec_yearMonthStr;
+ objRet.baby_data.baby_height = tmpRec.babyRec_height;
+ objRet.baby_data.average_height = tmpRec.babyRec_middleHeight;
+ objRet.baby_data.baby_inpercent = tmpRec.babyRec_inpercent;
+ 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 baby baby_data = new baby();
+ }
+
+ public class baby
+ {
+ public string baby_birthday { get; set; } = "";
+ public string baby_age { get; set; } = "";
+ public double baby_height { get; set; } = 0.0;
+ public double average_height { get; set; } = 0.0;
+ public string babyData_uid { get; set; } = "";
+
+ public string baby_name { get; set; } = "";
+ public string baby_gender { get; set; } = "";
+ public double baby_inpercent { get; set; } = 0;
+ }
+
+ public bool IsReusable
+ {
+ get
+ {
+ return false;
+ }
+ }
+ }
+}
\ No newline at end of file