contract_api.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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/viewmodels"
  12. )
  13. type ContractApi struct {
  14. //框架-web应用上下文环境
  15. Ctx iris.Context
  16. // // 需要用的service
  17. ServiceTree services.TreeService
  18. ServiceContract services.ContractService
  19. // ServiceLogin services.LoginService
  20. // ServiceProject services.ProjectService
  21. }
  22. // @Summary 获得项目节信息
  23. // @Tags 合同管理-项目节
  24. // @Description 未设置合同项目节 返回项目节模板信息
  25. // @Accept json
  26. // @Produce json
  27. // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,data:viewmodels.TreeSectionContract,msg:错误信息}"
  28. // @Router /api/section/all [get]
  29. func (c *ContractApi) GetSectionAll() {
  30. sectionData := viewmodels.TreeSectionContract{}
  31. err := c.Ctx.ReadForm(&sectionData)
  32. if err != nil {
  33. c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
  34. return
  35. }
  36. // if sectionData.BidsectionId == "" {
  37. // c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
  38. // return
  39. // }
  40. // bidsectionId, err := utils.GetDecryptId(sectionData.BidsectionId)
  41. // if err != nil {
  42. // c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
  43. // return
  44. // }
  45. // 项目ID
  46. // projectIdInt, err := utils.GetProjectId(c.Ctx)
  47. // if err != nil {
  48. // c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
  49. // return
  50. // }
  51. //获得合同项目节
  52. sectionTree := c.ServiceContract.GetSecionTree()
  53. c.Ctx.JSON(iris.Map{
  54. "code": 0,
  55. "msg": "",
  56. "data": sectionTree,
  57. })
  58. }