-
Notifications
You must be signed in to change notification settings - Fork 59
-sfeat:Optimize registration logic #67
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
base: main
Are you sure you want to change the base?
Conversation
|
邮箱+手机号 我想在数据库设计加个唯一索引,保证邮箱+手机号的唯一性 |
| token, err := a.setToken2Header(ctx, claims.New(userId)) | ||
| if err != nil { | ||
| log.Context(ctx).Error("failed to generate token: %v", err) | ||
| return nil, errorx.New(1, "failed to generate token") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里如果可以建议改成只记录日志而不报错,与登录接口不一样,注册没有token并不代表注册失败,直接报错会导致前端无法识别注册操作到底是成功还是失败
或者是定义一个专门的错误码,由前端根据错误码来判断是否只是token生成失败
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
项目状态码放在哪里呢 还是生成有异常token 直接返回空
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我不太记得infrastructure目录下是否有定义状态码的位置,这个可以看着来,大不了以后再优化
这里好像可以邮箱和手机号各自一个唯一索引,邮箱和手机号都应该是唯一的 另外还有一张account表,如果要加索引麻烦account表也处理掉,account相当于提供一个全局唯一账号的功能,user表的手机号和邮箱只是一份冗余,可以考虑不要 |

Link to an issue
Optimize registration logic
What
How
Screenshots
How to test
Checklist
rebaseto confirm that current branch doesn't conflict with main branch.guidelines.mdwhich used to describe how to build, deploy and use DouTok.