Преглед изворни кода

Merge branch 'need/cygx_959' of http://8.136.199.33:3000/hongze/hongze_cygx

zhangchuanxing пре 3 месеци
родитељ
комит
3f8a47322a
3 измењених фајлова са 67 додато и 38 уклоњено
  1. 32 12
      controllers/report_selection.go
  2. 20 14
      models/report_selection.go
  3. 15 12
      models/report_selection_subject_history.go

+ 32 - 12
controllers/report_selection.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"encoding/json"
+	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
@@ -165,8 +166,25 @@ func (this *ReportSelectionController) Detail() {
 					if v2.Label != "" {
 						v2.CompanyLabel = strings.Split(v2.Label, "{|}")
 					}
+					if v2.SubjectName == "" {
+						v2.ShowName = v2.IndustrialManagementNames
+					} else {
+						v2.ShowName = v2.SubjectName
+					}
+				}
+				subjectItem := new(models.ReportSelectionChartLogSubjectName)
+				subjectItem.SubjectName = v2.SubjectName
+				subjectItem.IsNew = v2.IsNew
+				subjectItem.IndustrialSubjectId = v2.IndustrialSubjectId
+				subjectItem.IndustrialManagementId, _ = strconv.Atoi(v2.IndustrialManagementId)
+				subjectItem.IndustrialManagementName = v2.IndustrialManagementNames
+				if subjectItem.SubjectName == "" {
+					subjectItem.SubjectName = subjectItem.IndustrialManagementName
 				}
-				itemSubject.ListSubject = append(itemSubject.ListSubject, &models.ReportSelectionChartLogSubjectName{SubjectName: v2.SubjectName, IsNew: v2.IsNew, IndustrialSubjectId: v2.IndustrialSubjectId})
+				subjectItem.Md5String = utils.MD5(fmt.Sprint("IN_ID", v2.IndustrialManagementId, "S_ID", v2.IndustrialSubjectId))
+				v2.Md5String = subjectItem.Md5String
+				itemSubject.ListSubject = append(itemSubject.ListSubject, subjectItem)
+				//itemSubject.ListSubject = append(itemSubject.ListSubject, &models.ReportSelectionChartLogSubjectName{SubjectName: v2.SubjectName, IsNew: v2.IsNew, IndustrialSubjectId: v2.IndustrialSubjectId})
 			}
 			item.BodyChartSummary = mapChartLog[v.PermissionName]
 			item.List = listSonLog
@@ -237,21 +255,23 @@ func (this *ReportSelectionController) ClickHistory() {
 		br.ErrMsg = "文章不存在,文章ID错误"
 		return
 	}
-	if req.IndustrialSubjectId <= 0 {
+	if req.IndustrialSubjectId+req.IndustrialManagementId <= 0 {
 		br.Msg = "标的ID不存在"
-		br.ErrMsg = "标的ID不存在,标的ID错误"
+		br.ErrMsg = "产业或标的ID不存在"
 		return
 	}
 	item := models.CygxReportSelectionSubjectHistory{
-		UserId:              user.UserId,
-		ArticleId:           req.ArticleId,
-		CreateTime:          time.Now(),
-		ModifyTime:          time.Now(),
-		Mobile:              user.Mobile,
-		Email:               user.Email,
-		CompanyId:           user.CompanyId,
-		CompanyName:         user.CompanyName,
-		IndustrialSubjectId: req.IndustrialSubjectId,
+		UserId:                 user.UserId,
+		ArticleId:              req.ArticleId,
+		CreateTime:             time.Now(),
+		ModifyTime:             time.Now(),
+		Mobile:                 user.Mobile,
+		Email:                  user.Email,
+		CompanyId:              user.CompanyId,
+		CompanyName:            user.CompanyName,
+		IndustrialSubjectId:    req.IndustrialSubjectId,
+		IndustrialManagementId: req.IndustrialManagementId,
+		RegisterPlatform:       utils.REGISTER_PLATFORM,
 	}
 	err = models.AddCygxReportSelectionSubjectHistory(&item)
 	if err != nil {

+ 20 - 14
models/report_selection.go

@@ -67,23 +67,29 @@ type ReportSelectionChartLogPermission struct {
 }
 
 type ReportSelectionChartLogSubjectName struct {
-	SubjectName         string `description:"标的名称"`
-	IndustrialSubjectId int    `description:"标的ID"`
-	IsNew               bool   `description:"是否展示新标签"`
+	SubjectName              string `description:"标的名称"`
+	IndustrialSubjectId      int    `description:"标的ID"`
+	IndustrialManagementId   int    `description:"产业Id"`
+	IndustrialManagementName string `description:"产业资源包名称"`
+	IsNew                    bool   `description:"是否展示新标签"`
+	Md5String                string `description:"Md5唯一标识"`
 }
 
 type CygxReportSelectionLogDetail struct {
-	IndustrialManagementId string   `description:"产业Id"`
-	IndustrialSubjectId    int      `description:"标的ID"`
-	SubjectName            string   `description:"标的名称"`
-	IsShowApplyButton      bool     `description:"是否展示申请路由按钮"`
-	IsNew                  bool     `description:"是否展示新标签"`
-	Body                   string   `description:"内容"`
-	CompanyLabel           []string `description:"公司标签"`
-	Label                  string   `description:"公司标签"`
-	OverviewArticleId      int      `description:"综述报告Id"`
-	IsShowOverviewArticle  int      `description:"是否展示综述报告 1展示,0隐藏"`
-	List                   []*IndustriaReportSelection
+	IndustrialManagementId    string   `description:"产业Id"`
+	IndustrialManagementNames string   `description:"产业资源包名称  多个用 , 隔开"`
+	IndustrialSubjectId       int      `description:"标的ID"`
+	SubjectName               string   `description:"标的名称"`
+	IsShowApplyButton         bool     `description:"是否展示申请路由按钮"`
+	IsNew                     bool     `description:"是否展示新标签"`
+	Body                      string   `description:"内容"`
+	CompanyLabel              []string `description:"公司标签"`
+	Label                     string   `description:"公司标签"`
+	OverviewArticleId         int      `description:"综述报告Id"`
+	IsShowOverviewArticle     int      `description:"是否展示综述报告 1展示,0隐藏"`
+	Md5String                 string   `description:"Md5唯一标识"`
+	ShowName                  string   `description:"展示名称"`
+	List                      []*IndustriaReportSelection
 }
 type IndustriaReportSelection struct {
 	IndustrialManagementId int    `description:"产业Id"`

+ 15 - 12
models/report_selection_subject_history.go

@@ -6,21 +6,24 @@ import (
 )
 
 type CygxReportSelectionSubjectHistory struct {
-	Id                  int       `orm:"column(id);pk"`
-	ArticleId           int       `description:"文章ID"`
-	UserId              int       `description:"用户ID"`
-	CreateTime          time.Time `description:"创建时间"`
-	ModifyTime          time.Time `description:"修改时间"`
-	Mobile              string    `description:"手机号"`
-	Email               string    `description:"邮箱"`
-	CompanyId           int       `description:"公司id"`
-	CompanyName         string    `description:"公司名称"`
-	IndustrialSubjectId int       `description:"标的ID"`
+	Id                     int       `orm:"column(id);pk"`
+	ArticleId              int       `description:"文章ID"`
+	UserId                 int       `description:"用户ID"`
+	CreateTime             time.Time `description:"创建时间"`
+	ModifyTime             time.Time `description:"修改时间"`
+	Mobile                 string    `description:"手机号"`
+	Email                  string    `description:"邮箱"`
+	CompanyId              int       `description:"公司id"`
+	CompanyName            string    `description:"公司名称"`
+	IndustrialSubjectId    int       `description:"标的ID"`
+	IndustrialManagementId int       `description:"产业Id"`
+	RegisterPlatform       int       `description:"来源 1小程序,2:网页"`
 }
 
 type AddCygxReportSelectionSubjectHistoryReq struct {
-	ArticleId           int `description:"文章id"`
-	IndustrialSubjectId int `description:"标的ID"`
+	ArticleId              int `description:"文章id"`
+	IndustrialSubjectId    int `description:"标的ID"`
+	IndustrialManagementId int `description:"产业Id"`
 }
 
 // 添加