contract_api.go 838 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * @description: 合同管理相关API
  3. * @Author: CP
  4. * @Date: 2020-10-26 15:27:04
  5. * @FilePath: \construction_management\web\api\contract_api.go
  6. */
  7. package api
  8. import (
  9. "github.com/kataras/iris/v12"
  10. "go.mod/services"
  11. "go.mod/web/utils"
  12. )
  13. type ContractApi struct {
  14. //框架-web应用上下文环境
  15. Ctx iris.Context
  16. // // 需要用的service
  17. ServiceTree services.TreeService
  18. // ServiceLogin services.LoginService
  19. // ServiceProject services.ProjectService
  20. }
  21. func (c *ContractApi) Get() {
  22. // 获得项目ID
  23. projectIdInt, err := utils.GetProjectId(c.Ctx)
  24. if err != nil {
  25. c.Ctx.JSON(iris.Map{
  26. "code": -1,
  27. "msg": err,
  28. })
  29. return
  30. }
  31. // 获得层级文件夹
  32. FolderData := c.ServiceTree.GetAllContract(projectIdInt)
  33. c.Ctx.JSON(iris.Map{
  34. "code": 0,
  35. "msg": "",
  36. "data": FolderData,
  37. })
  38. }