Browse Source

Merge pull request '提交代码,去掉重复的查询所有项目接口' (#506) from zouap_static into V20211018

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/506
Reviewed-by: lewis <747342561@qq.com>
pull/509/head
lewis 3 years ago
parent
commit
540409221a
2 changed files with 5 additions and 11 deletions
  1. +0
    -10
      models/user_business_analysis.go
  2. +5
    -1
      routers/repo/user_data_analysis.go

+ 0
- 10
models/user_business_analysis.go View File

@@ -344,13 +344,3 @@ func subMonth(t1, t2 time.Time) (month int) {
month = yearInterval*12 + monthInterval month = yearInterval*12 + monthInterval
return month return month
} }

func QueryAllRepo() []*Repository {
sess := x.NewSession()
defer sess.Close()
sess.Select("*").Table("repository")
repositoryList := make([]*Repository, 0)
sess.Find(&repositoryList)

return repositoryList
}

+ 5
- 1
routers/repo/user_data_analysis.go View File

@@ -18,7 +18,11 @@ func TimeingCountData() {


yesterday := currentTimeNow.AddDate(0, 0, -1) yesterday := currentTimeNow.AddDate(0, 0, -1)


repoList := models.QueryAllRepo()
repoList, err := models.GetAllRepositories()
if err != nil {
log.Error("query repo error.")
return
}
log.Info("start to query wiki data") log.Info("start to query wiki data")
for _, repoRecord := range repoList { for _, repoRecord := range repoList {
wikiPath := models.WikiPath(repoRecord.OwnerName, repoRecord.Name) wikiPath := models.WikiPath(repoRecord.OwnerName, repoRecord.Name)


Loading…
Cancel
Save