|
@@ -314,15 +314,16 @@ type SearchRepoOpt struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type RepoWithInstitution struct { |
|
|
type RepoWithInstitution struct { |
|
|
ID int64 `json:"id"` |
|
|
|
|
|
OwnerID int64 `json:"owner_id"` |
|
|
|
|
|
OwnerName string `json:"owner_name"` |
|
|
|
|
|
Name string `json:"name"` |
|
|
|
|
|
Alias string `json:"alias"` |
|
|
|
|
|
Topics []string `json:"topics"` |
|
|
|
|
|
Description string `json:"description"` |
|
|
|
|
|
Institution string `json:"institution"` |
|
|
|
|
|
UpdatedUnix timeutil.TimeStamp `json:"updated_unix"` |
|
|
|
|
|
|
|
|
ID int64 `json:"id"` |
|
|
|
|
|
OwnerID int64 `json:"owner_id"` |
|
|
|
|
|
OwnerName string `json:"owner_name"` |
|
|
|
|
|
Name string `json:"name"` |
|
|
|
|
|
Alias string `json:"alias"` |
|
|
|
|
|
Topics []string `json:"topics"` |
|
|
|
|
|
Description string `json:"description"` |
|
|
|
|
|
Institution string `json:"institution"` |
|
|
|
|
|
RelAvatarLink string `json:"rel_avatar_link"` |
|
|
|
|
|
UpdatedUnix timeutil.TimeStamp `json:"updated_unix"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type TechRepoInfo struct { |
|
|
type TechRepoInfo struct { |
|
@@ -416,7 +417,7 @@ func buildTechFilterCond(opt *SearchTechOpt) string { |
|
|
sql += getWherePrefix(sql) + " apply_year =" + strconv.Itoa(opt.ApplyYear) |
|
|
sql += getWherePrefix(sql) + " apply_year =" + strconv.Itoa(opt.ApplyYear) |
|
|
} |
|
|
} |
|
|
if opt.Institution != "" { |
|
|
if opt.Institution != "" { |
|
|
sql += getWherePrefix(sql) + " (all_institution like '%" + opt.Institution + ",%'" + " or all_institution like '%," + opt.Institution + "%'" |
|
|
|
|
|
|
|
|
sql += getWherePrefix(sql) + " (all_institution like '%" + opt.Institution + ",%'" + " or all_institution like '%," + opt.Institution + "%'" + " or all_institution = '" + opt.Institution + "')" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if opt.ExecuteYear != 0 { |
|
|
if opt.ExecuteYear != 0 { |
|
@@ -445,7 +446,7 @@ func loadRepoInfoForTech(list []*TechRepoInfo) { |
|
|
techRepo.Repos = []*RepoWithInstitution{} |
|
|
techRepo.Repos = []*RepoWithInstitution{} |
|
|
if techRepo.RepoCount > 0 { |
|
|
if techRepo.RepoCount > 0 { |
|
|
var repoIds []int64 |
|
|
var repoIds []int64 |
|
|
x.Table("repo_converge_info").Cols("repo_id").Where("base_info_id=?", techRepo.ID).Desc("updated_unix").Find(&repoIds) |
|
|
|
|
|
|
|
|
x.Table("repo_converge_info").Cols("repo_id").Where("base_info_id=?", techRepo.ID).Limit(2).Desc("updated_unix").Find(&repoIds) |
|
|
|
|
|
|
|
|
resultMap, err := GetRepositoriesMapByIDs(repoIds) |
|
|
resultMap, err := GetRepositoriesMapByIDs(repoIds) |
|
|
|
|
|
|
|
@@ -455,15 +456,16 @@ func loadRepoInfoForTech(list []*TechRepoInfo) { |
|
|
repo, ok := resultMap[repoId] |
|
|
repo, ok := resultMap[repoId] |
|
|
if ok { |
|
|
if ok { |
|
|
techRepo.Repos = append(techRepo.Repos, &RepoWithInstitution{ |
|
|
techRepo.Repos = append(techRepo.Repos, &RepoWithInstitution{ |
|
|
ID: repo.ID, |
|
|
|
|
|
Institution: techRepo.Institution, |
|
|
|
|
|
OwnerID: repo.OwnerID, |
|
|
|
|
|
OwnerName: repo.OwnerName, |
|
|
|
|
|
Name: repo.Name, |
|
|
|
|
|
Alias: repo.Alias, |
|
|
|
|
|
Topics: repo.Topics, |
|
|
|
|
|
Description: repo.Description, |
|
|
|
|
|
UpdatedUnix: repo.UpdatedUnix, |
|
|
|
|
|
|
|
|
ID: repo.ID, |
|
|
|
|
|
Institution: techRepo.Institution, |
|
|
|
|
|
OwnerID: repo.OwnerID, |
|
|
|
|
|
OwnerName: repo.OwnerName, |
|
|
|
|
|
Name: repo.Name, |
|
|
|
|
|
Alias: repo.Alias, |
|
|
|
|
|
Topics: repo.Topics, |
|
|
|
|
|
Description: repo.Description, |
|
|
|
|
|
RelAvatarLink: repo.RelAvatarLink(), |
|
|
|
|
|
UpdatedUnix: repo.UpdatedUnix, |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|