From 623254de8413997421f921eaae82ab417e658e2c Mon Sep 17 00:00:00 2001 From: wsh5485 Date: Mon, 16 Jun 2025 13:11:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E6=8E=A7=E5=88=B6=E9=A1=B5=E9=9D=A2=E5=B9=B6?= =?UTF-8?q?=E8=BF=81=E7=A7=BBPHP=E5=AE=9E=E7=8E=B0=E5=88=B0ASP.NET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加新的ASP.NET页面用于功能开关控制,包含前端界面和后端逻辑 删除旧的PHP实现文件,完成技术栈迁移 --- E3_ycsys.aspx | 39 ++++++++++++++++++++ E3_ycsys.aspx.cs | 45 +++++++++++++++++++++++ E3_ycsys.php | 95 ------------------------------------------------ 3 files changed, 84 insertions(+), 95 deletions(-) create mode 100644 E3_ycsys.aspx create mode 100644 E3_ycsys.aspx.cs delete mode 100644 E3_ycsys.php diff --git a/E3_ycsys.aspx b/E3_ycsys.aspx new file mode 100644 index 0000000..a64f69f --- /dev/null +++ b/E3_ycsys.aspx @@ -0,0 +1,39 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="E3_ycsys.aspx.cs" Inherits="E3_ycsys" %> + + + + + + + 功能开关控制 + + + +

功能开关控制

+ + +
+
+
<%# Eval("name") %>
+
<%# Eval("description") %>
+
+
+ <%# (int)Eval("status") == 1 ? + "关闭(已启用)" : + "开启(已禁用)" %> +
+
+
+
+ + \ No newline at end of file diff --git a/E3_ycsys.aspx.cs b/E3_ycsys.aspx.cs new file mode 100644 index 0000000..93ccd28 --- /dev/null +++ b/E3_ycsys.aspx.cs @@ -0,0 +1,45 @@ +using System; +using System.Data; +using System.Data.SqlClient; +using System.Web; + +public partial class E3_ycsys : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + string connectionString = "Server=localhost;Database=your_database;User Id=your_username;Password=your_password;"; + + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + // 处理开关操作 + if (!string.IsNullOrEmpty(Request.QueryString["action"]) && !string.IsNullOrEmpty(Request.QueryString["id"])) + { + string id = Request.QueryString["id"]; + int status = Request.QueryString["action"] == "enable" ? 1 : 0; + + string sql = "UPDATE features SET status = @status WHERE id = @id"; + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.Parameters.AddWithValue("@status", status); + cmd.Parameters.AddWithValue("@id", id); + cmd.ExecuteNonQuery(); + + string logSql = "INSERT INTO operation_logs (feature_id, action, operation_time) VALUES (@id, @action, GETDATE())"; + SqlCommand logCmd = new SqlCommand(logSql, conn); + logCmd.Parameters.AddWithValue("@id", id); + logCmd.Parameters.AddWithValue("@action", Request.QueryString["action"]); + logCmd.ExecuteNonQuery(); + } + + // 查询功能列表 + string querySql = "SELECT id, name, description, status FROM features"; + SqlDataAdapter adapter = new SqlDataAdapter(querySql, conn); + DataTable dt = new DataTable(); + adapter.Fill(dt); + + FeaturesRepeater.DataSource = dt; + FeaturesRepeater.DataBind(); + } + } +} \ No newline at end of file diff --git a/E3_ycsys.php b/E3_ycsys.php deleted file mode 100644 index a137858..0000000 --- a/E3_ycsys.php +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - 功能开关控制 - - - -

功能开关控制

- -
-
-
-
-
-
- - 关闭 - (已启用) - - 开启 - (已禁用) - -
-
- - - - - - \ No newline at end of file