Explorar o código

报告详情页与文章详情页添加用户token,避免二次登录

xingzai %!s(int64=3) %!d(string=hai) anos
pai
achega
e4dffe040f

+ 19 - 5
controllers/activity.go

@@ -2653,7 +2653,11 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 		condition += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
 	}
 	if activeState != "" {
-		condition += ` AND art.active_state  IN (` + activeState + `)`
+		if activeState == "1" {
+			condition += ` AND art.active_state  IN (1,2)`
+		} else {
+			condition += ` AND art.active_state  IN (` + activeState + `)`
+		}
 	} else {
 		condition += ` AND art.active_state  IN (1)`
 	}
@@ -2700,7 +2704,7 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 	} else if activeState == "2,3" {
 		condition += ` ORDER BY art.active_state ASC, art.activity_time DESC  `
 	} else {
-		condition += ` ORDER BY art.active_state ASC, art.activity_time ASC  `
+		condition += ` ORDER BY art.activity_time ASC ,  art.active_state ASC   `
 	}
 	list, errList := models.GetActivityListAll(condition, pars, uid, startSize, pageSize)
 	if errList != nil {
@@ -2906,7 +2910,12 @@ func (this *ActivityCoAntroller) LabelTypeListPc() {
 			condition += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
 		}
 		if activeState != "" {
-			condition += ` AND art.active_state  IN (` + activeState + `)`
+			// 默认查看未开始跟进行中
+			if activeState == "1" {
+				condition += ` AND art.active_state  IN (1,2)`
+			} else {
+				condition += ` AND art.active_state  IN (` + activeState + `)`
+			}
 		} else {
 			condition += ` AND art.active_state  IN (1)`
 		}
@@ -3283,9 +3292,14 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 			condition += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
 		}
 		if activeState != "" {
-			condition += ` AND art.active_state  IN (` + activeState + `)`
+			// 默认查看未开始跟进行中
+			if activeState == "1" {
+				condition += ` AND art.active_state  IN (1,2)`
+			} else {
+				condition += ` AND art.active_state  IN (` + activeState + `)`
+			}
 		} else {
-			condition += ` AND art.active_state  IN (1)`
+			condition += ` AND art.active_state  IN (1,2)`
 		}
 		if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
 			conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%4%'	 ` + condition + `) `

+ 6 - 1
controllers/article.go

@@ -320,7 +320,12 @@ Loop:
 		}
 	}
 	if detail.ArticleId < utils.SummaryArticleId {
-		detail.HttpUrl = utils.StrategyPlatform + strconv.Itoa(articleId)
+		if user.Mobile != "" {
+			chartUserTokenByMobile, _ := services.GetUserTokenByMobile(user.Mobile)
+			detail.HttpUrl = utils.StrategyPlatform + strconv.Itoa(articleId) + "?token=" + chartUserTokenByMobile
+		} else {
+			detail.HttpUrl = utils.StrategyPlatform + strconv.Itoa(articleId)
+		}
 		detail.IsNeedJump = true
 	}
 

+ 1 - 0
controllers/chart.go

@@ -205,6 +205,7 @@ func (this *ChartController) Detail() {
 			return
 		}
 		detail.IsCollection = GetIsCollectionChart
+		detail.HttpUrl += "?token=" + chartUserTokenByMobile
 		//if !detail.IsCollection {
 		//	err = models.RemoveChartCollect(user.UserId, chartId)
 		//}

+ 26 - 3
controllers/report.go

@@ -2345,14 +2345,37 @@ func (this *ReportController) SearchResource() {
 			}
 		}
 	}
+	var IndustrialManagementIdStr string
 	for k, v := range listYx {
 		listYx[k].Source = 2
-		for _, v2 := range listSubjcet {
-			if v2.IndustrialManagementId == v.IndustrialManagementId {
-				listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+		IndustrialManagementIdStr += "," + strconv.Itoa(v.IndustrialManagementId)
+		//for _, v2 := range listSubjcet {
+		//	if v2.IndustrialManagementId == v.IndustrialManagementId {
+		//		listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+		//	}
+		//}
+
+	}
+	IndustrialManagementIdStr = strings.TrimLeft(IndustrialManagementIdStr, ",")
+	if IndustrialManagementIdStr != "" {
+		//合并产业关联的标的
+		condition = ` 	AND mg.article_id IN (SELECT mg.article_id FROM cygx_industrial_article_group_management  as mg 
+	INNER JOIN cygx_article as a ON  a.article_id = mg.article_id AND article_type != 'lyjh' WHERE mg.industrial_management_id IN (` + IndustrialManagementIdStr + `) AND mg.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` )`
+		listSubjcet, err = models.GetThemeHeatSubjectList(condition)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
+			return
+		}
+		for k, v := range listYx {
+			for _, v2 := range listSubjcet {
+				if v2.IndustrialManagementId == v.IndustrialManagementId {
+					listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+				}
 			}
 		}
 	}
+
 	if keyWord != "" {
 		keyWordItem := new(models.CygxUserSearchKeyWord)
 		keyWordItem.UserId = user.UserId

+ 0 - 1
controllers/research.go

@@ -158,7 +158,6 @@ func (this *ResearchController) HotList() {
 	startSize = utils.StartIndex(currentIndex, pageSize)
 	var condition string
 	if themeType != 2 {
-		themeType = 1
 		condition = `ORDER BY sum_num DESC `
 	} else {
 		condition = `ORDER BY publish_date DESC `

+ 5 - 4
models/report.go

@@ -384,7 +384,7 @@ func GetThemeHeatList(permissionName string, userId int, condition string, start
 			m.industry_name,
 			m.industrial_management_id,
 			m.article_read_num,
-            date_format(  MAX( a.publish_date ), '%Y-%m-%d' ) AS publish_date,	
+          	MAX( a.publish_date ) AS publish_date,
 			( SELECT count( 1 ) FROM cygx_industry_fllow AS f  WHERE f.industrial_management_id = m.industrial_management_id  AND user_id =? AND f.type = 1  ) AS fllow_num,
 			m.article_read_num + ( SELECT count( 1 ) FROM cygx_activity_meet_detail_log AS la  WHERE la.activity_id  IN  (SELECT activity_id FROM cygx_industrial_activity_group_management WHERE industrial_management_id = m.industrial_management_id  )) AS sum_num
 		FROM
@@ -677,14 +677,15 @@ func GetSearchResourceList(condition string) (items []*IndustrialManagementHotRe
 	sql := `SELECT
 			m.industry_name,
 			m.industrial_management_id,
+ 			MAX( a.publish_date ) as publish_date_order,
 			date_format( MAX( a.publish_date ), '%Y-%m-%d' ) AS publish_date 
 		FROM
 			cygx_industrial_management AS m
 			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.industrial_management_id = m.industrial_management_id
-			INNER JOIN cygx_article AS a ON a.article_id = mg.article_id 
+			INNER JOIN cygx_article AS a ON a.article_id = mg.article_id  AND  a.article_type != 'lyjh'
 		WHERE
-			1 = 1 
-			AND publish_status = 1 ` + condition + ` GROUP BY m.industrial_management_id `
+			1 = 1
+			AND publish_status = 1 ` + condition + `  GROUP BY m.industrial_management_id  ORDER BY publish_date_order DESC `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 1 - 1
services/activity.go

@@ -139,7 +139,7 @@ func SendEmailFileToExpert(cont context.Context) (err error) {
 			utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
 		}
 	}()
-	endDate := time.Now().Add(+time.Minute * 30).Format(utils.FormatDateTime)
+	endDate := time.Now().Add(+time.Minute * 60).Format(utils.FormatDateTime)
 	total, err := models.GetCountActivityIdToSendFile(endDate)
 
 	if total == 0 {

+ 3 - 0
services/send_company_user.go

@@ -115,6 +115,9 @@ func DotongbuShangHai(cont context.Context) (err error) {
 		}
 	}
 	condition = ` AND p.modify_time > ` + "'" + updateTime + "'"
+
+	//偶尔需要单独同步某一个公司的人员
+	//condition = ` AND c.company_id  =  8284  `
 	//同30小时有变更的公司
 	go DotongbuShangHaApi(condition)