From 4f0a171366314ef332a07202c039c9859cc6c9aa Mon Sep 17 00:00:00 2001 From: Milky0217 Date: Fri, 26 Sep 2025 13:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0prompt=E5=92=8Capi=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prompt.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 prompt.md diff --git a/prompt.md b/prompt.md new file mode 100644 index 0000000..1b4e5ce --- /dev/null +++ b/prompt.md @@ -0,0 +1,36 @@ +# api + +## login + +- POST /api/wx/login - 微信小程序登录接口(接收 code 并返回令牌) +- GET /api/user/info - 获取当前登录用户信息 +- POST /api/logout - 登出接口 + +## data + +- GET /api/resources/data 获取个人全部数据的部分,或者指定数据的全部 +- GET /api/permissions 用于后续用户管理 + +# backend + +- rust +- actix-web +- serde +- jsonwebtoken +- sqlx +- dotenv + +# routine + +## /api/wx/login + +1. 接收小程序发送的 code +2. 调用微信官方code2Session接口获取 openid +3. 生成 JWT 令牌返回给小程序 +4. 实现令牌验证中间件保护需要登录的接口 + +# auth + +1. 基于角色的访问控制 (RBAC) 模型 +2. 在中间件中验证用户令牌和权限 +3. 实现权限检查装饰器 / 宏简化代码 \ No newline at end of file