Browse Source

提交代码

2023
ychao_1983 2 years ago
parent
commit
5ebfd6e22f
2 changed files with 5 additions and 5 deletions
  1. +2
    -2
      models/tech_converge_info.go
  2. +3
    -3
      routers/api/v1/api.go

+ 2
- 2
models/tech_converge_info.go View File

@@ -411,7 +411,7 @@ func ShowTechRepo(ids []int64, show bool) error {
idStrs = append(idStrs, strconv.FormatInt(id, 10))
}

sql := "update repo_converge_info set status=? where id in (" + strings.Join(idStrs, ",") + ")"
sql := "update repo_converge_info set status=? where id in (" + strings.Join(idStrs, ",") + ") and (status=" + strconv.Itoa(TechShow) + " or status=" + strconv.Itoa(TechHide) + ")"
_, err := x.Exec(sql, status)
return err
}
@@ -551,7 +551,7 @@ func loadRepoInfoForTech(list []*TechRepoInfo) {
techRepo.Repos = []*RepoWithInstitution{}
if techRepo.RepoCount > 0 {
var repoIds []int64
x.Table("repo_converge_info").Cols("repo_id").Where("base_info_id=?", techRepo.ID).Limit(2).Desc("updated_unix").Find(&repoIds)
x.Table("repo_converge_info").Cols("repo_id").Where("base_info_id=? and status=?", techRepo.ID, TechShow).Limit(2).Desc("updated_unix").Find(&repoIds)

resultMap, err := GetRepositoriesMapByIDs(repoIds)



+ 3
- 3
routers/api/v1/api.go View File

@@ -550,13 +550,13 @@ func RegisterRoutes(m *macaron.Macaron) {

m.Group("/tech", func() {
m.Get("", tech.FindTech)
m.Post("/basic", tech.ImportBasicInfo)
m.Post("/basic", hasRole(models.TechProgramAdmin), tech.ImportBasicInfo)
m.Get("/filter", tech.GetFilterInfo)
m.Get("/search", tech.SearchTechProjectInfo)
m.Get("/repo_search", tech.SearchRepoInfo)
m.Get("/admin", tech.GetAdminRepoInfo)
m.Get("/admin", hasRole(models.TechProgramAdmin), tech.GetAdminRepoInfo)
m.Get("/my", tech.GetMyRepoInfo)
m.Post("/admin/:action", bind(tech.ActionIDs{}), tech.Action)
m.Post("/admin/:action", hasRole(models.TechProgramAdmin), bind(tech.ActionIDs{}), tech.Action)
m.Post("/openi", bind(api.OpenITechRepo{}), tech.CommitOpenIRepo)
m.Post("/no_openi", bind(api.NotOpenITechRepo{}), tech.CommitNotOpenIRepo)
m.Get("/is_admin", tech.IsAdmin)


Loading…
Cancel
Save