浏览代码

Merge branch 'cygx/cygx_need_p2_867' of http://8.136.199.33:3000/hongze/hz_crm_api

xingzai 1 年之前
父节点
当前提交
8a24c5cd14
共有 1 个文件被更改,包括 38 次插入34 次删除
  1. 38 34
      services/cygx/product_interior.go

+ 38 - 34
services/cygx/product_interior.go

@@ -171,32 +171,35 @@ func SendWxMsgWithCygxProductInterior(productInteriorId int) (err error) {
 		err = errors.New("获取所有有权的用户的 openid失败" + e.Error())
 		return
 	}
-	//var industrialName string
+	var industrialName string
+
+	industrialList, e := cygx.GetProductInteriorIndustrialGroupManagementList(productInteriorId)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetProductInteriorIndustrialGroupManagementList,Err:" + e.Error())
+		return
+	}
+
+	//关联的产业推送产业,没有关联产业的推送行业 p2_867 2023-8-30
+	if len(industrialList) == 0 {
+		industrialName = detail.ChartPermissionName
+	} else {
+		//mapOpenidFllow := make(map[int]string)
+		//
+		for _, vindustr := range industrialList {
+			//获取关注对应产业的用户信息
+			//industryFllowList, e := cygx.GetCygxUserindustryFllowOpenid(vindustr.IndustrialManagementId)
+			//if e != nil {
+			//	err = errors.New("获取关注对应产业的用户信息失败 " + e.Error())
+			//	return
+			//}
+			//for _, v := range industryFllowList {
+			//	mapOpenidFllow[v.UserId] = v.OpenId
+			//}
+			industrialName += vindustr.IndustryName + ";"
+		}
+		industrialName = strings.TrimRight(industrialName, ";")
+	}
 
-	//industrialList, e := cygx.GetProductInteriorIndustrialGroupManagementList(productInteriorId)
-	//if e != nil && e.Error() != utils.ErrNoRow() {
-	//	err = errors.New("GetProductInteriorIndustrialGroupManagementList,Err:" + e.Error())
-	//	return
-	//}
-	//
-	//if len(industrialList) == 0 {
-	//	return
-	//}
-	//mapOpenidFllow := make(map[int]string)
-	//
-	//for _, vindustr := range industrialList {
-	//	//获取关注对应产业的用户信息
-	//	industryFllowList, e := cygx.GetCygxUserindustryFllowOpenid(vindustr.IndustrialManagementId)
-	//	if e != nil {
-	//		err = errors.New("获取关注对应产业的用户信息失败 " + e.Error())
-	//		return
-	//	}
-	//	for _, v := range industryFllowList {
-	//		mapOpenidFllow[v.UserId] = v.OpenId
-	//	}
-	//	industrialName += vindustr.IndustryName + ";"
-	//}
-	//industrialName = strings.TrimRight(industrialName, ";")
 	////获取拒绝接收推送的的用户的 openid
 	//mapOpenidRefuset := make(map[int]string)
 	//openidRefusetList, e := cygx.GetCygxUserRefusetOpenid()
@@ -209,14 +212,14 @@ func SendWxMsgWithCygxProductInterior(productInteriorId int) (err error) {
 	//}
 
 	//获取提交过推送规则的用户的 openid
-	mapUserIdChooseSend := make(map[int]int)
-	chooseSendtList, err := cygx.GetCygxXzsChooseSend("")
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		return err
-	}
-	for _, v := range chooseSendtList {
-		mapUserIdChooseSend[v.UserId] = v.UserId
-	}
+	//mapUserIdChooseSend := make(map[int]int)
+	//chooseSendtList, err := cygx.GetCygxXzsChooseSend("")
+	//if err != nil && err.Error() != utils.ErrNoRow() {
+	//	return err
+	//}
+	//for _, v := range chooseSendtList {
+	//	mapUserIdChooseSend[v.UserId] = v.UserId
+	//}
 	openIdArr := make([]string, len(openidPowerList))
 	for i, v := range openidPowerList {
 		//if _, ok := mapOpenidRefuset[v.UserId]; ok {
@@ -229,8 +232,9 @@ func SendWxMsgWithCygxProductInterior(productInteriorId int) (err error) {
 		//}
 		openIdArr[i] = v.OpenId
 	}
+
 	first := "您关注的赛道,有新的报告发布/更新,欢迎查看"
-	keyword1 := "【" + detail.ChartPermissionName + "】有报告发布/更新"
+	keyword1 := "【" + industrialName + "】有报告发布/更新"
 	keyword2 := detail.Title
 	keyword3 := utils.TimeRemoveHms2(detail.PublishTime)
 	keyword4 := detail.Abstract