| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | /* * @description: 标段相关的接口api * @Author: CP * @Date: 2020-09-28 10:26:49 * @FilePath: \construction_management\web\api\bidsection_api.go */package apiimport (	"fmt"	"strconv"	"github.com/kataras/iris/v12"	"go.mod/services"	"go.mod/web/utils")type BidsectionApi struct {	//框架-web应用上下文环境	Ctx iris.Context	// 需要用的service	ServiceBidsection services.BidsectionService}// 获得项目目录结构func (c *BidsectionApi) Get() {}// @Summary 新增标段// @Tags 目录相关-管理员// @Description 新增标段// @Accept  json// @Produce  json// @Security ApiKeyAuth// @Param   folderId     body    string     true        "目录ID"// @Param   name     body    string     true        "名称"// @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"// @Router /api/bidsection/create [post]func (c *BidsectionApi) PostCreate() {	ErrMsg := ""	// 验证内容	BidsectionData, err := c.ServiceBidsection.ValidRule(c.Ctx)	if err != nil {		ErrMsg = utils.FormValidError(err)		c.Ctx.JSON(iris.Map{			"code": -1,			"msg":  ErrMsg,		})		return	} else {		// 获得项目ID		projectIdInt, err := utils.GetProjectId(c.Ctx)		if err != nil {			c.Ctx.JSON(iris.Map{				"code": -1,				"msg":  fmt.Sprintf("%s", err),			})			return		}		BidsectionData.ProjectId = strconv.Itoa(projectIdInt)		// 新增标段-新增树结构里的标段		err = c.ServiceBidsection.Create(BidsectionData)		if err != nil {			c.Ctx.JSON(iris.Map{				"code": -1,				"msg":  fmt.Sprintf("%s", err),			})			return		}		c.Ctx.JSON(iris.Map{			"code": 0,			"msg":  "新增成功",		})	}}
 |