lanjianrong %!s(int64=4) %!d(string=hai) anos
pai
achega
ef7bc8a8f8

+ 1 - 1
conf/db.go

@@ -38,4 +38,4 @@ var DbMasterList = []DbConfig{
 	},
 }
 
-var DbMaster = DbMasterList[0]
+var DbMaster = DbMasterList[1]

+ 2 - 2
lib/item_section.go

@@ -50,8 +50,8 @@ type ItemSectionTemplateTree struct {
 	Attribution string                     `form:"attribution" json:"attribution"`
 	Leaf        bool                       `json:"leaf" `
 	Children    []*ItemSectionTemplateTree `json:"children"`
-
-	IsEnd bool `json:"isEnd"`
+	Code2       string                     `josn:"code2"`
+	IsEnd       bool                       `json:"isEnd"`
 }
 
 // 获得项目节模板数据

+ 3 - 0
services/contract_section_tree_service.go

@@ -78,6 +78,7 @@ func (s *contractService) SetSection() error {
 		section.Serial = item.Serial
 		section.Attribution = item.Attribution
 		section.Code = fmt.Sprintf("%s%d", item.Attribution, item.Serial)
+		section.Code2 = item.Code2
 		section.CreateTime = time.Now()
 
 		// err := s.treeContractDao.Create(section)
@@ -147,6 +148,7 @@ func (s *contractService) ContractSectionAdd(sectionData *viewmodels.TreeSection
 	sectionCM.ParentId = sectionFather.TreeId
 	sectionCM.Name = sectionData.Name
 	sectionCM.Depth = sectionFather.Depth + 1
+	sectionCM.Code2 = sectionData.Code2
 	sectionCM.Serial = serial
 	sectionCM.Attribution = attribution
 	sectionCM.Code = code
@@ -202,6 +204,7 @@ func (s *contractService) SectionAdd(sectionData *viewmodels.TreeSectionContract
 	sectionCM.Serial = serial
 	sectionCM.Attribution = attribution
 	sectionCM.Code = code
+	sectionCM.Code2 = sectionData.Code2
 
 	data, err := s.treeContractDao.Create(sectionCM)
 	if err != nil {

+ 2 - 3
web/api/contract_section_tree_api.go

@@ -9,7 +9,6 @@ package api
 import (
 	"fmt"
 
-	"github.com/iris-contrib/middleware/jwt"
 	"github.com/kataras/iris/v12"
 	"go.mod/web/utils"
 )
@@ -237,6 +236,7 @@ func (c *ContractApi) PostSectionTemplate() {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
+// @Param   code2     body    string     true        "图表编码"
 // @Param   name     body    string     true        "项目节名称"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/add [post]
@@ -248,8 +248,7 @@ func (c *ContractApi) PostSectionAdd() {
 		return
 	}
 
-	userMsg := c.Ctx.Values().Get("jwt").(*jwt.Token).Claims.(jwt.MapClaims)
-	fmt.Println(userMsg)
+	// userMsg := c.Ctx.Values().Get("jwt").(*jwt.Token).Claims.(jwt.MapClaims)
 	// 项目ID
 	// projectIdInt, err := utils.GetProjectId(c.Ctx)
 	// if err != nil {