实现登录注册接口
Change-Id: I3d57cca89cac8945d562f6a39127b3454c1cd9ac
diff --git "a/API\346\216\245\345\217\243\346\226\207\346\241\243.txt" "b/API\346\216\245\345\217\243\346\226\207\346\241\243.txt"
new file mode 100644
index 0000000..ade70d0
--- /dev/null
+++ "b/API\346\216\245\345\217\243\346\226\207\346\241\243.txt"
@@ -0,0 +1,177 @@
+
+
+以下是当前项目所有后端接口及其说明,前端可以根据此文档完成联调。
+
+---
+
+## 通用返回结构
+
+所有接口均返回如下 JSON:
+
+```json
+{
+ "code": <int>, // 0=成功,1=失败
+ "msg": "<string>", // 成功或失败的提示信息
+ "data": <object> // 成功时返回的数据,失败时为 null
+}
+```
+
+---
+
+## 1. 发送邮箱验证码
+
+```
+POST /sendVerification
+Content-Type: application/x-www-form-urlencoded
+```
+
+**请求参数(Form)**
+
+| 字段 | 类型 | 必填 | 说明 |
+| ---------- | ------ | -- | ---------- |
+| email | String | 是 | 接收验证码的邮箱 |
+| inviteCode | String | 是 | 前端用户填写的邀请码 |
+
+**成功响应示例**
+
+```json
+{
+ "code": 0,
+ "msg": "验证码已发送",
+ "data": null
+}
+```
+
+**错误示例**
+
+```json
+{
+ "code": 1,
+ "msg": "无效邀请码",
+ "data": null
+}
+```
+
+---
+
+## 2. 用户注册
+
+```
+POST /register
+Content-Type: application/x-www-form-urlencoded
+```
+
+**请求参数(Form)**
+
+| 字段 | 类型 | 必填 | 说明 |
+| -------------------- | ------- | -- | ------------------- |
+| username | String | 是 | 用户名(前端输入) |
+| email | String | 是 | 邮箱(用于接收验证码 & 唯一性校验) |
+| verificationCode | String | 是 | 邮箱收到的 6 位验证码 |
+| password | String | 是 | 登录密码 |
+| identificationNumber | Integer | 是 | 身份证号(8 位数字) |
+| inviteCode | String | 是 | 邀请码(预先在数据库插入并发放给用户) |
+
+**成功响应示例**
+
+```json
+{
+ "code": 0,
+ "msg": "注册成功",
+ "data": null
+}
+```
+
+**常见错误示例**
+
+```json
+{ "code":1, "msg":"参数不完整", "data":null }
+```
+
+```json
+{ "code":1, "msg":"验证码错误或已过期", "data":null }
+```
+
+```json
+{ "code":1, "msg":"无效邀请码或已过期", "data":null }
+```
+
+```json
+{ "code":1, "msg":"邮箱已被注册", "data":null }
+```
+
+---
+
+## 3. 用户登录
+
+```
+POST /login
+Content-Type: application/x-www-form-urlencoded
+```
+
+**请求参数(Form)**
+
+| 字段 | 类型 | 必填 | 说明 |
+| -------------------- | ------- | -- | ----------- |
+| identificationNumber | Integer | 是 | 身份证号(8 位数字) |
+| password | String | 是 | 登录密码 |
+
+**成功响应示例**
+
+```json
+{
+ "code": 0,
+ "msg": "登录成功",
+ "data": "<JWT_TOKEN>"
+}
+```
+
+* `data`:返回的 JWT,后续请求请在请求头 `token: <JWT_TOKEN>` 中携带。
+
+**失败示例**
+
+```json
+{ "code":1, "msg":"用户名或密码错误", "data":null }
+```
+
+---
+
+## 4. 获取当前用户信息
+
+```
+GET /api/me
+Headers:
+ token: <JWT_TOKEN>
+```
+
+**说明**
+
+* 需在请求头中携带登录时返回的 JWT。若未携带或验证失败,将返回 `NOT_LOGIN`。
+
+**成功响应示例**
+
+```json
+{
+ "code": 0,
+ "msg": "success",
+ "data": {
+ "id": 10,
+ "username": "usertest1",
+ "identificationNumber": 12345678
+ }
+}
+```
+
+**失效示例**
+
+```json
+{ "code":1, "msg":"NOT_LOGIN", "data":null }
+```
+
+---
+
+## 静态页面
+
+* `login.html`:登录页(填写身份证号、密码)
+* `register.html`:注册页(填写用户名、邮箱、验证码、密码、身份证号、邀请码)
+* `home.html`:受保护的首页示例(从 `localStorage` 读取 token 并调用 `/api/me`)