updates new redirect
parent
21cc733766
commit
3f7fe64880
|
|
@ -0,0 +1,16 @@
|
||||||
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="abbott_2024_event.Redirect.Default" %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head runat="server">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form id="form1" runat="server">
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -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<babyRec>("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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 這段程式碼是由工具產生的。
|
||||||
|
//
|
||||||
|
// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
|
||||||
|
// 程式碼,變更將會遺失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace abbott_2024_event.Redirect
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public partial class Default
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// form1 控制項。
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 自動產生的欄位。
|
||||||
|
/// 若要修改,請將欄位宣告從設計工具檔案移至程式碼後置檔案。
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26453,11 +26453,13 @@
|
||||||
<Content Include="Line\page1.html" />
|
<Content Include="Line\page1.html" />
|
||||||
<Content Include="BackEnd\api\clearAllData.ashx" />
|
<Content Include="BackEnd\api\clearAllData.ashx" />
|
||||||
<None Include="Scripts\jquery-3.7.1.intellisense.js" />
|
<None Include="Scripts\jquery-3.7.1.intellisense.js" />
|
||||||
|
<Content Include="Redirect\Default.aspx" />
|
||||||
<Content Include="Scripts\jquery-3.7.1.js" />
|
<Content Include="Scripts\jquery-3.7.1.js" />
|
||||||
<Content Include="Scripts\jquery-3.7.1.min.js" />
|
<Content Include="Scripts\jquery-3.7.1.min.js" />
|
||||||
<Content Include="Scripts\jquery-3.7.1.slim.js" />
|
<Content Include="Scripts\jquery-3.7.1.slim.js" />
|
||||||
<Content Include="Scripts\jquery-3.7.1.slim.min.js" />
|
<Content Include="Scripts\jquery-3.7.1.slim.min.js" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
|
<Content Include="webapi\tempKeyQuery.ashx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="App_Code\authToken.cs" />
|
<Compile Include="App_Code\authToken.cs" />
|
||||||
|
|
@ -26551,6 +26553,13 @@
|
||||||
<DependentUpon>Default.aspx</DependentUpon>
|
<DependentUpon>Default.aspx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Redirect\Default.aspx.cs">
|
||||||
|
<DependentUpon>Default.aspx</DependentUpon>
|
||||||
|
<SubType>ASPXCodeBehind</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Redirect\Default.aspx.designer.cs">
|
||||||
|
<DependentUpon>Default.aspx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="webapi\babyData.ashx.cs">
|
<Compile Include="webapi\babyData.ashx.cs">
|
||||||
<DependentUpon>babyData.ashx</DependentUpon>
|
<DependentUpon>babyData.ashx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -26566,6 +26575,9 @@
|
||||||
<Compile Include="webapi\lineLogin.ashx.cs">
|
<Compile Include="webapi\lineLogin.ashx.cs">
|
||||||
<DependentUpon>lineLogin.ashx</DependentUpon>
|
<DependentUpon>lineLogin.ashx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="webapi\tempKeyQuery.ashx.cs">
|
||||||
|
<DependentUpon>tempKeyQuery.ashx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,16 @@
|
||||||
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="abbott_2024_event.Redirect.Default" %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head runat="server">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form id="form1" runat="server">
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
||||||
|
<%@ WebHandler Language="C#" CodeBehind="tempKeyQuery.ashx.cs" Class="abbott_2024_event.webapi.tempKeyQuery" %>
|
||||||
|
|
@ -117,15 +117,17 @@ namespace abbott_2024_event.webapi
|
||||||
if (line_displayname != lineUser.line_displayName && line_displayname != "")
|
if (line_displayname != lineUser.line_displayName && 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>(lineUser);
|
conn.Update<lineUser>(lineUser);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lineUser.lineUser_modifydate = DateTime.Now;
|
lineUser.lineUser_modifydate = DateTime.Now.AddMinutes(3);
|
||||||
conn.Update<lineUser>(lineUser);
|
conn.Update<lineUser>(lineUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<babyData> babyDatas = conn.Query<babyData>("select * from babyData where line_uid = @line_uid", new { line_uid = line_uid }).ToList();
|
|
||||||
|
|
||||||
|
List<babyData> babyDatas = conn.Query<babyData>("select * from babyData where line_uid = @line_uid", new { line_uid = line_uid }).ToList();
|
||||||
|
|
||||||
if (babyDatas.Count > 0) {
|
if (babyDatas.Count > 0) {
|
||||||
objRet.more_data = "Y";
|
objRet.more_data = "Y";
|
||||||
|
|
|
||||||
|
|
@ -98,14 +98,14 @@ namespace abbott_2024_event.webapi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lineUser != null) {
|
if (lineUser != null) {
|
||||||
if (lineUser.line_displayName != line_displayName) {
|
if (lineUser.line_displayName != line_displayName && line_displayName != "") {
|
||||||
lineUser.line_displayName= line_displayName;
|
lineUser.line_displayName= line_displayName;
|
||||||
|
|
||||||
lineUser.lineUser_modifydate = DateTime.Now;
|
lineUser.lineUser_modifydate = DateTime.Now;
|
||||||
conn.Update<lineUser>(lineUser);
|
conn.Update<lineUser>(lineUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lineUser.line_phone != line_phone) {
|
if (lineUser.line_phone != line_phone && line_phone != "") {
|
||||||
lineUser.line_phone= line_phone;
|
lineUser.line_phone= line_phone;
|
||||||
|
|
||||||
lineUser.lineUser_modifydate = DateTime.Now;
|
lineUser.lineUser_modifydate = DateTime.Now;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<%@ WebHandler Language="C#" CodeBehind="tempKeyQuery.ashx.cs" Class="abbott_2024_event.webapi.tempKeyQuery" %>
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// tempKeyQuery 的摘要描述
|
||||||
|
/// </summary>
|
||||||
|
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<babyRec>("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<babyData>("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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue