修复:contributors接口数据为空返回空数组

This commit is contained in:
yystopf 2023-02-02 15:25:31 +08:00
parent 9033d59c99
commit 544386cbb4
1 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,8 @@ type Contributor struct {
Contributions int64 `json:"contributions"`
}
func GetContributors(repoID, userID int64) (result []Contributor, err error) {
func GetContributors(repoID, userID int64) ([]Contributor, error) {
var result = make([]Contributor, 0)
sql :=
`select a.act_user_id as id ,
u.name as login,
@ -34,8 +35,8 @@ func GetContributors(repoID, userID int64) (result []Contributor, err error) {
where repo_id=? and user_id=?
group by repo_id,act_user_id `
err = db.GetEngine(db.DefaultContext).SQL(sql, repoID, userID).Find(&result)
return
err := db.GetEngine(db.DefaultContext).SQL(sql, repoID, userID).Find(&result)
return result, err
}
func activityQueryCondition(opts gitea_activities_models.GetFeedsOptions) (builder.Cond, error) {