You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo.go 1.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package tech
  2. import (
  3. "code.gitea.io/gitea/models"
  4. "code.gitea.io/gitea/modules/context"
  5. api "code.gitea.io/gitea/modules/structs"
  6. "code.gitea.io/gitea/routers/response"
  7. "code.gitea.io/gitea/services/repository"
  8. "net/http"
  9. )
  10. //CommitOpenIRepo 新建启智项目申请页面提交
  11. func CommitOpenIRepo(ctx *context.APIContext, form api.TechRepo) {
  12. //解析项目路径,查找项目
  13. repo, err := repository.FindRepoByUrl(form.Url)
  14. if err != nil {
  15. ctx.JSON(http.StatusOK, response.OuterServerError(err.Error()))
  16. return
  17. }
  18. //查找项目编号
  19. tech, err := models.GetTechByTechNo(form.TechNo)
  20. if err != nil {
  21. ctx.JSON(http.StatusOK, response.OuterServerError(err.Error()))
  22. return
  23. }
  24. //写入数据库
  25. rci := &models.RepoConvergeInfo{
  26. RepoID: repo.ID,
  27. Url: form.Url,
  28. BaseInfoID: tech.ID,
  29. Institution: form.Institution,
  30. UID: ctx.User.ID,
  31. Status: models.DefaultTechStatus,
  32. }
  33. err = rci.InsertOrUpdate()
  34. if err != nil {
  35. ctx.JSON(http.StatusOK, response.OuterServerError(err.Error()))
  36. return
  37. }
  38. ctx.JSON(http.StatusOK, response.OuterSuccess())
  39. return
  40. }
  41. //CommitNotOpenIRepo 新建非启智项目申请页面提交
  42. func CommitNotOpenIRepo(ctx *context.APIContext, form api.TechRepo) {
  43. ////查找项目编号
  44. //tech, err := models.GetTechByTechNo(form.TechNo)
  45. //if err != nil {
  46. // ctx.JSON(http.StatusOK, response.OuterServerError(err.Error()))
  47. // return
  48. //}
  49. //
  50. ////调用迁移接口
  51. return
  52. }