lanjianrong 4 lat temu
rodzic
commit
6eb3bcf4c0

+ 1 - 1
dao/tree_contract_dao.go

@@ -33,7 +33,7 @@ func NewTreeContractDao(engine *xorm.Engine) *TreeContractDao {
 
 func (d *TreeContractDao) GetDetail(id int) *viewmodels.TreeSectionDetail {
 	data := &viewmodels.TreeSectionDetail{}
-	_, _ = d.engine.Sql("select t.name, s.content, f.ext, f.path, f.id as fid from cm_tree_contracts as t left join cm_contracts as s on t.contract_id = s.id  left join cm_upload as f on t.contract_id = f.id where t.id = ?", id).Get(data)
+	_, _ = d.engine.Sql("select t.name, s.content, f.ext, f.path as filepath, f.id as fid, f.name as filename from cm_tree_contracts as t left join cm_contracts as s on t.contract_id = s.id  left join cm_upload as f on t.contract_id = f.id where t.id = ?", id).Get(data)
 	fmt.Println(data)
 	if data.Fid != "" {
 		fid, _ := comm.AesEncrypt(data.Fid, conf.SignSecret)

+ 6 - 5
web/viewmodels/tree_section_contract.go

@@ -46,11 +46,12 @@ type TreeSectionContract struct {
 }
 
 type TreeSectionDetail struct {
-	Name    string `from:"name" json:"name"`
-	Content string `from:"content" json:"content"`
-	Path    string `from:"path" json:"path"`
-	Ext     string `from:"ext" json:"ext"`
-	Fid     string `from:"fid" json:"fid"`
+	Name     string `from:"name" json:"name"`
+	Content  string `from:"content" json:"content"`
+	Filepath string `from:"filepath" json:"filepath"`
+	Filename string `from:"filename" json:"filename"`
+	Ext      string `from:"ext" json:"ext"`
+	Fid      string `from:"fid" json:"fid"`
 }
 
 func (l TreeSectionContract) ValidateDepth() error {