登录注册(成功版)

Change-Id: I340bc8047774dd5ded63865812c44e33bbb734a5
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..3b41682
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+/mvnw text eol=lf
+*.cmd text eol=crlf
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..549e00a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..d58dfb7
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+wrapperVersion=3.3.2
+distributionType=only-script
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/data.sql b/data.sql
new file mode 100644
index 0000000..dadf755
--- /dev/null
+++ b/data.sql
@@ -0,0 +1,199 @@
+-- MySQL dump 10.13  Distrib 8.0.36, for Win64 (x86_64)
+--
+-- Host: 127.0.0.1    Database: ptpdata
+-- ------------------------------------------------------
+-- Server version	8.0.36
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!50503 SET NAMES utf8mb4 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `assement`
+--
+
+DROP TABLE IF EXISTS `assement`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `assement` (
+  `ID` int NOT NULL AUTO_INCREMENT,
+  `username` varchar(255) DEFAULT NULL,
+  `assementLevel` int DEFAULT NULL,
+  `startDate` date DEFAULT NULL,
+  `uploadNow` int DEFAULT NULL,
+  `downloadNow` int DEFAULT NULL,
+  `magicPointNow` int DEFAULT NULL,
+  PRIMARY KEY (`ID`),
+  KEY `username` (`username`),
+  KEY `assementLevel` (`assementLevel`),
+  CONSTRAINT `assement_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`),
+  CONSTRAINT `assement_ibfk_2` FOREIGN KEY (`assementLevel`) REFERENCES `assement_standerd` (`levelStanderd`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `assement`
+--
+
+LOCK TABLES `assement` WRITE;
+/*!40000 ALTER TABLE `assement` DISABLE KEYS */;
+/*!40000 ALTER TABLE `assement` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `assement_standerd`
+--
+
+DROP TABLE IF EXISTS `assement_standerd`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `assement_standerd` (
+  `levelStanderd` int NOT NULL,
+  `registTime` int DEFAULT NULL,
+  `uploadDemand` int DEFAULT NULL,
+  `downloadDemand` int DEFAULT NULL,
+  `magicPointDemand` int DEFAULT NULL,
+  PRIMARY KEY (`levelStanderd`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `assement_standerd`
+--
+
+LOCK TABLES `assement_standerd` WRITE;
+/*!40000 ALTER TABLE `assement_standerd` DISABLE KEYS */;
+/*!40000 ALTER TABLE `assement_standerd` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `invite_code`
+--
+
+DROP TABLE IF EXISTS `invite_code`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `invite_code` (
+  `ID` int NOT NULL AUTO_INCREMENT,
+  `code` varchar(8) NOT NULL,
+  `generateUser` varchar(20) DEFAULT NULL,
+  `isUsed` tinyint(1) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`ID`),
+  KEY `generateUser` (`generateUser`),
+  CONSTRAINT `invite_code_ibfk_1` FOREIGN KEY (`generateUser`) REFERENCES `user` (`username`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `invite_code`
+--
+
+LOCK TABLES `invite_code` WRITE;
+/*!40000 ALTER TABLE `invite_code` DISABLE KEYS */;
+INSERT INTO `invite_code` (`ID`, `code`, `generateUser`, `isUsed`) VALUES (1,'123','test',1);
+/*!40000 ALTER TABLE `invite_code` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `resourse`
+--
+
+DROP TABLE IF EXISTS `resourse`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `resourse` (
+  `ID` int NOT NULL AUTO_INCREMENT,
+  `username` varchar(255) DEFAULT NULL,
+  `resourseName` varchar(255) DEFAULT NULL,
+  `info` text,
+  `upload_date` date DEFAULT NULL,
+  `file_size` int DEFAULT NULL,
+  `discount` enum('yes','no') DEFAULT NULL,
+  PRIMARY KEY (`ID`),
+  KEY `username` (`username`),
+  CONSTRAINT `resourse_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `resourse`
+--
+
+LOCK TABLES `resourse` WRITE;
+/*!40000 ALTER TABLE `resourse` DISABLE KEYS */;
+/*!40000 ALTER TABLE `resourse` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `testdata`
+--
+
+DROP TABLE IF EXISTS `testdata`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `testdata` (
+  `name` varchar(100) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `testdata`
+--
+
+LOCK TABLES `testdata` WRITE;
+/*!40000 ALTER TABLE `testdata` DISABLE KEYS */;
+INSERT INTO `testdata` (`name`) VALUES ('zzz'),('newtest'),('newtest2');
+/*!40000 ALTER TABLE `testdata` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `user`
+--
+
+DROP TABLE IF EXISTS `user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `user` (
+  `username` varchar(20) NOT NULL,
+  `password` varchar(200) NOT NULL,
+  `authority` enum('USER','ADMIN','LIMIT','BAN') NOT NULL DEFAULT 'USER',
+  `level` int DEFAULT '0',
+  `registTime` date NOT NULL,
+  `lastLogin` date DEFAULT NULL,
+  `upload` int DEFAULT '0',
+  `download` int DEFAULT '0',
+  `shareRate` int DEFAULT '100',
+  `magicPoints` int DEFAULT '0',
+  PRIMARY KEY (`username`),
+  CONSTRAINT `user_chk_1` CHECK ((`level` between 0 and 6)),
+  CONSTRAINT `user_chk_2` CHECK ((`shareRate` between 0 and 100))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `user`
+--
+
+LOCK TABLES `user` WRITE;
+/*!40000 ALTER TABLE `user` DISABLE KEYS */;
+INSERT INTO `user` (`username`, `password`, `authority`, `level`, `registTime`, `lastLogin`, `upload`, `download`, `shareRate`, `magicPoints`) VALUES ('test','123456','USER',0,'2025-04-19',NULL,0,0,100,0),('ww','8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92','USER',0,'2025-04-20',NULL,0,0,100,0),('xxx','8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92','USER',0,'2025-04-20',NULL,0,0,100,0),('zzz','8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92','USER',0,'2025-04-20',NULL,0,0,100,0);
+/*!40000 ALTER TABLE `user` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2025-04-20 21:30:15
diff --git a/mvnw b/mvnw
new file mode 100644
index 0000000..19529dd
--- /dev/null
+++ b/mvnw
@@ -0,0 +1,259 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.3.2
+#
+# Optional ENV vars
+# -----------------
+#   JAVA_HOME - location of a JDK home dir, required when download maven via java source
+#   MVNW_REPOURL - repo url base for downloading maven distribution
+#   MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+#   MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
+# ----------------------------------------------------------------------------
+
+set -euf
+[ "${MVNW_VERBOSE-}" != debug ] || set -x
+
+# OS specific support.
+native_path() { printf %s\\n "$1"; }
+case "$(uname)" in
+CYGWIN* | MINGW*)
+  [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
+  native_path() { cygpath --path --windows "$1"; }
+  ;;
+esac
+
+# set JAVACMD and JAVACCMD
+set_java_home() {
+  # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
+  if [ -n "${JAVA_HOME-}" ]; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ]; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+      JAVACCMD="$JAVA_HOME/jre/sh/javac"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+      JAVACCMD="$JAVA_HOME/bin/javac"
+
+      if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
+        echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
+        echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
+        return 1
+      fi
+    fi
+  else
+    JAVACMD="$(
+      'set' +e
+      'unset' -f command 2>/dev/null
+      'command' -v java
+    )" || :
+    JAVACCMD="$(
+      'set' +e
+      'unset' -f command 2>/dev/null
+      'command' -v javac
+    )" || :
+
+    if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
+      echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
+      return 1
+    fi
+  fi
+}
+
+# hash string like Java String::hashCode
+hash_string() {
+  str="${1:-}" h=0
+  while [ -n "$str" ]; do
+    char="${str%"${str#?}"}"
+    h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
+    str="${str#?}"
+  done
+  printf %x\\n $h
+}
+
+verbose() { :; }
+[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
+
+die() {
+  printf %s\\n "$1" >&2
+  exit 1
+}
+
+trim() {
+  # MWRAPPER-139:
+  #   Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
+  #   Needed for removing poorly interpreted newline sequences when running in more
+  #   exotic environments such as mingw bash on Windows.
+  printf "%s" "${1}" | tr -d '[:space:]'
+}
+
+# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
+while IFS="=" read -r key value; do
+  case "${key-}" in
+  distributionUrl) distributionUrl=$(trim "${value-}") ;;
+  distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
+  esac
+done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+
+case "${distributionUrl##*/}" in
+maven-mvnd-*bin.*)
+  MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
+  case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
+  *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
+  :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
+  :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
+  :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
+  *)
+    echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
+    distributionPlatform=linux-amd64
+    ;;
+  esac
+  distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
+  ;;
+maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
+*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
+esac
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
+[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
+distributionUrlName="${distributionUrl##*/}"
+distributionUrlNameMain="${distributionUrlName%.*}"
+distributionUrlNameMain="${distributionUrlNameMain%-bin}"
+MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
+MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
+
+exec_maven() {
+  unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
+  exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
+}
+
+if [ -d "$MAVEN_HOME" ]; then
+  verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+  exec_maven "$@"
+fi
+
+case "${distributionUrl-}" in
+*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
+*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
+esac
+
+# prepare tmp dir
+if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
+  clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
+  trap clean HUP INT TERM EXIT
+else
+  die "cannot create temp dir"
+fi
+
+mkdir -p -- "${MAVEN_HOME%/*}"
+
+# Download and Install Apache Maven
+verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+verbose "Downloading from: $distributionUrl"
+verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+# select .zip or .tar.gz
+if ! command -v unzip >/dev/null; then
+  distributionUrl="${distributionUrl%.zip}.tar.gz"
+  distributionUrlName="${distributionUrl##*/}"
+fi
+
+# verbose opt
+__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
+[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
+
+# normalize http auth
+case "${MVNW_PASSWORD:+has-password}" in
+'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+esac
+
+if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
+  verbose "Found wget ... using wget"
+  wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
+elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
+  verbose "Found curl ... using curl"
+  curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
+elif set_java_home; then
+  verbose "Falling back to use Java to download"
+  javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
+  targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
+  cat >"$javaSource" <<-END
+	public class Downloader extends java.net.Authenticator
+	{
+	  protected java.net.PasswordAuthentication getPasswordAuthentication()
+	  {
+	    return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
+	  }
+	  public static void main( String[] args ) throws Exception
+	  {
+	    setDefault( new Downloader() );
+	    java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
+	  }
+	}
+	END
+  # For Cygwin/MinGW, switch paths to Windows format before running javac and java
+  verbose " - Compiling Downloader.java ..."
+  "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
+  verbose " - Running Downloader.java ..."
+  "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
+fi
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+if [ -n "${distributionSha256Sum-}" ]; then
+  distributionSha256Result=false
+  if [ "$MVN_CMD" = mvnd.sh ]; then
+    echo "Checksum validation is not supported for maven-mvnd." >&2
+    echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+    exit 1
+  elif command -v sha256sum >/dev/null; then
+    if echo "$distributionSha256Sum  $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
+      distributionSha256Result=true
+    fi
+  elif command -v shasum >/dev/null; then
+    if echo "$distributionSha256Sum  $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
+      distributionSha256Result=true
+    fi
+  else
+    echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
+    echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+    exit 1
+  fi
+  if [ $distributionSha256Result = false ]; then
+    echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
+    echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
+    exit 1
+  fi
+fi
+
+# unzip and move
+if command -v unzip >/dev/null; then
+  unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
+else
+  tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
+fi
+printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
+mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
+
+clean || :
+exec_maven "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
new file mode 100644
index 0000000..249bdf3
--- /dev/null
+++ b/mvnw.cmd
@@ -0,0 +1,149 @@
+<# : batch portion
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.3.2
+@REM
+@REM Optional ENV vars
+@REM   MVNW_REPOURL - repo url base for downloading maven distribution
+@REM   MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+@REM   MVNW_VERBOSE - true: enable verbose log; others: silence the output
+@REM ----------------------------------------------------------------------------
+
+@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
+@SET __MVNW_CMD__=
+@SET __MVNW_ERROR__=
+@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
+@SET PSModulePath=
+@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
+  IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
+)
+@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
+@SET __MVNW_PSMODULEP_SAVE=
+@SET __MVNW_ARG0_NAME__=
+@SET MVNW_USERNAME=
+@SET MVNW_PASSWORD=
+@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
+@echo Cannot start maven from wrapper >&2 && exit /b 1
+@GOTO :EOF
+: end batch / begin powershell #>
+
+$ErrorActionPreference = "Stop"
+if ($env:MVNW_VERBOSE -eq "true") {
+  $VerbosePreference = "Continue"
+}
+
+# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
+$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
+if (!$distributionUrl) {
+  Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
+}
+
+switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
+  "maven-mvnd-*" {
+    $USE_MVND = $true
+    $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
+    $MVN_CMD = "mvnd.cmd"
+    break
+  }
+  default {
+    $USE_MVND = $false
+    $MVN_CMD = $script -replace '^mvnw','mvn'
+    break
+  }
+}
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
+if ($env:MVNW_REPOURL) {
+  $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
+  $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
+}
+$distributionUrlName = $distributionUrl -replace '^.*/',''
+$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
+$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
+if ($env:MAVEN_USER_HOME) {
+  $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
+}
+$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
+$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
+
+if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
+  Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+  Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
+  exit $?
+}
+
+if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
+  Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
+}
+
+# prepare tmp dir
+$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
+$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
+$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
+trap {
+  if ($TMP_DOWNLOAD_DIR.Exists) {
+    try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+    catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+  }
+}
+
+New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
+
+# Download and Install Apache Maven
+Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+Write-Verbose "Downloading from: $distributionUrl"
+Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+$webclient = New-Object System.Net.WebClient
+if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
+  $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
+}
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
+if ($distributionSha256Sum) {
+  if ($USE_MVND) {
+    Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
+  }
+  Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
+  if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
+    Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
+  }
+}
+
+# unzip and move
+Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
+Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
+try {
+  Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
+} catch {
+  if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
+    Write-Error "fail to move MAVEN_HOME"
+  }
+} finally {
+  try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+  catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+}
+
+Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..8e12b26
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>3.4.3</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.ptp</groupId>
+    <artifactId>PTPlatform</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>PTPlatform</name>
+    <description>PTPlatform</description>
+    <properties>
+        <java.version>17</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+        </dependency>
+        <!-- Spring boot 核心 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.lionsoul</groupId>
+            <artifactId>ip2region</artifactId>
+            <version>1.7.2</version>
+        </dependency>
+        <!-- MyBatis Plus -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
+            <version>3.5.10.1</version>
+        </dependency>
+        <!-- 数据库-->
+        <!-- Mysql依赖包 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.25</version>
+            <scope>runtime</scope>
+        </dependency>
+        <!-- H2 内存数据库 -->
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- druid 数据连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.20</version>
+        </dependency>
+
+        <!-- jwt登录验证 -->
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+
+        <!-- 日期数据显示 -->
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+
+        <!-- 单元测试 -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+        </dependency>
+
+        <!-- Mockito -->
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>${mockito.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Maven 编译插件 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.13.0</version>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                </configuration>
+            </plugin>
+
+            <!-- 解决 Mockito 警告 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>3.5.2</version>
+                <configuration>
+                    <argLine>
+                        -javaagent:"${settings.localRepository}/net/bytebuddy/byte-buddy-agent/1.15.11/byte-buddy-agent-1.15.11.jar"
+                    </argLine>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/src/main/java/com/ptp/ptplatform/PtPlatformApplication.java b/src/main/java/com/ptp/ptplatform/PtPlatformApplication.java
new file mode 100644
index 0000000..deff713
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/PtPlatformApplication.java
@@ -0,0 +1,16 @@
+package com.ptp.ptplatform;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@MapperScan("com.ptp.ptplatform.mapper")
+public class PtPlatformApplication {
+
+    public static void main(String[] args) {
+
+        SpringApplication.run(PtPlatformApplication.class, args);
+    }
+
+}
diff --git a/src/main/java/com/ptp/ptplatform/config/WebConfig.java b/src/main/java/com/ptp/ptplatform/config/WebConfig.java
new file mode 100644
index 0000000..d0fdb8e
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/config/WebConfig.java
@@ -0,0 +1,21 @@
+// 配置文件
+package com.ptp.ptplatform.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+
+        registry.addMapping("/**")  // 允许所有路径跨源请求
+                .allowedOrigins("http://localhost:3000")  // 允许指定来源
+                .allowedMethods("GET", "POST", "PUT", "DELETE")  // 允许的请求方法
+                .allowCredentials(true);  // 是否允许携带凭证
+
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ptp/ptplatform/controller/InviteCodeController.java b/src/main/java/com/ptp/ptplatform/controller/InviteCodeController.java
new file mode 100644
index 0000000..cf482c6
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/controller/InviteCodeController.java
@@ -0,0 +1,4 @@
+package com.ptp.ptplatform.controller;
+
+public class InviteCodeController {
+}
diff --git a/src/main/java/com/ptp/ptplatform/controller/UserController.java b/src/main/java/com/ptp/ptplatform/controller/UserController.java
new file mode 100644
index 0000000..0b1dcb2
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/controller/UserController.java
@@ -0,0 +1,89 @@
+//controller 文件夹中文件类似于view
+// usermapper 实现用户登录注册等内容
+
+package com.ptp.ptplatform.controller;
+
+import com.ptp.ptplatform.entity.*;
+import com.ptp.ptplatform.mapper.UserMapper;
+import com.ptp.ptplatform.mapper.InviteCodeMapper;
+import jakarta.annotation.Resource;
+import org.springframework.web.bind.annotation.*;
+import com.ptp.ptplatform.utils.Result;
+import com.ptp.ptplatform.utils.JwtUtils;
+import com.ptp.ptplatform.entity.USER;
+import java.util.Date;
+
+@RestController
+@RequestMapping("/user")
+@CrossOrigin //启用跨域
+public class UserController {
+
+    @Resource
+    private UserMapper userMapper;
+    @Resource
+    private InviteCodeMapper inviteCodeMapper;
+
+    @GetMapping("/info") //获取
+    public Result info(String token) {
+        String username = JwtUtils.getClaimByToken(token).getSubject();
+        return Result.ok().data("name", username);
+    }
+
+    @PostMapping("/login") //用户登录
+    public Result login(String username, String password) {
+        USER user = userMapper.selectByUsername(username);
+
+        if (user != null) {
+            // 将用户输入的密码进行哈希处理
+            String hashedPassword = user.hashPassword(password);
+
+            // 比较用户输入的密码哈希值和数据库中的密码哈希值
+            if (hashedPassword.equals(user.getPassword())) {
+                String token = JwtUtils.generateToken(user.getUsername());
+                return Result.ok().data("token", token);  // 返回令牌给前端
+            } else {
+                return Result.error().setMessage("密码错误");
+            }
+        } else {
+            return Result.error().setMessage("用户不存在");
+        }
+    }
+
+    @PostMapping("/regist")
+    public Result regist(String username, String password, String code) {
+        USER userCheck = userMapper.selectByUsername(username);
+        if (userCheck == null) {
+            //获取邀请码
+            INVITE_CODE inviteCode = inviteCodeMapper.selectByCode(code);
+            if(inviteCode != null){
+                System.out.println(inviteCode.getIsUsed());
+
+                if(!inviteCode.getIsUsed()){
+                    Date time = new Date();
+                    USER user = new USER(username, password, time) ;
+
+                    userMapper.insertUser(user);
+                    inviteCodeMapper.updateCodeUser(code);
+
+                    return Result.ok().setMessage("新建用户成功");
+                } else {
+                    return Result.error().setMessage("邀请码已经被使用,注册失败");
+                }
+
+            } else {
+                return Result.error().setMessage("邀请码不存在,注册失败");
+            }
+
+        } else {
+            return Result.error().setMessage("用户名已存在,注册失败");
+        }
+
+
+    }
+
+    @PostMapping("/logout")
+    public Result logout(String token) {
+        return Result.ok();
+    }
+
+}
diff --git a/src/main/java/com/ptp/ptplatform/entity/INVITE_CODE.java b/src/main/java/com/ptp/ptplatform/entity/INVITE_CODE.java
new file mode 100644
index 0000000..d0a5a53
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/entity/INVITE_CODE.java
@@ -0,0 +1,51 @@
+// 邀请码类
+// 注册时使用的
+package com.ptp.ptplatform.entity;
+
+import jakarta.persistence.*;
+import java.io.Serializable;
+
+@Table(name = "invite_code")
+public class INVITE_CODE {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    private String code;
+    private String generateUser;
+    private Boolean isUsed;
+
+    //方法
+    public Integer getId() {
+        return id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getGenerateUser() {
+        return generateUser;
+    }
+
+    public Boolean getIsUsed() {
+        return isUsed;
+    }
+
+    public void setIsUsed(Boolean isUsed) {
+        this.isUsed = isUsed;
+    }
+
+    // Constructor (optional)
+    public INVITE_CODE() {}
+
+    public INVITE_CODE(String code, String generateUser) {
+        this.code = code;
+        this.generateUser = generateUser;
+        this.isUsed = false;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ptp/ptplatform/entity/USER.java b/src/main/java/com/ptp/ptplatform/entity/USER.java
new file mode 100644
index 0000000..84e5c33
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/entity/USER.java
@@ -0,0 +1,156 @@
+// 用户类
+// @GeneratedValue(strategy = GenerationType.IDENTITY) 对于一些需要自动生成的主键id进行注解
+
+package com.ptp.ptplatform.entity;
+
+import jakarta.persistence.*;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Date;
+
+@Table(name = "user")
+public class USER {
+
+    @jakarta.persistence.Id
+    private String username;
+    private String password;
+
+    @Enumerated(EnumType.STRING)
+    private Authority authority;
+
+    private int level; // 用户等级0-6
+
+    @Temporal(TemporalType.DATE)
+    private Date registTime = new Date();
+
+    @Temporal(TemporalType.DATE)
+    private Date lastLogin;
+
+    private int upload;
+    private int download;
+    private int shareRate;
+    private int magicPoints;
+
+    public enum Authority {
+        USER, ADMIN, LIMIT, BAN
+    }
+
+
+    // 函数
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public Authority getAuthority() {
+        return authority;
+    }
+
+    public void setAuthority(Authority authority) {
+        this.authority = authority;
+    }
+
+    public int getLevel() {
+        return level;
+    }
+
+    public void setLevel(int level) {
+        this.level = level;
+    }
+
+    public Date getRegistTime() {
+        return registTime;
+    }
+
+    public void setRegistTime(Date registTime) {
+        this.registTime = registTime;
+    }
+
+    public Date getLastLogin() {
+        return lastLogin;
+    }
+
+    public void setLastLogin(Date lastLogin) {
+        this.lastLogin = lastLogin;
+    }
+
+    public int getUpload() {
+        return upload;
+    }
+
+    public void setUpload(int upload) {
+        this.upload = upload;
+    }
+
+    public int getDownload() {
+        return download;
+    }
+
+    public void setDownload(int download) {
+        this.download = download;
+    }
+
+    public int getShareRate() {
+        return shareRate;
+    }
+
+    public void setShareRate(int shareRate) {
+        this.shareRate = shareRate;
+    }
+
+    public int getMagicPoints() {
+        return magicPoints;
+    }
+
+    public void setMagicPoints(int magicPoints) {
+        this.magicPoints = magicPoints;
+    }
+
+    public USER() {
+    }
+
+    public USER(String username, String password, Date registTime) {
+        this.username = username;
+        this.registTime = registTime;
+
+        this.password = hashPassword(password);;
+
+        this.authority = Authority.USER;
+        this.level = 0;
+        this.lastLogin = null;
+        this.upload = 0;
+        this.download = 0;
+        this.shareRate = 100;
+        this.magicPoints = 0;
+    }
+
+    public String hashPassword(String password) {
+        try {
+            // 使用SHA-256算法
+            MessageDigest digest = MessageDigest.getInstance("SHA-256");
+            byte[] hashBytes = digest.digest(password.getBytes());
+
+            // 将字节数组转换为十六进制字符串
+            StringBuilder hexString = new StringBuilder();
+            for (byte b : hashBytes) {
+                hexString.append(String.format("%02x", b));
+            }
+
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException("Error hashing password", e);
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ptp/ptplatform/entity/testdata.java b/src/main/java/com/ptp/ptplatform/entity/testdata.java
new file mode 100644
index 0000000..7d6d88e
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/entity/testdata.java
@@ -0,0 +1,15 @@
+// model类 负责管理数据库数据和sb的映射
+
+package com.ptp.ptplatform.entity;
+
+public class testdata {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/src/main/java/com/ptp/ptplatform/mapper/InviteCodeMapper.java b/src/main/java/com/ptp/ptplatform/mapper/InviteCodeMapper.java
new file mode 100644
index 0000000..612c7fb
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/mapper/InviteCodeMapper.java
@@ -0,0 +1,18 @@
+package com.ptp.ptplatform.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ptp.ptplatform.entity.INVITE_CODE;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.web.service.annotation.PutExchange;
+
+@Mapper
+public interface InviteCodeMapper extends BaseMapper<INVITE_CODE> {
+    //查询
+    @Select("SELECT * FROM invite_code WHERE code = #{code}")
+    INVITE_CODE selectByCode(String code);
+
+    @Update("UPDATE invite_code SET isused = true WHERE code = #{code}")
+    int updateCodeUser(String code);
+}
diff --git a/src/main/java/com/ptp/ptplatform/mapper/UserMapper.java b/src/main/java/com/ptp/ptplatform/mapper/UserMapper.java
new file mode 100644
index 0000000..024807e
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/mapper/UserMapper.java
@@ -0,0 +1,23 @@
+package com.ptp.ptplatform.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ptp.ptplatform.entity.USER;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface UserMapper extends BaseMapper<USER> {
+    // 查询
+    @Select("SELECT * FROM user WHERE username = #{username}")
+    USER selectByUsername(String username);
+
+    @Select("SELECT * FROM user WHERE username = #{username} AND password = #{password}")
+    USER selectByUsernameAndPassword(String username, String password);
+
+    // 注册用户
+    @Insert("INSERT INTO user (username, password, registTime) " +
+            "VALUES (#{username}, #{password}, #{registTime})")
+    int insertUser(USER user);
+}
diff --git a/src/main/java/com/ptp/ptplatform/utils/JwtUtils.java b/src/main/java/com/ptp/ptplatform/utils/JwtUtils.java
new file mode 100644
index 0000000..57bff31
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/utils/JwtUtils.java
@@ -0,0 +1,32 @@
+package com.ptp.ptplatform.utils;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+
+import javax.xml.crypto.Data;
+import java.util.Date;
+
+public class JwtUtils {
+    private static long expire = 36000;
+    private static String secret = "abcdefgg";
+
+    public static String generateToken(String username){
+        Date now = new Date();
+        Date expiration = new Date(now.getTime() + 1000 * expire);
+        return Jwts.builder()
+                .setHeaderParam("type","JWT")
+                .setSubject(username)
+                .setIssuedAt(now)
+                .setExpiration(expiration)
+                .signWith(SignatureAlgorithm.HS512,secret)
+                .compact();
+
+    }
+    public static Claims getClaimByToken(String token){
+        return Jwts.parser()
+                .setSigningKey(secret)
+                .parseClaimsJws(token)
+                .getBody();
+    }
+}
diff --git a/src/main/java/com/ptp/ptplatform/utils/Result.java b/src/main/java/com/ptp/ptplatform/utils/Result.java
new file mode 100644
index 0000000..04a3290
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/utils/Result.java
@@ -0,0 +1,77 @@
+package com.ptp.ptplatform.utils;
+import java.util.HashMap;
+import java.util.Map;
+
+public class Result {
+    private Boolean success;
+    private Integer code;
+    private String message;
+    private Map<String,Object> data = new HashMap<>();
+
+    public Boolean getSuccess() {
+        return success;
+    }
+    public void setSuccess(Boolean success) {
+        this.success = success;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+    public String getMessage() {
+        return message;
+    }
+    public Result setMessage(String message) {
+        this.message = message;
+        return this;
+    }
+    public Map<String, Object> getData() {
+        return data;
+    }
+    public void setData(Map<String, Object> data) {
+        this.data = data;
+    }
+
+    private Result() {}
+    public static Result ok() {
+        Result result = new Result();
+        result.setSuccess(true);
+        result.setCode(resultCode.SUCCESS);
+        result.setMessage("成功");
+        return result;
+    }
+
+    public static Result error() {
+        Result result = new Result();
+        result.setSuccess(false);
+        result.setCode(resultCode.ERROR);
+        result.setMessage("失败");
+        return result;
+    }
+
+    public Result success(Boolean success) {
+        this.setSuccess(success);
+        return this;
+    }
+    public Result message(String message) {
+        this.setMessage(message);
+        return this;
+    }
+    public Result code(Integer code) {
+        this.setCode(code);
+        return this;
+    }
+
+    public Result data(String key, Object value) {
+        this.data.put(key,value);
+        return this;
+    }
+
+    public Result data(Map<String, Object> map) {
+        this.setData(map);
+        return this;
+    }
+}
diff --git a/src/main/java/com/ptp/ptplatform/utils/resultCode.java b/src/main/java/com/ptp/ptplatform/utils/resultCode.java
new file mode 100644
index 0000000..abd93d9
--- /dev/null
+++ b/src/main/java/com/ptp/ptplatform/utils/resultCode.java
@@ -0,0 +1,8 @@
+//对返回的状态码进行设置
+package com.ptp.ptplatform.utils;
+
+public interface resultCode {
+    public static Integer SUCCESS = 200;
+    public static Integer ERROR = 500;
+
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
new file mode 100644
index 0000000..e1226b0
--- /dev/null
+++ b/src/main/resources/application.properties
@@ -0,0 +1,29 @@
+spring.application.name=PTPlatform
+
+# debug mode
+#debug=true
+spring.profiles.active=test
+
+# running port
+server.port = 8088
+
+# hot deployment
+spring.devtools.restart.enabled=true
+spring.devtools.restart.additional-paths=src/main/java
+spring.devtools.restart.exclude=static/**
+
+# database setting
+spring.datasourse.type=com.alibaba.druid.pool.DruidDataSource
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.url=jdbc:mysql://localhost:3306/ptpdata?useUnicode=true&characterEncoding=utf8
+spring.datasource.username=root
+spring.datasource.password=yumu1412
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+
+# Hibernate properties
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
+spring.jpa.hibernate.ddl-auto=update
+
+# MyBatis-Plus properties
+mybatis-plus.mapper-locations=classpath:/mapper/*.xml
+mybatis-plus.type-aliases-package=com.example.demo.model
\ No newline at end of file
diff --git a/src/test/java/com/ptp/ptplatform/PtPlatformApplicationTests.java b/src/test/java/com/ptp/ptplatform/PtPlatformApplicationTests.java
new file mode 100644
index 0000000..942ee55
--- /dev/null
+++ b/src/test/java/com/ptp/ptplatform/PtPlatformApplicationTests.java
@@ -0,0 +1,15 @@
+package com.ptp.ptplatform;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+
+@SpringBootTest
+@ActiveProfiles("test")
+class PtPlatformApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}
diff --git a/src/test/java/com/ptp/ptplatform/controller/UserControllerTest.java b/src/test/java/com/ptp/ptplatform/controller/UserControllerTest.java
new file mode 100644
index 0000000..ebe2353
--- /dev/null
+++ b/src/test/java/com/ptp/ptplatform/controller/UserControllerTest.java
@@ -0,0 +1,194 @@
+package com.ptp.ptplatform.controller;
+
+import com.ptp.ptplatform.entity.INVITE_CODE;
+import com.ptp.ptplatform.entity.USER;
+import com.ptp.ptplatform.mapper.InviteCodeMapper;
+import com.ptp.ptplatform.mapper.UserMapper;
+import com.ptp.ptplatform.utils.JwtUtils;
+import com.ptp.ptplatform.utils.Result;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.util.Date;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+class UserControllerTest {
+
+    @Mock
+    private UserMapper userMapper;
+
+    @Mock
+    private InviteCodeMapper inviteCodeMapper;
+
+    @Mock
+    private JwtUtils jwtUtils;
+
+    @InjectMocks
+    private UserController userController;
+
+    @BeforeEach
+    void setUp() {
+        MockitoAnnotations.openMocks(this);
+    }
+
+//    @Test
+//    void testLogin_Success() {
+//        // 准备测试数据
+//        String username = "testUser";
+//        String password = "testPass";
+//        String hashedPassword = "hashedTestPass";
+//        String token = "generatedToken";
+//
+//        // 创建 mock 对象
+//        USER mockUser = mock(USER.class);
+//        // 使用Mockito方式定义行为
+//        when(mockUser.getUsername()).thenReturn(username);
+//        when(mockUser.getPassword()).thenReturn(hashedPassword);
+//        // 如果 hashPassword 需要被调用
+//        when(mockUser.hashPassword(password)).thenReturn(hashedPassword);
+//
+//        // 模拟Mapper行为
+//        when(userMapper.selectByUsername(username)).thenReturn(mockUser);
+//        when(jwtUtils.generateToken(username)).thenReturn(token);
+//
+//        // 执行测试
+//        Result result = userController.login(username, password);
+//
+//        // 验证结果
+//        assertEquals(200, result.getCode());
+//        assertEquals(token, result.getData().get("token"));
+//        verify(userMapper, times(1)).selectByUsername(username);
+//        verify(jwtUtils, times(1)).generateToken(username);
+//    }
+
+    @Test
+    void testLogin_UserNotFound() {
+        String username = "nonExistUser";
+        String password = "anyPass";
+
+        when(userMapper.selectByUsername(username)).thenReturn(null);
+
+        Result result = userController.login(username, password);
+
+        assertEquals(500, result.getCode());
+        assertEquals("用户不存在", result.getMessage());
+    }
+
+//    @Test
+//    void testLogin_WrongPassword() {
+//        String username = "testUser";
+//        String password = "wrongPass";
+//        String hashedPassword = "hashedTestPass";
+//
+//        USER mockUser = new USER();
+//        mockUser.setUsername(username);
+//        mockUser.setPassword(hashedPassword);
+//
+//        when(userMapper.selectByUsername(username)).thenReturn(mockUser);
+//        when(mockUser.hashPassword(password)).thenReturn("wrongHash");
+//
+//        Result result = userController.login(username, password);
+//
+//        assertEquals(500, result.getCode());
+//        assertEquals("密码错误", result.getMessage());
+//    }
+
+    @Test
+    void testRegister_Success() {
+        String username = "newUser";
+        String password = "newPass";
+        String code = "validCode";
+        Date now = new Date();
+
+        INVITE_CODE mockInviteCode = new INVITE_CODE();
+        mockInviteCode.setIsUsed(false);
+
+        when(userMapper.selectByUsername(username)).thenReturn(null);
+        when(inviteCodeMapper.selectByCode(code)).thenReturn(mockInviteCode);
+
+        Result result = userController.regist(username, password, code);
+
+        assertEquals(200, result.getCode());
+        assertEquals("新建用户成功", result.getMessage());
+        verify(userMapper, times(1)).insertUser(any(USER.class));
+        verify(inviteCodeMapper, times(1)).updateCodeUser(code);
+    }
+
+    @Test
+    void testRegister_UsernameExists() {
+        String username = "existingUser";
+        String password = "anyPass";
+        String code = "anyCode";
+
+        USER existingUser = new USER();
+        when(userMapper.selectByUsername(username)).thenReturn(existingUser);
+
+        Result result = userController.regist(username, password, code);
+
+        assertEquals(500, result.getCode());
+        assertEquals("用户名已存在,注册失败", result.getMessage());
+        verify(userMapper, never()).insertUser(any());
+    }
+
+    @Test
+    void testRegister_InvalidCode() {
+        String username = "newUser";
+        String password = "newPass";
+        String code = "invalidCode";
+
+        when(userMapper.selectByUsername(username)).thenReturn(null);
+        when(inviteCodeMapper.selectByCode(code)).thenReturn(null);
+
+        Result result = userController.regist(username, password, code);
+
+        assertEquals(500, result.getCode());
+        assertEquals("邀请码不存在,注册失败", result.getMessage());
+        verify(userMapper, never()).insertUser(any());
+    }
+
+    @Test
+    void testRegister_UsedCode() {
+        String username = "newUser";
+        String password = "newPass";
+        String code = "usedCode";
+
+        INVITE_CODE usedCode = new INVITE_CODE();
+        usedCode.setIsUsed(true);
+
+        when(userMapper.selectByUsername(username)).thenReturn(null);
+        when(inviteCodeMapper.selectByCode(code)).thenReturn(usedCode);
+
+        Result result = userController.regist(username, password, code);
+
+        assertEquals(500, result.getCode());
+        assertEquals("邀请码已经被使用,注册失败", result.getMessage());
+        verify(userMapper, never()).insertUser(any());
+    }
+
+//    @Test
+//    void testGetUserInfo_Success() {
+//        String token = "validToken";
+//        String username = "testUser";
+//
+//        when(jwtUtils.getClaimByToken(token).getSubject()).thenReturn(username);
+//
+//        Result result = userController.info(token);
+//
+//        assertEquals(200, result.getCode());
+//        assertEquals(username, result.getData().get("name"));
+//    }
+
+    @Test
+    void testLogout() {
+        String token = "anyToken";
+
+        Result result = userController.logout(token);
+
+        assertEquals(200, result.getCode());
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/application-test.yml b/src/test/resources/application-test.yml
new file mode 100644
index 0000000..45122fa
--- /dev/null
+++ b/src/test/resources/application-test.yml
@@ -0,0 +1,41 @@
+# 测试环境配置
+spring:
+  application:
+    name: PTPlatform-test  # 区分测试环境
+  
+  # 数据源配置 (H2 内存数据库)
+  datasource:
+    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=MYSQL  # 模拟MySQL语法
+    driver-class-name: org.h2.Driver
+    username: sa
+    password:
+
+  
+  # JPA/Hibernate 配置
+  jpa:
+    hibernate:
+      ddl-auto: update  # 自动更新表结构
+    show-sql: true  # 显示SQL日志
+    properties:
+      hibernate:
+        dialect: org.hibernate.dialect.H2Dialect
+        format_sql: true
+  
+  # 关闭开发工具(测试环境不需要热部署)
+  devtools:
+    restart:
+      enabled: false
+  sql:
+    init:
+      platform: h2
+
+# MyBatis-Plus 测试配置
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl  # 输出SQL日志
+  mapper-locations: classpath:/mapper/*.xml
+  type-aliases-package: com.example.demo.model
+
+# 测试专用端口
+server:
+  port: 0  # 随机端口,避免冲突
\ No newline at end of file