add user register IP

pull/351/head
skiffer-git 2 years ago
parent dd001ab0e7
commit 5d661f2fc6

@ -630,9 +630,16 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUsers failed", err.Error())
return resp, errors.WrapError(constant.ErrDB)
}
for _, v := range users {
isBlock, err := imdb.UserIsBlock(v.UserID)
if err == nil {
registerIP := ""
registerInfo, err := imdb.GetRegisterInfo(v.UserID)
if registerInfo != nil && err == nil {
registerIP = registerInfo.RegisterIP
}
user := &pbUser.User{
ProfilePhoto: v.FaceURL,
UserId: v.UserID,
@ -648,6 +655,7 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
LoginTimes: v.LoginTimes,
Gender: v.Gender,
LoginLimit: v.LoginLimit,
RegisterIp: registerIP,
}
resp.User = append(resp.User, user)
} else {

@ -12,6 +12,11 @@ func GetRegister(account, areaCode, userID string) (*db.Register, error) {
userID, "", account, account, areaCode).Take(&r).Error
}
func GetRegisterInfo(userID string) (*db.Register, error) {
var r db.Register
return &r, db.DB.MysqlDB.DefaultGormDB().Table("registers").Where("user_id = ?", userID).Take(&r).Error
}
func SetPassword(account, password, ex, userID, areaCode, ip string) error {
r := db.Register{
Account: account,

File diff suppressed because it is too large Load Diff

@ -188,6 +188,7 @@ message User{
int32 Gender = 12;
int32 LoginLimit = 13;
bool IsBlock = 14;
string RegisterIp = 15;
}
message GetUserByIdResp{

Loading…
Cancel
Save