caipin %!s(int64=3) %!d(string=hai) anos
pai
achega
475dbaea82
Modificáronse 1 ficheiros con 52 adicións e 0 borrados
  1. 52 0
      web/external/jl_bb.go

+ 52 - 0
web/external/jl_bb.go

@@ -21,6 +21,7 @@ type JlBb struct {
 // @Accept  json
 // @Accept  json
 // @Produce  json
 // @Produce  json
 // @Param   code     path    string     true        "项目编号"
 // @Param   code     path    string     true        "项目编号"
+// @Param   token     path    string     true        "token"
 // @Success 200 {object} viewmodels.FolderContract "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}"
 // @Success 200 {object} viewmodels.FolderContract "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}"
 // @Router /api/contract/folder [get]
 // @Router /api/contract/folder [get]
 func (c *JlBb) GetFolder() {
 func (c *JlBb) GetFolder() {
@@ -38,6 +39,57 @@ func (c *JlBb) GetFolder() {
 		return
 		return
 	}
 	}
 	// 1-2.验证jwt
 	// 1-2.验证jwt
+	err := utils.ValidateJwtBB(data.Token)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
+		return
+	}
+
+	// 获得项目ID
+	projectDetail := c.ServiceProject.GetNameBs(data.Code)
+	if projectDetail.Id == 0 {
+		c.Ctx.JSON(iris.Map{
+			"code": -1,
+			"msg":  "项目不存在",
+		})
+		return
+	}
+
+	// 获得层级文件夹
+	FolderData := c.ServiceTree.GetAllContractByJL(projectDetail.Id)
+
+	c.Ctx.JSON(iris.Map{
+		"code": 0,
+		"msg":  "",
+		"data": FolderData,
+	})
+}
+
+// @Summary 获得合同信息
+// @Tags 合同管理
+// @Description 获得合同信息
+// @Accept  json
+// @Produce  json
+// @Param   code     path    string     true        "项目编号"
+// @Param   token     path    string     true        "token"
+// @Param   key     path    string     true        "是一个数组,里面代表的名称"
+// @Success 200 {object} viewmodels.FolderContract "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}"
+// @Router /api/contract/folder [get]
+func (c *JlBb) GetFolder2() {
+
+	// 1.获得数据
+	data := &viewmodels.Jl{}
+	if err := c.Ctx.ReadForm(data); err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
+		return
+	}
+
+	// 1-1.校验是否存在code
+	if err := data.ValidateCodeAToken(); err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
+		return
+	}
+	// 1-2.验证jwt
 	_, err := utils.ValidateJwt(data.Token)
 	_, err := utils.ValidateJwt(data.Token)
 	if err != nil {
 	if err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})