|
|
@@ -667,6 +667,31 @@ func GetRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
return resultOrg, nil |
|
|
|
} |
|
|
|
|
|
|
|
func GetImageInfo() ([]map[string]interface{}, error) { |
|
|
|
url := setting.RecommentRepoAddr + "picture_info" |
|
|
|
result, err := repository.RecommendFromPromote(url) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
imageInfo := make([]map[string]interface{}, 0) |
|
|
|
for i := 0; i < (len(result) - 1); i++ { |
|
|
|
line := result[i] |
|
|
|
imageMap := make(map[string]interface{}) |
|
|
|
if line[0:4] == "url=" { |
|
|
|
url := line[4:] |
|
|
|
imageMap["url"] = url |
|
|
|
if result[i+1][0:11] == "image_link=" { |
|
|
|
image_link := result[i+1][11:] |
|
|
|
imageMap["image_link"] = image_link |
|
|
|
} |
|
|
|
} |
|
|
|
imageInfo = append(imageInfo, imageMap) |
|
|
|
i = i + 1 |
|
|
|
} |
|
|
|
return imageInfo, nil |
|
|
|
} |
|
|
|
|
|
|
|
func GetRankUser(index string) ([]map[string]interface{}, error) { |
|
|
|
url := setting.RecommentRepoAddr + "user_rank_" + index |
|
|
|
result, err := repository.RecommendFromPromote(url) |
|
|
@@ -705,6 +730,15 @@ func GetRankUser(index string) ([]map[string]interface{}, error) { |
|
|
|
return resultOrg, nil |
|
|
|
} |
|
|
|
|
|
|
|
func GetImageInfoFromPromote(ctx *context.Context) { |
|
|
|
imageInfo, err := GetImageInfo() |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("500", err) |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.JSON(200, imageInfo) |
|
|
|
} |
|
|
|
|
|
|
|
func GetUserRankFromPromote(ctx *context.Context) { |
|
|
|
index := ctx.Params("index") |
|
|
|
resultUserRank, err := GetRankUser(index) |
|
|
|