|
|
|
@@ -471,7 +471,7 @@ func ExploreOrganizations(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
recommendOrgs, err := GetRecommendOrg() |
|
|
|
recommendOrgs, err := getRecommendOrg() |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRecommendOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) |
|
|
|
ctx.ServerError("GetRecommendOrgInfos", err) |
|
|
|
@@ -606,31 +606,31 @@ func ExploreImages(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
func ExploreDataAnalysisUserTrend(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="UserTrend" |
|
|
|
ctx.Data["url_params"] = "UserTrend" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisUserAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="UserAnalysis" |
|
|
|
ctx.Data["url_params"] = "UserAnalysis" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisProTrend(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="ProTrend" |
|
|
|
ctx.Data["url_params"] = "ProTrend" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisProAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="ProAnalysis" |
|
|
|
ctx.Data["url_params"] = "ProAnalysis" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisOverview(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="Overview" |
|
|
|
ctx.Data["url_params"] = "Overview" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisBrainAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="BrainAnalysis" |
|
|
|
ctx.Data["url_params"] = "BrainAnalysis" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="" |
|
|
|
ctx.Data["url_params"] = "" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
|
|
|
|
@@ -640,7 +640,7 @@ func NotFound(ctx *context.Context) { |
|
|
|
ctx.NotFound("home.NotFound", nil) |
|
|
|
} |
|
|
|
|
|
|
|
func GetRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
func getRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
url := setting.RecommentRepoAddr + "organizations" |
|
|
|
result, err := repository.RecommendFromPromote(url) |
|
|
|
|
|
|
|
@@ -668,7 +668,7 @@ func GetRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
} |
|
|
|
return resultOrg, nil |
|
|
|
} |
|
|
|
func GetImageInfo() ([]map[string]interface{}, error) { |
|
|
|
func getImageInfo() ([]map[string]interface{}, error) { |
|
|
|
url := setting.RecommentRepoAddr + "picture_info" |
|
|
|
result, err := repository.RecommendFromPromote(url) |
|
|
|
|
|
|
|
@@ -731,14 +731,14 @@ 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 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") |
|
|
|
@@ -750,15 +750,48 @@ func GetUserRankFromPromote(ctx *context.Context) { |
|
|
|
ctx.JSON(200, resultUserRank) |
|
|
|
} |
|
|
|
|
|
|
|
func RecommendOrgFromPromote(ctx *context.Context) { |
|
|
|
resultOrg, err := GetRecommendOrg() |
|
|
|
func RecommendHomeInfo(ctx *context.Context) { |
|
|
|
resultOrg, err := getRecommendOrg() |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("500", err) |
|
|
|
return |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
ctx.JSON(200, resultOrg) |
|
|
|
resultRepo, err := repository.GetRecommendRepoFromPromote("projects") |
|
|
|
if err != nil { |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
resultImage, err := getImageInfo() |
|
|
|
if err != nil { |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
resultCloudBrain, err := getCloudbrainNums() |
|
|
|
if err != nil { |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
mapInterface := make(map[string]interface{}) |
|
|
|
mapInterface["org"] = resultOrg |
|
|
|
mapInterface["repo"] = resultRepo |
|
|
|
mapInterface["image"] = resultImage |
|
|
|
mapInterface["cloudbrain"] = resultCloudBrain |
|
|
|
ctx.JSON(http.StatusOK, mapInterface) |
|
|
|
} |
|
|
|
|
|
|
|
func getCloudbrainNums() (map[string]string, error) { |
|
|
|
result := make(map[string]string) |
|
|
|
result["completed_task"] = "1800" |
|
|
|
result["running_task"] = "20" |
|
|
|
result["wait_task"] = "30" |
|
|
|
return result, nil |
|
|
|
} |
|
|
|
|
|
|
|
// func RecommendOrgFromPromote(ctx *context.Context) { |
|
|
|
// resultOrg, err := GetRecommendOrg() |
|
|
|
// if err != nil { |
|
|
|
// ctx.ServerError("500", err) |
|
|
|
// return |
|
|
|
// } |
|
|
|
// ctx.JSON(200, resultOrg) |
|
|
|
// } |
|
|
|
|
|
|
|
func RecommendRepoFromPromote(ctx *context.Context) { |
|
|
|
result, err := repository.GetRecommendRepoFromPromote("projects") |
|
|
|
if err != nil { |
|
|
|
|