type-fix-6
This commit is contained in:
parent
132f965c8b
commit
f244330401
|
@ -238,29 +238,27 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use authorProfileMap["id"] here if necessary
|
|
||||||
authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
|
|
||||||
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId))
|
|
||||||
authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId))
|
|
||||||
authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId))
|
|
||||||
|
|
||||||
// Combine user data into a JSON string
|
// Combine user data into a JSON string
|
||||||
combinedData := "{"
|
combinedData := "{"
|
||||||
|
|
||||||
if authorProfileString != nil {
|
// Use authorProfileMap["id"] here if necessary
|
||||||
|
authorId, err := int(authorProfileMap["id"].(float64)) // convert float64 to int
|
||||||
|
if err != nil {
|
||||||
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
|
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
|
||||||
}
|
}
|
||||||
|
|
||||||
if authorFollowsAuthorsString != nil {
|
authorFollowsAuthorsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId))
|
||||||
|
if err != nil {
|
||||||
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
|
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
|
||||||
}
|
}
|
||||||
|
|
||||||
if authorFollowsTopicsString != nil {
|
authorFollowsTopicsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId))
|
||||||
|
if err != nil {
|
||||||
combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString)
|
combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString)
|
||||||
}
|
}
|
||||||
|
|
||||||
if authorFollowers != nil {
|
authorFollowers, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId))
|
||||||
|
if err != nil {
|
||||||
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
|
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user