diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/ApifoxUploaderProjectSetting.xml b/.idea/ApifoxUploaderProjectSetting.xml
new file mode 100644
index 0000000..52953f0
--- /dev/null
+++ b/.idea/ApifoxUploaderProjectSetting.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..1d5a132
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..4e45e27
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..abb532a
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..af6b4d4
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..cd539c9
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/unilife.iml b/.idea/unilife.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/unilife.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UniLife开发文档.md b/UniLife开发文档.md
new file mode 100644
index 0000000..984a740
--- /dev/null
+++ b/UniLife开发文档.md
@@ -0,0 +1,258 @@
+## 一、API规范
+
+### 1.1 基础信息
+
+
+
+- **基础URL**: `http://localhost:8080`(本地测试)
+
+- **接口格式**: RESTful API
+
+- **数据格式**: JSON
+
+- **字符编码**: UTF-8
+
+- **认证方式**: JWT (JSON Web Token)
+
+
+
+- **GET**: 获取资源
+- **POST**: 创建资源
+- **PUT**: 更新资源(全量更新)
+- **PATCH**: 部分更新资源
+- **DELETE**: 删除资源
+
+### 1.2 响应规范
+
+#### 响应状态码
+
+- **200**: 成功
+- **400**: 请求参数错误
+- **401**: 未授权
+- **403**: 禁止访问
+- **404**: 资源不存在
+- **500**: 服务器内部错误
+
+#### 后端相应格式
+
+成功响应:
+
+```json
+{
+ "code": 200, // 200表示成功
+ "message": "success",
+ "data": { // 实际返回数据
+ // ...
+ }
+}
+```
+
+错误相应:
+
+```json
+{
+ "code": 400,
+ "message": "参数错误", // 错误信息
+ "data": null
+}
+```
+
+## 二、 数据库设计
+
+### 2.1用户表设计 (users)
+
+| 字段名 | 类型 | 约束 | 说明 |
+| ----------- | ------------ | ----------------------------------------------------- | ------------------------------------ |
+| id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | 用户ID |
+| username | VARCHAR(50) | NOT NULL, UNIQUE | 用户名 |
+| email | VARCHAR(100) | NOT NULL, UNIQUE | 邮箱地址(学校邮箱) |
+| password | VARCHAR(255) | NOT NULL | 密码(加密存储) |
+| nickname | VARCHAR(50) | NOT NULL | 昵称 |
+| avatar | VARCHAR(255) | | 头像URL |
+| bio | TEXT | | 个人简介 |
+| gender | TINYINT | | 性别(0-未知, 1-男, 2-女) |
+| student_id | VARCHAR(20) | UNIQUE | 学号 |
+| department | VARCHAR(100) | | 院系 |
+| major | VARCHAR(100) | | 专业 |
+| grade | VARCHAR(20) | | 年级 |
+| points | INT | DEFAULT 0 | 积分 |
+| role | TINYINT | DEFAULT 0 | 角色(0-普通用户, 1-版主, 2-管理员) |
+| status | TINYINT | DEFAULT 1 | 状态(0-禁用, 1-启用) |
+| is_verified | TINYINT | DEFAULT 0 | 是否验证(0-未验证, 1-已验证) |
+| login_ip | VARCHAR(50) | | 最近登录IP |
+| login_time | DATETIME | | 最近登录时间 |
+| created_at | DATETIME | DEFAULT CURRENT_TIMESTAMP | 创建时间 |
+| updated_at | DATETIME | DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP | 更新时间 |
+
+#### 建表语句
+
+```sql
+CREATE TABLE `users` (
+ `id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '用户ID',
+ `username` VARCHAR(50) NOT NULL UNIQUE COMMENT '用户名',
+ `email` VARCHAR(100) NOT NULL UNIQUE COMMENT '邮箱地址(学校邮箱)',
+ `password` VARCHAR(255) NOT NULL COMMENT '密码(加密存储)',
+ `nickname` VARCHAR(50) NOT NULL COMMENT '昵称',
+ `avatar` VARCHAR(255) DEFAULT NULL COMMENT '头像URL',
+ `bio` TEXT DEFAULT NULL COMMENT '个人简介',
+ `gender` TINYINT DEFAULT 0 COMMENT '性别(0-未知, 1-男, 2-女)',
+ `student_id` VARCHAR(20) UNIQUE DEFAULT NULL COMMENT '学号',
+ `department` VARCHAR(100) DEFAULT NULL COMMENT '院系',
+ `major` VARCHAR(100) DEFAULT NULL COMMENT '专业',
+ `grade` VARCHAR(20) DEFAULT NULL COMMENT '年级',
+ `points` INT DEFAULT 0 COMMENT '积分',
+ `role` TINYINT DEFAULT 0 COMMENT '角色(0-普通用户, 1-版主, 2-管理员)',
+ `status` TINYINT DEFAULT 1 COMMENT '状态(0-禁用, 1-启用)',
+ `is_verified` TINYINT DEFAULT 0 COMMENT '是否验证(0-未验证, 1-已验证)',
+ `login_ip` VARCHAR(50) DEFAULT NULL COMMENT '最近登录IP',
+ `login_time` DATETIME DEFAULT NULL COMMENT '最近登录时间',
+ `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ INDEX `idx_email` (`email`),
+ INDEX `idx_username` (`username`),
+ INDEX `idx_student_id` (`student_id`),
+ INDEX `idx_role` (`role`),
+ INDEX `idx_status` (`status`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表';
+```
+
+
+
+## 三、Api功能实现
+
+### 3.1用户认证模块
+
+#### 3.1.1 用户注册
+
+- **URL**: `/auth/register`
+
+- **方法**: POST
+
+- **描述**: 创建新用户账号
+
+ 请求参数:
+
+ ```json
+ {
+ "username": "student123",
+ "email": "student@school.edu",
+ "password": "Secure@Password123",
+ "nickname": "学生昵称",
+ "studentId": "20220101001",
+ "department": "计算机学院",
+ "major": "软件工程",
+ "grade": "2023级"
+ }
+ ```
+
+ 响应结果:
+
+ ```json
+ {
+ "code": 200,
+ "message": "注册成功",
+ "data": {
+ "userId": 12345,
+ "username": "student123",
+ "nickname": "学生昵称"
+ }
+ }
+ ```
+
+
+#### 3.1.2 用户密码登录
+
+- **URL**: `/auth/login`
+- **方法**: POST
+- **描述**: 用户登录
+
+请求参数:
+
+```json
+{
+ "username": "student123", // 用户名或邮箱
+ "password": "Secure@Password123"
+}
+```
+
+响应结果:
+
+```json
+{
+ "code": 200,
+ "message": "登录成功",
+ "data": {
+ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
+ "userInfo": {
+ "userId": 12345,
+ "username": "student123",
+ "nickname": "学生昵称",
+ "avatar": "https://example.com/avatar.jpg",
+ "role": 0,
+ "isVerified": true,
+ "status": 1
+ }
+ }
+}
+```
+
+#### 3.1.3 获取邮箱验证码
+
+- **URL**: `/auth/email/code`
+
+- **方法**: POST
+
+- **描述**: 向指定邮箱发送登录验证码
+
+ 请求参数
+
+ ```json
+ {
+ "email": "student@school.edu"
+ }
+ ```
+
+ 响应结果:
+
+ ```json
+ {
+ "code": 200,
+ "message": "验证码已发送",
+ "data": null
+ }
+ ```
+
+#### 3.1.4 邮箱验证码登录
+
+- **URL**: `/auth/login/code`
+- **方法**: POST
+- **描述**: 使用邮箱和验证码进行登录
+
+请求参数
+
+```json
+{
+ "email": "student@school.edu",
+ "code": "123456"
+}
+```
+
+成功响应:
+
+```json
+{
+ "code": 200,
+ "message": "登录成功",
+ "data": {
+ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
+ "userInfo": {
+ "userId": 12345,
+ "username": "student123",
+ "nickname": "学生昵称",
+ "avatar": "https://example.com/avatar.jpg",
+ "role": 0
+ }
+ }
+}
+```
+
diff --git a/unilife-server/.gitignore b/unilife-server/.gitignore
new file mode 100644
index 0000000..549e00a
--- /dev/null
+++ b/unilife-server/.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/unilife-server/pom.xml b/unilife-server/pom.xml
new file mode 100644
index 0000000..d2f2315
--- /dev/null
+++ b/unilife-server/pom.xml
@@ -0,0 +1,87 @@
+
+
+ 4.0.0
+ com.example
+ unilife-server
+ 0.0.1-SNAPSHOT
+ backend
+ backend
+
+ 1.8
+ UTF-8
+ UTF-8
+ 2.7.6
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.3.0
+
+
+
+ com.mysql
+ mysql-connector-j
+ runtime
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 1.8
+ 1.8
+ UTF-8
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+ com.example.unilife.BackendApplication
+ true
+
+
+
+ repackage
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/unilife-server/src/main/java/com/example/unilife/UniLifeApplication.java b/unilife-server/src/main/java/com/example/unilife/UniLifeApplication.java
new file mode 100644
index 0000000..70ebbe4
--- /dev/null
+++ b/unilife-server/src/main/java/com/example/unilife/UniLifeApplication.java
@@ -0,0 +1,13 @@
+package com.example.unilife;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class UniLifeApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(UniLifeApplication.class, args);
+ }
+
+}
diff --git a/unilife-server/src/main/resources/application.yml b/unilife-server/src/main/resources/application.yml
new file mode 100644
index 0000000..b1bc0ad
--- /dev/null
+++ b/unilife-server/src/main/resources/application.yml
@@ -0,0 +1,8 @@
+server:
+ port: 8080
+spring:
+ datasource:
+ url: jdbc:mysql://localhost:3306/UniLife?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8
+ username: root
+ password: 123456
+ driver-class-name: com.mysql.cj.jdbc.Driver
diff --git a/unilife-server/src/main/resources/static/index.html b/unilife-server/src/main/resources/static/index.html
new file mode 100644
index 0000000..e2d94a2
--- /dev/null
+++ b/unilife-server/src/main/resources/static/index.html
@@ -0,0 +1,6 @@
+
+
+ hello word!!!
+ this is a html page
+
+
\ No newline at end of file
diff --git a/unilife-server/src/test/java/com/example/unilife/BackendApplicationTests.java b/unilife-server/src/test/java/com/example/unilife/BackendApplicationTests.java
new file mode 100644
index 0000000..df4e504
--- /dev/null
+++ b/unilife-server/src/test/java/com/example/unilife/BackendApplicationTests.java
@@ -0,0 +1,13 @@
+package com.example.unilife;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class BackendApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}