Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[特性]简单跨平台用户绑定 #54

Open
Itsusinn opened this issue Apr 27, 2022 · 0 comments
Open

[特性]简单跨平台用户绑定 #54

Itsusinn opened this issue Apr 27, 2022 · 0 comments

Comments

@Itsusinn
Copy link
Member

同一用户在两个平台拥有账号时的特殊需求。

举例解释行为:A端发来消息,若消息的发送者与B端(本端)用户绑定,则以本地用户的身份(昵称,头像等)发送这条消息。

绑定机制,

  1. A端用户向中继Bot发生绑定请求。
  2. A端中继Bot生成一个六位十进制随机数,并将时间戳,该随机数和A端用户id(为去歧义以A_$id作为id)拼装为请求绑定事件。
  3. 将事件发往事件总线(其nats地址为将key进行一次哈希),以nats request形式
  4. B端接收到绑定请求事件并储存到本地缓存(in-memory db或redis),存活期十分钟
  5. B端用户给出随机数,B端Bot搜寻数据库中的匹配随机数,若匹配,则拼装为绑定通过事件。其内容为A端用户id与B端用户id(去歧义)。储存用户绑定
  6. B端将绑定许可事件发送至事件总线(以nats reply形式)
  7. A端储存,处理用户绑定
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant