浏览代码

feat:模板消息调整

wangchuanjin 1 年之前
父节点
当前提交
53d20cb3d8

+ 1 - 4
pushfollowent/push/config.json

@@ -52,10 +52,7 @@
 	"isPushMail":true,
 	"pushBatch":10,
 	"wxTplMsg":{
-		"id":"_CeF7oeZ0pr1Qp278LAE0uF2fS7_19rWjDbzmDa3sLU",
-		"keyword1":{
-			"value":"关注企业"
-		}
+		"id":"_CeF7oeZ0pr1Qp278LAE0uF2fS7_19rWjDbzmDa3sLU"
 	},
 	"freeAppMsg":{
 		"title":"您订阅的企业有新的公告信息!",

+ 1 - 3
pushfollowent/push/config/config.go

@@ -5,7 +5,6 @@ import (
 
 	util "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mail"
-	qrpc "app.yhyue.com/moapp/jybase/rpc"
 )
 
 type config struct {
@@ -45,8 +44,7 @@ type config struct {
 	FastigiumMinutePushSize int         `json:"fastigiumMinutePushSize"`
 	FastigiumTime           string      `json:"fastigiumTime"`
 	WxTplMsg                struct {
-		Id       string
-		Keyword1 *qrpc.TmplItem
+		Id string
 	} `json:"wxTplMsg"`
 	FreeAppMsg struct {
 		Title    string

+ 8 - 7
pushfollowent/push/job/pushjob.go

@@ -171,21 +171,22 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, u *FollowInfo) (pushResult
 
 //微信远程调用,实现模板发送消息
 func (p *PushJob) sendWeixin(u *FollowInfo) bool {
-	keyword2_value := ""
 	url := ""
-	suffix := ""
+	suffix1, suffix2 := "您关注的企业", ""
 	if len(u.Follows) == 1 {
-		suffix = "有变动"
+		suffix2 = "有招标动态"
 		url = Se.EncodeString(u.Id+util.If(IsObjectIdHex(u.Id), ",_id,", ",positionId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",followEntDetail") + "__" + encrypt.EncodeArticleId2ByCheck(fmt.Sprint(u.Follows[0].Id)) + "__"
 	} else {
-		suffix = fmt.Sprintf("等%d个企业有变动", len(u.Follows))
+		suffix2 = fmt.Sprintf("等%d个企业有中标动态", len(u.Follows))
 		url = Se.EncodeString(u.Id + util.If(IsObjectIdHex(u.Id), ",_id,", ",positionId,").(string) + strconv.Itoa(int(time.Now().Unix())) + ",entListFollow")
 	}
-	keyword2_value = util.ShortenTxt(20, suffix, u.Follows[0].EntName) + suffix
+	keyword1_value := suffix1 + util.ShortenTxt(20, suffix1+suffix2, u.Follows[0].EntName) + suffix2
+	firstSubtype, _ := u.Follows[0].Infos[0]["subtype"].(string)
+	suffix3 := fmt.Sprintf("发布了%s公告", firstSubtype)
+	keyword2_value := util.ShortenTxt(20, suffix3, u.Follows[0].EntName) + suffix3
 	tmplData := map[string]*qrpc.TmplItem{
 		"keyword1": &qrpc.TmplItem{
-			Value: Config.WxTplMsg.Keyword1.Value,
-			Color: Config.WxTplMsg.Keyword1.Color,
+			Value: keyword1_value,
 		},
 		"keyword2": &qrpc.TmplItem{
 			Value: keyword2_value,

+ 45 - 60
pushfollowproject/match/matcher/match.go

@@ -41,69 +41,54 @@ func (m *FMatchUser) LoadIncDatas() bool {
 	unix := time.Now().Unix()
 	query := fmt.Sprintf(projectQuery, TaskConfig.Pici, unix, projectPagingQuery)
 	logger.Info("开始加载项目。。。", query)
-	count := int(elastic.Count(Es_Projectset, Es_Projectset, fmt.Sprintf(projectQuery, TaskConfig.Pici, unix, "")))
-	logger.Info("需要加载项目", count, "条")
-	if count > Config.MaxLoadProjectCount {
-		count = Config.MaxLoadProjectCount
-		logger.Info("需要加载的项目数超过限制,只加载", Config.MaxLoadProjectCount, "条")
-	}
-	if count == 0 {
-		return false
-	}
 	var length int64
-	for t := 1; t <= 5; t++ {
-		length = 0
-		m.Projects = &sync.Map{}
-		elastic.VarEs.(*elastic.EsV7).Scroll(Es_Projectset, "5m", query, func(fv map[string]interface{}) bool {
-			if int(length) > count {
-				return false
-			}
-			length++
-			projectName := util.ObjToString(fv["projectname"])
-			projectCode := util.ObjToString(fv["projectcode"])
-			if projectName == "" && projectCode == "" {
-				return true
-			}
-			follow := &Follow{
-				ProjectName: projectName,
-				ProjectCode: projectCode,
-			}
-			infos := CSortList{}
-			list, _ := fv["list"].([]interface{})
-			for _, pv := range list {
-				pvMap, _ := pv.(map[string]interface{})
-				s_subscopeclass := pvMap["s_subscopeclass"]
-				if s_subscopeclass == nil {
-					s_subscopeclass = fv["s_subscopeclass"]
-				}
-				infos = append(infos, map[string]interface{}{
-					"_id":             pvMap["infoid"],
-					"area":            pvMap["area"],
-					"publishtime":     pvMap["publishtime"],
-					"s_subscopeclass": s_subscopeclass,
-					"subtype":         pvMap["subtype"],
-					"title":           pvMap["title"],
-					"toptype":         pvMap["toptype"],
-					"projectname":     pvMap["projectname"],
-					"projectcode":     pvMap["projectcode"],
-					"href":            pvMap["href"],
-					"infoformat":      pvMap["infoformat"],
-					"budget":          pvMap["budget"],
-					"bidamount":       pvMap["bidamount"],
-				})
-			}
-			follow.Infos = infos
-			for _, pv := range list {
-				pvMap, _ := pv.(map[string]interface{})
-				m.Projects.Store(util.ObjToString(pvMap["infoid"]), follow)
-			}
+	m.Projects = &sync.Map{}
+	elastic.VarEs.(*elastic.EsV7).Scroll(Es_Projectset, "5m", query, func(fv map[string]interface{}) bool {
+		if int(length) > Config.MaxLoadProjectCount {
+			logger.Info("需要加载的项目数超过限制,只加载", Config.MaxLoadProjectCount, "条")
+			return false
+		}
+		length++
+		projectName := util.ObjToString(fv["projectname"])
+		projectCode := util.ObjToString(fv["projectcode"])
+		if projectName == "" && projectCode == "" {
 			return true
-		})
-		if int(length) >= count {
-			break
 		}
-		logger.Info("加载项目", "第", t, "次加载数据完成,数据总数", length, count, ",由于数据量不够,重新加载")
-	}
+		follow := &Follow{
+			ProjectName: projectName,
+			ProjectCode: projectCode,
+		}
+		infos := CSortList{}
+		list, _ := fv["list"].([]interface{})
+		for _, pv := range list {
+			pvMap, _ := pv.(map[string]interface{})
+			s_subscopeclass := pvMap["s_subscopeclass"]
+			if s_subscopeclass == nil {
+				s_subscopeclass = fv["s_subscopeclass"]
+			}
+			infos = append(infos, map[string]interface{}{
+				"_id":             pvMap["infoid"],
+				"area":            pvMap["area"],
+				"publishtime":     pvMap["publishtime"],
+				"s_subscopeclass": s_subscopeclass,
+				"subtype":         pvMap["subtype"],
+				"title":           pvMap["title"],
+				"toptype":         pvMap["toptype"],
+				"projectname":     pvMap["projectname"],
+				"projectcode":     pvMap["projectcode"],
+				"href":            pvMap["href"],
+				"infoformat":      pvMap["infoformat"],
+				"budget":          pvMap["budget"],
+				"bidamount":       pvMap["bidamount"],
+			})
+		}
+		follow.Infos = infos
+		for _, pv := range list {
+			pvMap, _ := pv.(map[string]interface{})
+			m.Projects.Store(util.ObjToString(pvMap["infoid"]), follow)
+		}
+		return true
+	})
 	logger.Info("加载项目结束。。。", length)
 	if length == 0 {
 		logger.Info("没有新的项目数据")

+ 1 - 4
pushfollowproject/push/config.json

@@ -65,10 +65,7 @@
 			}
 	    },
 		"newNotice":{
-			"id":"_CeF7oeZ0pr1Qp278LAE0uF2fS7_19rWjDbzmDa3sLU",
-			"keyword1":{
-				"value":"关注项目"
-			}
+			"id":"_CeF7oeZ0pr1Qp278LAE0uF2fS7_19rWjDbzmDa3sLU"
 		}
 	},
 	"appMsg":{

+ 1 - 2
pushfollowproject/push/config/config.go

@@ -52,8 +52,7 @@ type config struct {
 			Keyword3 *qrpc.TmplItem
 		}
 		NewNotice struct {
-			Id       string
-			Keyword1 *qrpc.TmplItem
+			Id string
 		}
 	} `json:"wxTplMsg"`
 	AppMsg struct {

+ 9 - 9
pushfollowproject/push/job/pushjob.go

@@ -164,13 +164,11 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, u *FollowInfo) (pushResult
 
 //
 func (p *PushJob) sendWeixin(u *FollowInfo) bool {
-	keyword2_value := ""
-	suffix := ""
-	if len(u.Follows) == 1 {
-		suffix = "有变动"
-	} else {
-		suffix = fmt.Sprintf("等%d个项目有变动", len(u.Follows))
+	suffix1, suffix2 := "您关注的项目", ""
+	if len(u.Follows) > 1 {
+		suffix2 = "等"
 	}
+	suffix2 += fmt.Sprintf("有%d条新的项目公告", len(u.Follows[0].Infos))
 	projectName := u.Follows[0].ProjectName
 	if projectName == "" {
 		projectName = u.Follows[0].ProjectCode
@@ -178,11 +176,13 @@ func (p *PushJob) sendWeixin(u *FollowInfo) bool {
 	if projectName == "" {
 		projectName = u.Follows[0].Title
 	}
-	keyword2_value = util.ShortenTxt(20, suffix, projectName) + suffix
+	keyword1_value := suffix1 + util.ShortenTxt(20, suffix1+suffix2, projectName) + suffix2
+	firstSubtype, _ := u.Follows[0].Infos[0]["subtype"].(string)
+	suffix3 := fmt.Sprintf("发布了%s公告", firstSubtype)
+	keyword2_value := util.ShortenTxt(20, suffix3, projectName) + suffix3
 	tmplData := map[string]*qrpc.TmplItem{
 		"keyword1": &qrpc.TmplItem{
-			Value: Config.WxTplMsg.NewNotice.Keyword1.Value,
-			Color: Config.WxTplMsg.NewNotice.Keyword1.Color,
+			Value: keyword1_value,
 		},
 		"keyword2": &qrpc.TmplItem{
 			Value: keyword2_value,

+ 0 - 3
pushownermonitor/push/config.json

@@ -52,9 +52,6 @@
 	"pushBatch":10,
 	"wxTplMsg":{
 		"id":"_CeF7oeZ0pr1Qp278LAE0uF2fS7_19rWjDbzmDa3sLU",
-		"keyword1":{
-			"value":"业主监控"
-		},
 		"oneUrl":"/big/wx/page/client_portrayal?entName=%s&anchorPoint=biddingDynamics",
 		"nicheOneUrl":"/jyapp/big/page/client_portrayal?entName=%s&anchorPoint=biddingDynamics",
 		"listUrl":"/big/wx/page/client_list"

+ 0 - 2
pushownermonitor/push/config/config.go

@@ -5,7 +5,6 @@ import (
 
 	util "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mail"
-	qrpc "app.yhyue.com/moapp/jybase/rpc"
 )
 
 type config struct {
@@ -45,7 +44,6 @@ type config struct {
 	FastigiumTime           string      `json:"fastigiumTime"`
 	WxTplMsg                struct {
 		Id          string
-		Keyword1    *qrpc.TmplItem
 		OneUrl      string
 		NicheOneUrl string
 		ListUrl     string

+ 8 - 7
pushownermonitor/push/job/pushjob.go

@@ -171,24 +171,25 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, u *ownermonitor.OwnerMonit
 
 //微信远程调用,实现模板发送消息
 func (p *PushJob) sendWeixin(u *ownermonitor.OwnerMonitorInfo) bool {
-	keyword2_value := ""
 	url := ""
-	suffix := ""
+	suffix1, suffix2 := "您监控的业主", ""
 	if len(u.OwnerMonitors) == 1 {
-		suffix = "有变动"
+		suffix2 = "有招标动态"
 		url = Se.EncodeString(u.Id+util.If(IsObjectIdHex(u.Id), ",_id,", ",positionId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(fmt.Sprintf(Config.WxTplMsg.OneUrl, u.OwnerMonitors[0].EntName))
 		if u.MemberStatus <= 0 && u.NicheStatus > 0 {
 			url = Se.EncodeString(u.Id+util.If(IsObjectIdHex(u.Id), ",_id,", ",positionId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(fmt.Sprintf(Config.WxTplMsg.NicheOneUrl, u.OwnerMonitors[0].EntName))
 		}
 	} else {
-		suffix = fmt.Sprintf("等%d个企业有变动", len(u.OwnerMonitors))
+		suffix2 = fmt.Sprintf("等%d个业主有招标动态", len(u.OwnerMonitors))
 		url = Se.EncodeString(u.Id+util.If(IsObjectIdHex(u.Id), ",_id,", ",positionId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(Config.WxTplMsg.ListUrl)
 	}
-	keyword2_value = util.ShortenTxt(20, suffix, u.OwnerMonitors[0].EntName) + suffix
+	keyword1_value := suffix1 + util.ShortenTxt(20, suffix1+suffix2, u.OwnerMonitors[0].EntName) + suffix2
+	firstSubtype, _ := u.OwnerMonitors[0].Infos[0]["subtype"].(string)
+	suffix3 := fmt.Sprintf("发布了%s公告", firstSubtype)
+	keyword2_value := util.ShortenTxt(20, suffix3, u.OwnerMonitors[0].EntName) + suffix3
 	tmplData := map[string]*qrpc.TmplItem{
 		"keyword1": &qrpc.TmplItem{
-			Value: Config.WxTplMsg.Keyword1.Value,
-			Color: Config.WxTplMsg.Keyword1.Color,
+			Value: keyword1_value,
 		},
 		"keyword2": &qrpc.TmplItem{
 			Value: keyword2_value,