lanjianrong 4 年之前
父節點
當前提交
ef7e18050c
共有 1 個文件被更改,包括 40 次插入0 次删除
  1. 40 0
      web/api/contract_section_tree_api.go

+ 40 - 0
web/api/contract_section_tree_api.go

@@ -426,3 +426,43 @@ func (c *ContractApi) DeleteSection() {
 	}
 	c.Ctx.JSON(iris.Map{"code": 0, "msg": "删除成功"})
 }
+
+// @Summary 保存 项目节附件
+// @Tags 合同管理-项目节
+// @Description 附件 合同项目节
+// @Accept  json
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param   id     body    string     true        "项目节ID"
+// @Param   fid    body    string     true        "附件id"
+// @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
+// @Router /api/contract/file [post]
+func (c *ContractApi) PostFile() {
+	sectionData, err := c.ServiceContract.ValidRuleUpdateFile(c.Ctx)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": "解析参数出错"})
+		return
+	}
+
+	// 项目节ID
+	treeId, err := utils.GetDecryptId(sectionData.Id)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
+		return
+	}
+
+	// 项目节ID
+	contractId, err := utils.GetDecryptId(sectionData.ContractId)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
+		return
+	}
+
+	err = c.ServiceContract.UpdateContractId(treeId, contractId)
+	if err != nil {
+		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
+		return
+	}
+
+	c.Ctx.JSON(iris.Map{"code": 0, "msg": "保存成功"})
+}