Пример #1
0
func (this *UserService) GetUserInfoByName(email string) models.User {
	emailOrUsername := strings.ToLower(email)

	user := models.User{}
	if strings.Contains(email, "@") {
		database.GetByQ(database.Users, bson.M{"Email": emailOrUsername}, &user)
	} else {
		database.GetByQ(database.Users, bson.M{"Username": emailOrUsername}, &user)
	}

	return user
}
Пример #2
0
func (this *UserService) GetUserId(email string) string {
	email = strings.ToLower(email)
	user := models.User{}
	database.GetByQ(database.Users, bson.M{"Email": email}, &user)
	return user.UserId.Hex()

}