contract_api.go 1.7 KB

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