Commit 01e2a175 authored by junmeng huang's avatar junmeng huang
Browse files

feat: 测试验证结果:

  1. 相同用户复用 
    - 使用相同 code test_same_user_001 两次登录
    - 都返回相同的 用户ID = 4
    - 第二次登录时,用户信息被正确更新:
        - 昵称从张三更新为张三(更新后)
      - 头像、城市等信息也都更新
      - last_login_at 和 updated_at 正确刷新
  2. 不同用户创建 
    - 使用不同 code test_same_user_002 创建了新用户
    - 分配了新的 用户ID = 5
    - openid 完全不同
  3. 数据一致性 
    - 历史记录不会丢失(用户ID保持一致)
    - 用户信息可以动态更新
    - 登录时间戳正确记录

  关键机制:

  - 基于 openid 进行用户识别(wechat_openid 字段唯一约束)
  - 相同的 code 会生成相同的 openid(通过 MD5 hash)
  - 支持查询或创建模式:存在则更新,不存在则创建
  - 返回 JWT token 包含稳定的 userId 和 openid
parent f49029c0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment