浏览代码

Merge branch 'CRM_14.0' into debug

ziwen 1 年之前
父节点
当前提交
986ace7922
共有 3 个文件被更改,包括 8 次插入59 次删除
  1. 3 4
      controllers/help_doc/classify.go
  2. 5 3
      controllers/help_doc/doc.go
  3. 0 52
      models/help_doc/classify.go

+ 3 - 4
controllers/help_doc/classify.go

@@ -44,7 +44,7 @@ func (this *HelpDocClassifyController) ListClassify() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-	rootListAll := make([]help_doc.HelpDocClassifyItems,0)
+	rootListAll := make([]help_doc.HelpDocClassifyItems, 0)
 	rootListAll = rootList
 	nodeAll := make([]*help_doc.HelpDocClassifyItems, 0)
 	for k := range rootListAll {
@@ -60,7 +60,7 @@ func (this *HelpDocClassifyController) ListClassify() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-	rootListLevel := make([]help_doc.HelpDocClassifyItems,0)
+	rootListLevel := make([]help_doc.HelpDocClassifyItems, 0)
 	rootListLevel = rootList
 	nodeAllTwoLevel := make([]*help_doc.HelpDocClassifyItems, 0)
 	for k := range rootListLevel {
@@ -69,7 +69,6 @@ func (this *HelpDocClassifyController) ListClassify() {
 		nodeAllTwoLevel = append(nodeAllTwoLevel, &rootNode)
 	}
 
-
 	resp.AllNodes = nodeAll
 	resp.TwoLevelNodes = nodeAllTwoLevel
 	br.Ret = 200
@@ -405,4 +404,4 @@ func (this *HelpDocClassifyController) ClassifyMove() {
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "移动成功"
-}
+}

+ 5 - 3
controllers/help_doc/doc.go

@@ -2,6 +2,7 @@ package help_doc
 
 import (
 	"encoding/json"
+	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hz_crm_api/controllers"
 	"hongze/hz_crm_api/models"
@@ -42,6 +43,7 @@ func (this *HelpDocController) Add() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
+	fmt.Println("Id:",req.Id)
 	if req.Content == "" {
 		br.Msg = "请输入内容"
 		return
@@ -81,7 +83,7 @@ func (this *HelpDocController) Add() {
 		item.PublishTime = time.Now()
 	}
 
-	if item.Id == 0 {
+	if req.Id == 0 {
 		_, err = help_doc.AddHelpDoc(item)
 		if err != nil {
 			br.Msg = "新增失败"
@@ -150,7 +152,7 @@ func (this *HelpDocController) Detail() {
 
 	var recommend []help_doc.RecommendList
 	if item.Recommend != "" {
-		err = json.Unmarshal([]byte(item.Recommend), &anchor)
+		err = json.Unmarshal([]byte(item.Recommend), &recommend)
 		if err != nil {
 			br.Msg = "解析失败"
 			br.ErrMsg = "解析失败,Err:" + err.Error()
@@ -255,7 +257,7 @@ func (this *HelpDocController) ListReport() {
 
 		var recommend []help_doc.RecommendList
 		if item.Recommend != "" {
-			err = json.Unmarshal([]byte(item.Recommend), &anchor)
+			err = json.Unmarshal([]byte(item.Recommend), &recommend)
 			if err != nil {
 				br.Msg = "解析失败"
 				br.ErrMsg = "解析失败,Err:" + err.Error()

+ 0 - 52
models/help_doc/classify.go

@@ -63,24 +63,6 @@ func EditHelpDocClassify(classifyId int, HelpDocClassifyName string) (err error)
 	return
 }
 
-func GetChartInfoCountByClassifyId(classifyId int) (count int, err error) {
-	o := orm.NewOrm()
-	sql := ` SELECT COUNT(1) AS count FROM chart_info AS a
-				WHERE a.classify_id IN(
-				SELECT t.classify_id FROM 
-				(
-				SELECT rd.*
-				FROM (SELECT * FROM help_doc_classify WHERE parent_id IS NOT NULL) rd,
-					 (SELECT @pid := ?) pd 
-				WHERE FIND_IN_SET(parent_id, @pid) > 0 
-				  AND @pid := CONCAT(@pid, ',', classify_id) 
-				UNION SELECT * FROM help_doc_classify WHERE classify_id = @pid
-				)AS t
-				) `
-	err = o.Raw(sql, classifyId).QueryRow(&count)
-	return
-}
-
 // GetHelpDocClassifyByParentId
 func GetHelpDocClassifyByParentId(parentId int, keyWord string) (items []HelpDocClassifyItems, err error) {
 	o := orm.NewOrm()
@@ -192,40 +174,6 @@ type HelpDocClassifyView struct {
 	ParentId            int    `description:"父级id"`
 }
 
-func GetHelpDocClassifyViewById(classifyId int) (item *HelpDocClassifyView, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM help_doc_classify WHERE classify_id=? `
-	err = o.Raw(sql, classifyId).QueryRow(&item)
-	return
-}
-
-func GetHelpDocClassifyByParentIdFromETA(parentId int) (items []*HelpDocClassifyItems, err error) {
-	o := orm.NewOrm()
-	sql := ` SELECT * FROM help_doc_classify WHERE parent_id=? AND source = 1 order by sort asc,classify_id asc`
-	_, err = o.Raw(sql, parentId).QueryRows(&items)
-	return
-}
-
-func GetHelpDocClassifyAllFromETA() (items []*HelpDocClassifyItems, err error) {
-	o := orm.NewOrm()
-	sql := ` SELECT * FROM help_doc_classify WHERE parent_id<>0 AND source = 1 order by sort asc,classify_id asc`
-	_, err = o.Raw(sql).QueryRows(&items)
-	return
-}
-
-func GetHelpDocClassifyTwo(source int) (items []*HelpDocClassifyItems, err error) {
-	o := orm.NewOrm()
-	sql := ` SELECT * FROM help_doc_classify WHERE level=3 AND source = ? order by sort asc,classify_id asc`
-	_, err = o.Raw(sql, source).QueryRows(&items)
-	return
-}
-
-func GetHelpDocClassifyByLevel(level, source int) (items []*HelpDocClassifyItems, err error) {
-	o := orm.NewOrm()
-	sql := ` SELECT * FROM help_doc_classify WHERE level=? AND source = ? order by sort asc,classify_id asc`
-	_, err = o.Raw(sql, level, source).QueryRows(&items)
-	return
-}
 
 func EditHelpDocClassifySysUser(classifyId, sysUserId int, HelpDocClassifyName string) (err error) {
 	o := orm.NewOrm()