浏览代码

Merge branch 'cygx_6.6' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 年之前
父节点
当前提交
3eca4f1a6b

+ 1 - 0
controllers/activity.go

@@ -848,6 +848,7 @@ func (this *ActivityCoAntroller) Detail() {
 		} else {
 			activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
 		}
+		activityInfo.ActivityTypeName = strings.Replace(activityInfo.ActivityTypeName, "(C类)", "", -1)
 		resp.Detail = activityInfo
 	}
 	resp.HasPermission = hasPermission

+ 29 - 0
models/activity_appointment.go

@@ -195,3 +195,32 @@ func GetCygxAppointmentSummaryListBySubjectId(subjectIds string) (item []*CygxAp
 	_, err = o.Raw(sql).QueryRows(&item)
 	return
 }
+
+type CygxAppointment struct {
+	Mobile         string `description:"手机号"`
+	UserId         int `description:"userId"`
+	ActivityName   string `description:"所属销售"`
+	ActivityTypeId int    `description:"活动类型"`
+}
+
+//通过活动ID获取预约纪要的人数列表
+func GetCygxAppointmentSummaryBySubjectId(subjectIds string) (item []*CygxAppointment, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			ap.user_id,
+			ap.mobile,
+			ap.activity_id,
+			a.activity_name 
+		FROM
+			cygx_activity_appointment AS ap
+			INNER JOIN cygx_activity AS a ON a.activity_id = ap.activity_id
+			INNER JOIN cygx_industrial_activity_group_subject AS sg ON sg.activity_id = a.activity_id 
+		WHERE
+			a.active_state = 3
+			AND sg.industrial_subject_id IN (` + subjectIds + `) 
+		GROUP BY
+			ap.mobile,
+			ap.activity_id `
+	_, err = o.Raw(sql).QueryRows(&item)
+	return
+}

+ 20 - 18
models/activity_attendance_detail.go

@@ -25,6 +25,7 @@ type CygxActivityAttendanceDetail struct {
 	IsMeetingStr          int       `description:"是否到会,1到会,0未到会"`
 	UseridEntity          int       `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
 	ActivityTime          string    `description:"活动时间"`
+	CrmCompanyMapStatusId int       `description:"转换后的对应状态信息:1=正式客户, 2=曾使用客户, 3=其他"`
 }
 
 //添加会议提醒信息
@@ -83,24 +84,25 @@ func AddCygxActivityAttendanceDetail(item *CygxActivityAttendanceDetail) (lastId
 }
 
 type RoadshowData struct {
-	Id                int    `orm:"column(id);pk;"description:"主键ID"`
-	Company           string `description:"公司名称"`
-	UserName          string `description:"用户名"`
-	UserPhone         string `description:"手机号"`
-	UserinfoUource    string `description:"用户来源"`
-	AuthInfo          string `description:"用户参会鉴权"`
-	GuestUsername     string `description:"嘉宾名称, 多个用,隔开"`
-	FirstWatchTime    string `description:"首次观看时间"`
-	LastWatchTime     string `description:"最后观看时间"`
-	RoadshowId        string `description:"路演ID"`
-	RoadshowTitle     string `description:"路演标题"`
-	RoadshowBeginTime string `description:"路演开始时间"`
-	RoadshowEndTime   string `description:"路演结束时间"`
-	JoinTime          int    `description:"参与时长"`
-	JoinType          int    `description:"参与方式, 1网络, 2电话"`
-	DataType          int    `description:"数据类型: 1直播, 2回放"`
-	Occupation        string `description:"职位"`
-	UseridEntity      int    `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
+	Id                    int    `orm:"column(id);pk;"description:"主键ID"`
+	Company               string `description:"公司名称"`
+	UserName              string `description:"用户名"`
+	UserPhone             string `description:"手机号"`
+	UserinfoUource        string `description:"用户来源"`
+	AuthInfo              string `description:"用户参会鉴权"`
+	GuestUsername         string `description:"嘉宾名称, 多个用,隔开"`
+	FirstWatchTime        string `description:"首次观看时间"`
+	LastWatchTime         string `description:"最后观看时间"`
+	RoadshowId            string `description:"路演ID"`
+	RoadshowTitle         string `description:"路演标题"`
+	RoadshowBeginTime     string `description:"路演开始时间"`
+	RoadshowEndTime       string `description:"路演结束时间"`
+	JoinTime              int    `description:"参与时长"`
+	JoinType              int    `description:"参与方式, 1网络, 2电话"`
+	DataType              int    `description:"数据类型: 1直播, 2回放"`
+	Occupation            string `description:"职位"`
+	UseridEntity          int    `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
+	CrmCompanyMapStatusId int    `description:"转换后的对应状态信息:1=正式客户, 2=曾使用客户, 3=其他"`
 }
 
 func AddAttendancDetail(items []*CygxActivityAttendanceDetail, activityId int, mobileStr string) (err error) {

+ 4 - 4
models/article_celue_push.go

@@ -15,15 +15,15 @@ type CygxArticleCeluePush struct {
 
 func GetArticleCeluePushList() (item []*CygxArticleCeluePush, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT *  FROM	cygx_article_celue_push WHERE	is_handle = 0   `
+	sql := ` SELECT *  FROM	cygx_article_celue_push WHERE	is_handle = 0    GROUP BY article_id   `
 	_, err = o.Raw(sql).QueryRows(&item)
 	return
 }
 
 //更改推送内容是否处理状态
-func UpdateCygxArticleCeluePush(id int) (err error) {
+func UpdateCygxArticleCeluePush(articleId int) (err error) {
 	o := orm.NewOrm()
-	sql := `UPDATE cygx_article_celue_push SET is_handle=1 WHERE id=? `
-	_, err = o.Raw(sql, id).Exec()
+	sql := `UPDATE cygx_article_celue_push SET is_handle=1 WHERE article_id=? `
+	_, err = o.Raw(sql, articleId).Exec()
 	return
 }

+ 11 - 0
models/user_record.go

@@ -152,3 +152,14 @@ func GetOpenIdDetailByMobile(platform int, bindAccount string) (item *OpenIdList
 	err = o.Raw(sql, platform, bindAccount).QueryRow(&item)
 	return
 }
+
+func GetOpenIdByUserIds(ids string) (item []*OpenIdList, err error) {
+	o := orm.NewOrm()
+	var sql string
+	sql = `SELECT cr.open_id,wu.user_id FROM user_record  as u 
+			INNER JOIN cygx_user_record AS cr ON cr.union_id = u.union_id 
+			INNER JOIN wx_user AS wu ON wu.mobile = u.bind_account 
+			WHERE create_platform=4 AND u.user_id IN (`+ids+`)`
+	_,err = o.Raw(sql).QueryRows(&item)
+	return
+}

+ 12 - 2
models/wx_user_code.go

@@ -100,8 +100,7 @@ func GetCygxUserFllowCeLueOpenid(categoryId int) (items []*OpenIdList, err error
 		WHERE
 			r.create_platform = 4
 			AND s.is_refuse = 0
-			AND s.is_subjective = 1
-			AND s.is_objective = 1
+			AND (s.is_subjective = 1 OR s.is_objective = 1)
 			AND f.category_id = ?`
 	_, err = o.Raw(sql, categoryId).QueryRows(&items)
 	return
@@ -129,3 +128,14 @@ func GetCygxXzsChooseSend() (items []*CygxXzsChooseSend, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+
+//获取提交过推送规则用户的userId
+func GetCygxXzsChooseSendOpenIdByUserIds(idStr string) (items []*OpenIdList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT ur.user_id, cr.open_id FROM user_record AS ur
+INNER JOIN cygx_user_record AS cr
+WHERE ur.user_id IN (` + idStr + `) AND create_platform=4 AND ur.union_id=cr.union_id `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 2 - 0
services/activity.go

@@ -846,6 +846,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 							item.Position = v.Occupation
 							item.UseridEntity = v.UseridEntity
 							item.ActivityTime = activityDetail.ActivityTime
+							item.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
 							item.CreateTime = time.Now()
 							mobileStr += "'" + v.UserPhone + "'" + ","
 							needAddAttendanc = append(needAddAttendanc, item)
@@ -952,6 +953,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 							item.Position = v.Occupation
 							item.UseridEntity = v.UseridEntity
 							item.ActivityTime = vAct.ActivityTime
+							item.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
 							item.CreateTime = time.Now()
 							mobileStr += "'" + v.UserPhone + "'" + ","
 							needAddAttendanc = append(needAddAttendanc, item)

+ 191 - 9
services/article.go

@@ -629,7 +629,7 @@ func GetArticleListByApi(cont context.Context) (err error) {
 	}
 	for _, v := range listUpdateArticle {
 		// 这里直接go出去会出现并发,导致文章md5ID唯一索引限制报错
-		err = HandleArticleListByApi(v.ArticleId, v.Id)
+		err = HandleArticleListByApi(v.ArticleId)
 		if err != nil {
 			utils.FileLog.Info("WxGetToken Result:%s ", err.Error())
 		}
@@ -638,7 +638,7 @@ func GetArticleListByApi(cont context.Context) (err error) {
 }
 
 //处理同步过来的文章
-func HandleArticleListByApi(artcleId, celuePushId int) (err error) {
+func HandleArticleListByApi(artcleId int) (err error) {
 	defer func() {
 		if err != nil {
 			go utils.SendAlarmMsg("处理同步策略平台数据失败"+"GetArticleListByApi ErrMsg:"+err.Error(), 2)
@@ -744,7 +744,7 @@ func HandleArticleListByApi(artcleId, celuePushId int) (err error) {
 			fmt.Println("UpdateArticlePublish Err:", err.Error())
 			return err
 		}
-		go models.UpdateCygxArticleCeluePush(celuePushId)
+		go models.UpdateCygxArticleCeluePush(artcleId)
 		return err
 
 	}
@@ -1142,7 +1142,7 @@ func HandleArticleListByApi(artcleId, celuePushId int) (err error) {
 		//查研观向6.9模板消息推送规则
 		go DoArticleOnenIdWxTemplateMsg(v.ArticleId)
 	}
-	go models.UpdateCygxArticleCeluePush(celuePushId)
+	go models.UpdateCygxArticleCeluePush(artcleId)
 
 	return err
 }
@@ -1153,6 +1153,12 @@ func HandleArticleListByApi(artcleId, celuePushId int) (err error) {
 
 //过滤策略平台报告,研选报告重复推送,以及权限勾选的推送
 func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
+	//策略平台同步过来的文章ID,做微信模板消息推送,同一篇报告12小时只推送一次
+	cacheKey := fmt.Sprint(utils.CACHE_KEY_ARTICLE_ID_TEMPLATE, ":ArticleId", articleId)
+	ttlTime := utils.Rc.GetRedisTTL(cacheKey)
+	if ttlTime > 0 {
+		return err
+	}
 	var msg string
 	defer func() {
 		if err != nil {
@@ -1235,9 +1241,23 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 	}
 	//获取提交过推送规则的用户的 openid
 	mapUserIdChooseSend := make(map[int]int)
+	mapUserIdChooseSendTypeNoPermission := make(map[int]int)
 	chooseSendtList, err := models.GetCygxXzsChooseSend()
 	for _, v := range chooseSendtList {
 		mapUserIdChooseSend[v.UserId] = v.UserId
+		if v.IsRefuse == 1 {
+			continue
+		}
+		//获取选择主客观赛道的用户
+		if reportMapDetail.PermissionType == 1 {
+			if v.IsSubjective == 1 {
+				mapUserIdChooseSendTypeNoPermission[v.UserId] = v.UserId
+			}
+		} else {
+			if v.IsObjective == 1 {
+				mapUserIdChooseSendTypeNoPermission[v.UserId] = v.UserId
+			}
+		}
 	}
 	//已经推送了的openid
 	mapOpenidPushed := make(map[int]string)
@@ -1258,6 +1278,7 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 	keyword2 := articleInfo.Title
 	keyword3 := articleInfo.PublishDate
 	keyword4 := articleInfo.Abstract
+	mapAlreadySend := make(map[int]int)
 	//如果是策略就按照策略的推送方式来写
 	if reportMapDetail.ChartPermissionName == utils.CE_LUE_NAME {
 		//获取提交过推送规则的用户的 openid
@@ -1278,12 +1299,61 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 			openIditem.OpenId = v
 			first := "您关注的赛道,有新的报告发布/更新,欢迎查看"
 			keyword1 := "所属赛道:" + industryName
+			mapActivityUserId := make(map[int]string)
+			if articleInfo.IsSummary == 1 {
+				sliceSubjectId, _ := models.GetSubjectIds(articleId)
+				if sliceSubjectId != "" {
+					appointmentList, err := models.GetCygxAppointmentSummaryBySubjectId(sliceSubjectId)
+					if err != nil {
+						fmt.Println("GetCygxAppointmentSummaryListBySubjectId Err:", err.Error())
+						return err
+					}
+					var userIds []string
+					if len(appointmentList) > 0 {
+						for _, v := range appointmentList {
+							//fmt.Println("mapActivityUserId:", v.UserId)
+							userIds = append(userIds, strconv.Itoa(v.UserId))
+							mapActivityUserId[v.UserId] += v.ActivityName + ","
+						}
+						userIdstr := strings.Join(userIds, ",")
+						openIdLists, err := models.GetOpenIdByUserIds(userIdstr)
+						if err != nil {
+							fmt.Println("GetOpenIdByUserIds Err:", err.Error())
+							return err
+						}
+						for _, item := range openIdLists {
+							first := "您预约的调研,有关联的纪要发布/更新了1"
+							keyword1 := industryName
+							openIditem := new(models.OpenIdList)
+							openIditem.OpenId = item.OpenId
+							openIditem.UserId = item.UserId
+							if _, ok := mapAlreadySend[openIditem.UserId]; !ok {
+								SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+								delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+								fmt.Println("AlreadySend:", openIditem.UserId)
+								mapAlreadySend[openIditem.UserId] = openIditem.UserId
+							}
+						}
+					}
+				}
+				//fmt.Println("openIditem.UserId:", openIditem.UserId)
+				//if _,ok := mapActivityUserId[openIditem.UserId]; ok{
+				//	first = "您预约的调研,有关联的纪要发布/更新了"
+				//	keyword1 = industryName
+				//	SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+				//	delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+				//	mapAlreadySend[openIditem.UserId] = openIditem.UserId
+				//}
+			}
+			_, ok := mapAlreadySend[openIditem.UserId]
 			//如果有权限而且小助手没有提交过信息的 就做正常推送
-			if mapUserIdChooseSend[openIditem.UserId] == 0 {
+			if mapUserIdChooseSend[openIditem.UserId] == 0 && !ok {
+				fmt.Println("1:", articleId)
 				SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
 			}
 			//如果小助手勾选了对应的权限信息 就做正常推送
-			if mapUserIdChooseSend[openIditem.UserId] != 0 && mapUserFllowCeLue[openIditem.UserId] != "" {
+			if mapUserIdChooseSend[openIditem.UserId] != 0 && mapUserFllowCeLue[openIditem.UserId] != "" && !ok {
+				fmt.Println("2:", articleId)
 				SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
 			}
 		}
@@ -1306,8 +1376,12 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 					if v.IsSubjective == 1 {
 						mapUserIdChooseSendType[v.UserId] = v.UserId
 					}
+				} else if reportMapDetail.PermissionType == 2 {
+					if v.IsObjective == 1 {
+						mapUserIdChooseSendType[v.UserId] = v.UserId
+					}
 				} else {
-					if v.IsSubjective == 1 {
+					if v.IsSubjective == 1 || v.IsObjective == 1 {
 						mapUserIdChooseSendType[v.UserId] = v.UserId
 					}
 				}
@@ -1317,15 +1391,123 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 			openIditem.OpenId = v
 			first := "您关注的赛道,有新的报告发布/更新,欢迎查看"
 			keyword1 := "所属赛道:" + industryName
+			mapActivityUserId := make(map[int]string)
+			if articleInfo.IsSummary == 1 {
+				sliceSubjectId, _ := models.GetSubjectIds(articleId)
+				if sliceSubjectId != "" {
+					appointmentList, err := models.GetCygxAppointmentSummaryBySubjectId(sliceSubjectId)
+					if err != nil {
+						fmt.Println("GetCygxAppointmentSummaryListBySubjectId Err:", err.Error())
+						return err
+					}
+					var userIds []string
+					if len(appointmentList) > 0 {
+						for _, v := range appointmentList {
+							//fmt.Println("mapActivityUserId:", v.UserId)
+							userIds = append(userIds, strconv.Itoa(v.UserId))
+							mapActivityUserId[v.UserId] += v.ActivityName + ","
+						}
+						userIdstr := strings.Join(userIds, ",")
+						openIdLists, err := models.GetOpenIdByUserIds(userIdstr)
+						if err != nil {
+							fmt.Println("GetOpenIdByUserIds Err:", err.Error())
+							return err
+						}
+						for _, item := range openIdLists {
+							first := "您预约的调研,有关联的纪要发布/更新了1"
+							keyword1 := industryName
+							openIditem := new(models.OpenIdList)
+							openIditem.OpenId = item.OpenId
+							openIditem.UserId = item.UserId
+							if _, ok := mapAlreadySend[openIditem.UserId]; !ok {
+								SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+								delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+								fmt.Println("AlreadySend:", openIditem.UserId)
+								mapAlreadySend[openIditem.UserId] = openIditem.UserId
+							}
+						}
+					}
+				}
+				//fmt.Println("openIditem.UserId:", openIditem.UserId)
+				//if _,ok := mapActivityUserId[openIditem.UserId]; ok{
+				//	first = "您预约的调研,有关联的纪要发布/更新了"
+				//	keyword1 = industryName
+				//	SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+				//	delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+				//	mapAlreadySend[openIditem.UserId] = openIditem.UserId
+				//}
+			}
+
 			//如果有权限而且小助手没有提交过信息的 就做正常推送
-			if mapUserIdChooseSend[openIditem.UserId] == 0 {
+			_, ok := mapAlreadySend[openIditem.UserId]
+			if mapUserIdChooseSend[openIditem.UserId] == 0 && !ok {
 				SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+				delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+				mapAlreadySend[openIditem.UserId] = openIditem.UserId
 			}
 			//如果小助手勾选了对应的权限信息 就做正常推送
-			if mapUserIdChooseSend[openIditem.UserId] != 0 && mapOpenidFllow[openIditem.UserId] != "" && mapUserIdChooseSendType[openIditem.UserId] > 0 {
+			if mapUserIdChooseSend[openIditem.UserId] != 0 && mapOpenidFllow[openIditem.UserId] != "" && mapUserIdChooseSendType[openIditem.UserId] > 0 && !ok {
 				SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+				delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+				mapAlreadySend[openIditem.UserId] = openIditem.UserId
+			}
+		}
+
+		//获取提交过推送规则的用户的 openid 并推送模版消息
+		openIditem := new(models.OpenIdList)
+		first := "您关注的赛道,有新的报告发布/更新,欢迎查看"
+		keyword1 := "所属赛道:" + industryName
+		//mapActivityUserId := make(map[int]string)
+		//if articleInfo.IsSummary == 1 {
+		//	sliceSubjectId, _ := models.GetSubjectIds(articleId)
+		//	if sliceSubjectId != ""{
+		//		appointmentList, err := models.GetCygxAppointmentSummaryBySubjectId(sliceSubjectId)
+		//		if err != nil {
+		//			fmt.Println("GetCygxAppointmentSummaryListBySubjectId Err:", err.Error())
+		//			return err
+		//		}
+		//		if len(appointmentList) > 0 {
+		//			for _, v := range appointmentList {
+		//				fmt.Println("mapActivityUserId:", v.UserId)
+		//				mapActivityUserId[v.UserId] += v.ActivityName + ","
+		//				first = "您预约的调研,有关联的纪要发布/更新了"
+		//				keyword1 = industryName
+		//				if _, ok := mapAlreadySend[openIditem.UserId]; !ok{
+		//					SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+		//					delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+		//					mapAlreadySend[openIditem.UserId] = openIditem.UserId
+		//				}
+		//			}
+		//		}
+		//	}
+		//	//fmt.Println("openIditem.UserId:", openIditem.UserId)
+		//	//if _,ok := mapActivityUserId[openIditem.UserId]; ok{
+		//	//	first = "您预约的调研,有关联的纪要发布/更新了"
+		//	//	keyword1 = industryName
+		//	//	SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+		//	//	delete(mapUserIdChooseSendTypeNoPermission, openIditem.UserId)
+		//	//	mapAlreadySend[openIditem.UserId] = openIditem.UserId
+		//	//}
+		//}
+		var ids []string
+		for k, _ := range mapUserIdChooseSendTypeNoPermission {
+			ids = append(ids, strconv.Itoa(k))
+		}
+		if len(ids) > 0 {
+			idStr := strings.Join(ids, ",")
+			openidIlist, err := models.GetCygxXzsChooseSendOpenIdByUserIds(idStr)
+			if err != nil {
+				return err
+			}
+			for _, item := range openidIlist {
+				openIditem.OpenId = item.OpenId
+				openIditem.UserId = item.UserId
+				if _, ok := mapAlreadySend[openIditem.UserId]; !ok {
+					SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+				}
 			}
 		}
 	}
+	utils.Rc.Put(cacheKey, articleId, time.Hour*12)
 	return
 }

+ 9 - 9
utils/common.go

@@ -677,6 +677,15 @@ func GetAttendanceDetailSeconds(secondNum int) string {
 	return timeStr
 }
 
+// GetOrmInReplace 获取orm的in查询替换?的方法
+func GetOrmInReplace(num int) string {
+	template := make([]string, num)
+	for i := 0; i < num; i++ {
+		template[i] = "?"
+	}
+	return strings.Join(template, ",")
+}
+
 func GetLocalIP() (ip string, err error) {
 	addrs, err := net.InterfaceAddrs()
 	if err != nil {
@@ -697,12 +706,3 @@ func GetLocalIP() (ip string, err error) {
 	}
 	return
 }
-
-// GetOrmInReplace 获取orm的in查询替换?的方法
-func GetOrmInReplace(num int) string {
-	template := make([]string, num)
-	for i := 0; i < num; i++ {
-		template[i] = "?"
-	}
-	return strings.Join(template, ",")
-}

+ 2 - 1
utils/constants.go

@@ -61,7 +61,8 @@ var (
 
 //缓存key
 const (
-	CACHE_KEY_USER_VIEW = "user_view_record" //用户阅读数据
+	CACHE_KEY_USER_VIEW           = "user_view_record"           //用户阅读数据
+	CACHE_KEY_ARTICLE_ID_TEMPLATE = "ce_lue_article_id_template" //策略平台同步过来的文章ID,做微信模板消息推送,同一篇报告12小时只推送一次
 )
 
 //模板消息推送类型