This commit is contained in:
wangchuxiao 2022-03-28 16:59:15 +08:00
parent c39f5a27b2
commit 228cbb4082
2 changed files with 4 additions and 4 deletions

View File

@ -556,7 +556,7 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32)
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
findOpts := options.Find().SetSort(-1).SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1))
cursor, err := c.Find(ctx, bson.D{{"sendID", userID}}, findOpts)
cursor, err := c.Find(ctx, bson.M{"sendID": userID}, findOpts)
if err != nil {
return tagSendLogs, err
}

View File

@ -79,12 +79,12 @@ func GetUserNameByUserID(userID string) (string, error) {
if err != nil {
return "", err
}
var userName string
err = dbConn.Table("users").Select("name").Where("user_id=?", userID).First(&userName).Error
var user db.User
err = dbConn.Table("users").Select("name").Where("user_id=?", userID).First(&user).Error
if err != nil {
return "", err
}
return userName, nil
return user.Nickname, nil
}
func UpdateUserInfo(user db.User) error {