From f13a58e116b2ed62b6d3027b2652f75292f22a4c Mon Sep 17 00:00:00 2001 From: vipg Date: Mon, 17 Nov 2025 17:43:32 +0800 Subject: [PATCH] add --- backend/README.md | 7 +++++++ backend/sql/03_user.sql | 4 ++-- backend/src/logic4user/register.go | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 backend/README.md diff --git a/backend/README.md b/backend/README.md new file mode 100644 index 0000000..a7e5c32 --- /dev/null +++ b/backend/README.md @@ -0,0 +1,7 @@ +curl -X POST "127.0.0.1:20000/user/register" \ + -H "Content-Type: application/json" \ + -d '{ + "account": "test", + "password": "test12341234" + }' + --- \ No newline at end of file diff --git a/backend/sql/03_user.sql b/backend/sql/03_user.sql index 1610164..099caa7 100644 --- a/backend/sql/03_user.sql +++ b/backend/sql/03_user.sql @@ -73,8 +73,8 @@ BEGIN CREATE OR REPLACE VIEW user_info_view AS SELECT u.id AS user_id, - ua.account AS user_account, - up.password AS user_password, + ua.account AS account, + up.password AS password, u.deleted AS deleted FROM "user" u diff --git a/backend/src/logic4user/register.go b/backend/src/logic4user/register.go index 85b80a1..179ea25 100644 --- a/backend/src/logic4user/register.go +++ b/backend/src/logic4user/register.go @@ -171,7 +171,7 @@ func RegisterHandler(c *gin.Context) { // 7. 插入account表 insertAccountQuery := ` - INSERT INTO account (user_id, account) + INSERT INTO user_account (user_id, account) VALUES ($1, $2) ` zap.L().Info("💡 执行账号插入", @@ -196,7 +196,7 @@ func RegisterHandler(c *gin.Context) { // 8. 插入password表 insertPasswordQuery := ` - INSERT INTO password (user_id, password) + INSERT INTO user_password (user_id, password) VALUES ($1, $2) ` zap.L().Info("💡 执行密码插入",