Open
Conversation
Contributor
Author
|
邮箱+手机号 我想在数据库设计加个唯一索引,保证邮箱+手机号的唯一性 |
Contributor
Author
TremblingV5
requested changes
Oct 20, 2024
| 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") |
Contributor
There was a problem hiding this comment.
这里如果可以建议改成只记录日志而不报错,与登录接口不一样,注册没有token并不代表注册失败,直接报错会导致前端无法识别注册操作到底是成功还是失败
或者是定义一个专门的错误码,由前端根据错误码来判断是否只是token生成失败
Contributor
Author
There was a problem hiding this comment.
项目状态码放在哪里呢 还是生成有异常token 直接返回空
Contributor
There was a problem hiding this comment.
我不太记得infrastructure目录下是否有定义状态码的位置,这个可以看着来,大不了以后再优化
Contributor
这里好像可以邮箱和手机号各自一个唯一索引,邮箱和手机号都应该是唯一的 另外还有一张account表,如果要加索引麻烦account表也处理掉,account相当于提供一个全局唯一账号的功能,user表的手机号和邮箱只是一份冗余,可以考虑不要 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.