Browse Source

fix bug

tags/v1.22.1.3
chenyifan01 4 years ago
parent
commit
7a3fce175e
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      models/repo_tag.go

+ 7
- 2
models/repo_tag.go View File

@@ -28,6 +28,7 @@ type OfficialTagRepos struct {
type TagReposBrief struct {
RepoID int64
RepoName string
Alias string
TagID int64
}

@@ -97,7 +98,7 @@ func UpdateTagReposByID(tagID, orgID int64, repoIdList []int64) error {

func GetTagRepos(tagID, orgID int64) ([]TagReposSelected, error) {
t := make([]TagReposBrief, 0)
const SQLCmd = "select t1.id as repo_id,t1.name as repo_name,t2.id as tag_id from repository t1 left join official_tag_repos t2 on (t1.id = t2.repo_id and t2.tag_id = ?) where t1.owner_id = ? and t1.is_private = false order by t1.updated_unix desc"
const SQLCmd = "select t1.id as repo_id,t1.name as repo_name,t1.alias,t2.id as tag_id from repository t1 left join official_tag_repos t2 on (t1.id = t2.repo_id and t2.tag_id = ?) where t1.owner_id = ? and t1.is_private = false order by t1.updated_unix desc"

if err := x.SQL(SQLCmd, tagID, orgID).Find(&t); err != nil {
return nil, err
@@ -108,9 +109,13 @@ func GetTagRepos(tagID, orgID int64) ([]TagReposSelected, error) {
if v.TagID > 0 {
selected = true
}
repoName := v.Alias
if v.Alias == "" {
repoName = v.RepoName
}
r = append(r, TagReposSelected{
RepoID: v.RepoID,
RepoName: v.RepoName,
RepoName: repoName,
Selected: selected,
})
}


Loading…
Cancel
Save