feat(auth): 添加微信小程序登录支持
- 新增 wechat_users 表迁移和 SeaORM Entity - 实现微信登录 Service(code→openid→绑定状态查询) - 实现手机号绑定 Service(创建/关联 user + 签发 JWT) - 添加公开路由 POST /auth/wechat/login 和 /auth/wechat/bind-phone - 新增 WechatConfig 到 AppConfig(appid/secret 通过环境变量配置) - 添加 reqwest 依赖用于调用微信 jscode2session API
This commit is contained in:
@@ -28,6 +28,27 @@ pub struct RefreshReq {
|
||||
pub refresh_token: String,
|
||||
}
|
||||
|
||||
// --- Wechat DTOs ---
|
||||
|
||||
#[derive(Debug, Deserialize, ToSchema)]
|
||||
pub struct WechatLoginReq {
|
||||
pub code: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, ToSchema)]
|
||||
pub struct WechatLoginResp {
|
||||
pub bound: bool,
|
||||
pub openid: String,
|
||||
pub token: Option<LoginResp>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, ToSchema)]
|
||||
pub struct WechatBindPhoneReq {
|
||||
pub openid: String,
|
||||
pub encrypted_data: String,
|
||||
pub iv: String,
|
||||
}
|
||||
|
||||
/// 修改密码请求
|
||||
#[derive(Debug, Deserialize, Validate, ToSchema)]
|
||||
pub struct ChangePasswordReq {
|
||||
|
||||
Reference in New Issue
Block a user