lanjianrong 4 سال پیش
والد
کامیت
6feb8efc8d
2فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 8 1
      dao/tree_contract_dao.go
  2. 3 0
      web/viewmodels/tree_section_contract.go

+ 8 - 1
dao/tree_contract_dao.go

@@ -13,6 +13,8 @@ import (
 	"strings"
 
 	"github.com/go-xorm/xorm"
+	"go.mod/comm"
+	"go.mod/conf"
 	"go.mod/models"
 	"go.mod/web/viewmodels"
 )
@@ -31,8 +33,13 @@ 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 from cm_tree_contracts as t left join cm_contracts as s on t.contract_id = s.id where t.id = ?", id).Get(data)
+	_, _ = 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)
+	fmt.Println(data)
+	if data.Fid != "" {
+		fid, _ := comm.AesEncrypt(data.Fid, conf.SignSecret)
+		data.Fid = fid
 
+	}
 	return data
 }
 

+ 3 - 0
web/viewmodels/tree_section_contract.go

@@ -48,6 +48,9 @@ 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"`
 }
 
 func (l TreeSectionContract) ValidateDepth() error {