/* * @description: 合同管理相关API * @Author: CP * @Date: 2020-10-26 15:27:04 * @FilePath: \construction_management\web\api\contract_api.go */ package api import ( "github.com/kataras/iris/v12" "go.mod/services" "go.mod/web/utils" ) type ContractApi struct { //框架-web应用上下文环境 Ctx iris.Context // // 需要用的service ServiceTree services.TreeService // ServiceLogin services.LoginService // ServiceProject services.ProjectService } // @Summary 获得合同目录和标段 // @Tags 合同管理 // @Description 获得合同目录和标段 // @Accept json // @Produce json // @Security ApiKeyAuth // @Success 200 {object} viewmodels.TreeContract "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}" // @Router /api/contract [get] func (c *ContractApi) Get() { // 获得项目ID projectIdInt, err := utils.GetProjectId(c.Ctx) if err != nil { c.Ctx.JSON(iris.Map{ "code": -1, "msg": err, }) return } // 获得层级文件夹 FolderData := c.ServiceTree.GetAllContract(projectIdInt) c.Ctx.JSON(iris.Map{ "code": 0, "msg": "", "data": FolderData, }) } func (c *ContractApi) GetIncome() { // 1.未设置了项目节 // 返回项目节2个基础模板 // 2.已设置项目节 // 返回项目相关所有信息 }