Ver Fonte

feat:更新

wangchuanjin há 1 ano atrás
pai
commit
f3b03be4f3

+ 1 - 1
pushentniche/go.mod

@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66
-	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844
+	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 	github.com/gogf/gf/v2 v2.6.4
 	go.mongodb.org/mongo-driver v1.11.4

+ 2 - 2
pushentniche/go.sum

@@ -2,8 +2,8 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+j
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66 h1:kCRYqzclN4dtGuGC89ID2w5lGrJgqZC8bNL8mRR+tiU=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844 h1:LoKokrHOYY7mextl6gZx42Pk6XxyPmUQzftOH0P+orE=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302 h1:CT0UatwS06M44BJZfVRkmJt+G7xqO7rF4T7OsL4XBHk=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0 h1:60fFbyRAnn5vrnsPk99pVB2aJVin6nDIkNnmekdpFso=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0/go.mod h1:rRiGzKG4F/fmkNxXQCxrkxNWc8yf1SmW8qWCKfGIQSM=
 bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.17 h1:QHjAuAYPJjml8e19ytWxgKAboo9+f6aQUH/s1UUEfrA=

+ 2 - 14
pushentniche/match/job/matchjob.go

@@ -80,7 +80,7 @@ func (m *MatchJob) Start(datas *[]map[string]interface{}) {
 		Key_user:    &detail_key,
 		Notkey_user: &detail_notkey,
 	}
-	m.LoadMySubSet(allSubSet, title_pjob, detail_pjob, nil)
+	m.LoadMySubSet(allSubSet, title_pjob, detail_pjob)
 	//
 	title_pjob.CreateDaf()
 	detail_pjob.CreateDaf()
@@ -93,7 +93,7 @@ func (m *MatchJob) Start(datas *[]map[string]interface{}) {
 }
 
 //我的订阅设置
-func (m *MatchJob) LoadMySubSet(allSubSet *PayUser, title_pjob, detail_pjob *KeyDfa, fn func(obj map[string]interface{}, tp int) bool) {
+func (m *MatchJob) LoadMySubSet(allSubSet *PayUser, title_pjob, detail_pjob *KeyDfa) {
 	defer util.Catch()
 	sess := Mgo.GetMgoConn()
 	defer Mgo.DestoryMongoConn(sess)
@@ -170,18 +170,6 @@ func (m *MatchJob) LoadMySubSet(allSubSet *PayUser, title_pjob, detail_pjob *Key
 			user.Phone = EntUsers[userId].Phone
 			user.Entniche.Mail = EntUsers[userId].Mail
 		}
-		allSubSet.AllUsers[&UserInfo{
-			Entniche: &Entniche{
-				EntId:   entId,
-				EntName: entName,
-				DeptId:  deptId,
-				UserId:  userId,
-				IsNew:   1,
-			},
-		}] = true
-		if fn != nil && !fn(temp, subSetType) {
-			continue
-		}
 		subSet, _ := temp["o_entniche"].(map[string]interface{})
 		user.GetSubSet(subSetType == 2, fmt.Sprint(userId), subSet)
 		if subSetType == 2 && len(user.SubSet.Keys) == 0 {

+ 5 - 10
pushentniche/push/job/nomsgtipjob.go

@@ -126,10 +126,6 @@ func (n *NoMsgTipJob) LoadSubSet(taskType int) map[*UserInfo]bool {
 			continue
 		}
 		subSet, _ := temp["o_entniche"].(map[string]interface{})
-		if subSet == nil || len(subSet) == 0 {
-			logger.Info("无消息提醒任务", taskType, "商机管理产品我的订阅设置为空,过滤掉", userId)
-			continue
-		}
 		user := &UserInfo{
 			Entniche: &Entniche{
 				EntId:  entId,
@@ -242,7 +238,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 		logger.Info("无消息提醒任务", taskType, "mysql判断用户该时间段推送过,过滤掉", startUnix, endUnix, user.Entniche.UserId)
 		return
 	}
-	firstTitle, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
+	firstTitle, area, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
 	if infoCount == 0 {
 		logger.Info("无消息提醒任务", taskType, "没有要推荐的信息,过滤掉", user.Entniche.UserId)
 		return
@@ -253,7 +249,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 	ut1, _, ut3 := GetUserType(user)
 	if user.PushSet.SubSet.WxPush == 1 {
 		logger.Info("无消息提醒任务", taskType, "开始微信推送", user.Entniche.UserId)
-		isPushOk := n.sendWeixin(user, ut3, firstTitle, infoCount)
+		isPushOk := n.sendWeixin(user, ut3, firstTitle, area, infoCount)
 		logger.Info("无消息提醒任务", taskType, "微信推送结束", isPushOk, user.Entniche.UserId)
 	}
 	if user.PushSet.SubSet.AppPush == 1 {
@@ -278,8 +274,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 }
 
 //推送微信
-func (n *NoMsgTipJob) sendWeixin(user *UserInfo, ut3, firstTitle string, infoCount int) bool {
-	_, wxtplmsg_area := GetWxTplMsg(user.SubSet)
+func (n *NoMsgTipJob) sendWeixin(user *UserInfo, ut3, firstTitle, area string, infoCount int) bool {
 	tmplData := map[string]*qrpc.TmplItem{
 		"thing3": &qrpc.TmplItem{
 			Value: "智能推荐",
@@ -288,13 +283,13 @@ func (n *NoMsgTipJob) sendWeixin(user *UserInfo, ut3, firstTitle string, infoCou
 			Value: firstTitle,
 		},
 		"thing7": &qrpc.TmplItem{
-			Value: wxtplmsg_area,
+			Value: area,
 		},
 		"time9": &qrpc.TmplItem{
 			Value: NowFormat(Date_Time_Layout),
 		},
 		"thing6": &qrpc.TmplItem{
-			Value: fmt.Sprint(infoCount),
+			Value: fmt.Sprintf("%d条", infoCount),
 		},
 	}
 	url := Config.WxDomain + "/front/sess/" + Se.EncodeString(fmt.Sprint(user.Entniche.UserId)+",entUserId,"+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(Config.NoMsgTip.Wx.Url)

+ 1 - 1
pushfollowent/match/matcher/match.go

@@ -31,7 +31,7 @@ func (m *FMatchUser) OnceUserBatch(batchIndex int, lastId *string, count *int64)
 	} else {
 		q += ` where s_userid>` + fmt.Sprintf("'%s'", *lastId)
 	}
-	q += ` order by s_userid asc,l_createtime desc`
+	q += ` order by s_userid asc,l_createtime desc limit ` + fmt.Sprint(Config.UserBatch)
 
 	logger.Info("开始加载第", batchIndex, "用户", q)
 	followInfos := map[string][]*Follow{}

+ 1 - 1
pushmember/go.mod

@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66
-	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844
+	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.17
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 )

+ 2 - 2
pushmember/go.sum

@@ -2,8 +2,8 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+j
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66 h1:kCRYqzclN4dtGuGC89ID2w5lGrJgqZC8bNL8mRR+tiU=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844 h1:LoKokrHOYY7mextl6gZx42Pk6XxyPmUQzftOH0P+orE=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302 h1:CT0UatwS06M44BJZfVRkmJt+G7xqO7rF4T7OsL4XBHk=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0 h1:60fFbyRAnn5vrnsPk99pVB2aJVin6nDIkNnmekdpFso=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0/go.mod h1:rRiGzKG4F/fmkNxXQCxrkxNWc8yf1SmW8qWCKfGIQSM=
 bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.17 h1:QHjAuAYPJjml8e19ytWxgKAboo9+f6aQUH/s1UUEfrA=

+ 2 - 10
pushmember/match/job/matchjob.go

@@ -49,7 +49,7 @@ func (m *MatchJob) Execute() {
 	batchIndex := 0
 	for {
 		batchIndex++
-		batchSize, payUser := m.OnceUserBatch(batchIndex, &lastUserId, nil)
+		batchSize, payUser := m.OnceUserBatch(batchIndex, &lastUserId)
 		if batchSize == 0 {
 			break
 		}
@@ -66,7 +66,7 @@ func (m *MatchJob) Execute() {
 }
 
 //加载需要推送的用户
-func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string, fn func(obj map[string]interface{}, tp int) bool) (int, *PayUser) {
+func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *PayUser) {
 	defer util.Catch()
 	q := map[string]interface{}{
 		"i_appid": 2,
@@ -108,14 +108,6 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string, fn func(obj
 				<-loadUserPool
 				loadUserWaitGroup.Done()
 			}()
-			lock.Lock()
-			payUser.AllUsers[&UserInfo{
-				Id: BsonIdToSId(temp["_id"]),
-			}] = true
-			lock.Unlock()
-			if fn != nil && !fn(temp, -3) {
-				return
-			}
 			user := NewUserInfo(temp, 3)
 			if user.SonAccountStatus == 1 {
 				logger.Info("子账号,不进行匹配,过滤掉!", user.Id)

+ 2 - 2
pushmember/push/config.json

@@ -29,7 +29,7 @@
 	"maxPushSize":2000,
 	"testIds":["5d6378301c298a5aac7b5402"],
 	"weixinRpcServer":"127.0.0.1:8083",
-	"appPushServiceRpc":"127.0.0.1:5566",
+	"appPushServiceRpc":"192.168.3.206:5566",
 	"appPushDuration":40,
 	"oncePushTime":"09:00",
 	"twicePushTime":[
@@ -81,7 +81,7 @@
 		"checkMaxPushPersion":0,
 		"selectPoolSize":5,
 		"wx":{
-			"id":"ahEQafQBYZX8cVYXko-XaU1QkJ8MHiR-O9UNv_BRMzk",
+			"id":"WHcFvQgOLdlLOdXEfBe-Oy5SwrMK2zQqEKogJvXd7m0",
 			"url":"/jy_mobile/tabbar/recommendedlist"
 		},
 		"app":{

+ 5 - 32
pushmember/push/job/nomsgtipjob.go

@@ -79,25 +79,6 @@ func (n *NoMsgTipJob) Execute(taskType, hour int) {
 				logger.Info("无消息提醒任务", taskType, "无消息提醒开关 关闭状态,过滤掉", user.Id)
 				return
 			}
-			if user.SonAccountStatus == 1 {
-				if user.MemberMainid == "" {
-					return
-				}
-				mm, mok := Mgo.FindById(Mgo_User, user.MemberMainid, UserCollFields)
-				if !mok || mm == nil {
-					return
-				}
-				mUser := NewUserInfo(*mm, 3)
-				if len(mUser.SubSet.Keys) == 0 {
-					logger.Info("无消息提醒任务", taskType, "主账号没有订阅词,过滤掉", user.Id, user.MemberMainid)
-					return
-				}
-			} else {
-				if len(user.SubSet.Keys) == 0 {
-					logger.Info("无消息提醒任务", taskType, "没有订阅词,过滤掉", user.Id)
-					return
-				}
-			}
 			if taskType == 1 || (taskType == 6 && user.PushSet.SubSet.RateMode == 1) || (taskType == 2 && user.PushSet.SubSet.RateMode == 2) || (taskType == 3 && user.PushSet.SubSet.RateMode == 3) ||
 				(taskType == 4 && user.PushSet.SubSet.RateMode == 4) || (taskType == 5 && (user.PushSet.SubSet.RateMode == 3 || user.PushSet.SubSet.RateMode == 4)) {
 				n.tip(taskType, hour, user)
@@ -161,7 +142,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 		logger.Info("无消息提醒任务", taskType, "mysql判断用户该时间段推送过,过滤掉", startUnix, endUnix, user.Id)
 		return
 	}
-	firstTitle, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
+	firstTitle, area, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
 	if infoCount == 0 {
 		logger.Info("无消息提醒任务", taskType, "没有要推荐的信息,过滤掉", user.Id)
 		return
@@ -170,7 +151,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 	logger.Info("无消息提醒任务", taskType, "开始推送", user.Id, "rateMode", user.PushSet.SubSet.RateMode, "jpushid", user.Jpushid, "opushid", user.Opushid, "appponetype", user.AppPhoneType, "email", user.PushSet.Email)
 	if user.PushSet.SubSet.WxPush == 1 {
 		logger.Info("无消息提醒任务", taskType, "开始微信推送", user.Id)
-		isPushOk := n.sendWeixin(user, firstTitle, infoCount)
+		isPushOk := n.sendWeixin(user, firstTitle, area, infoCount)
 		logger.Info("无消息提醒任务", taskType, "微信推送结束", isPushOk, user.Id)
 	}
 	if user.PushSet.SubSet.AppPush == 1 {
@@ -195,15 +176,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 }
 
 //推送微信
-func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle string, infoCount int) bool {
-	subSet := user.SubSet
-	if user.SonAccountStatus == 1 {
-		mainUser, _ := Mgo.FindById(Mgo_User, user.MemberMainid, UserCollFields)
-		if mainUser != nil && len(*mainUser) > 0 {
-			subSet = NewUserInfo(*mainUser, 3).SubSet
-		}
-	}
-	_, wxtplmsg_area := GetWxTplMsg(subSet)
+func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle, area string, infoCount int) bool {
 	tmplData := map[string]*qrpc.TmplItem{
 		"thing3": &qrpc.TmplItem{
 			Value: "智能推荐",
@@ -212,13 +185,13 @@ func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle string, infoCount in
 			Value: firstTitle,
 		},
 		"thing7": &qrpc.TmplItem{
-			Value: wxtplmsg_area,
+			Value: area,
 		},
 		"time9": &qrpc.TmplItem{
 			Value: NowFormat(Date_Time_Layout),
 		},
 		"thing6": &qrpc.TmplItem{
-			Value: fmt.Sprint(infoCount),
+			Value: fmt.Sprintf("%d条", infoCount),
 		},
 	}
 	ok := putil.SendWeixin(user, &qrpc.WxTmplMsg{

+ 1 - 1
pushsubscribe/go.mod

@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66
-	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844
+	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 )
 

+ 2 - 2
pushsubscribe/go.sum

@@ -2,8 +2,8 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+j
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66 h1:kCRYqzclN4dtGuGC89ID2w5lGrJgqZC8bNL8mRR+tiU=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844 h1:LoKokrHOYY7mextl6gZx42Pk6XxyPmUQzftOH0P+orE=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302 h1:CT0UatwS06M44BJZfVRkmJt+G7xqO7rF4T7OsL4XBHk=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0 h1:60fFbyRAnn5vrnsPk99pVB2aJVin6nDIkNnmekdpFso=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0/go.mod h1:rRiGzKG4F/fmkNxXQCxrkxNWc8yf1SmW8qWCKfGIQSM=
 bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.17 h1:QHjAuAYPJjml8e19ytWxgKAboo9+f6aQUH/s1UUEfrA=

+ 2 - 16
pushsubscribe/match/job/matchjob.go

@@ -37,7 +37,7 @@ func (m *MatchJob) Execute() {
 	batchIndex := 0
 	for {
 		batchIndex++
-		batchSize, freeUser := m.OnceUserBatch(batchIndex, &lastUserId, nil)
+		batchSize, freeUser := m.OnceUserBatch(batchIndex, &lastUserId)
 		if batchSize == 0 {
 			break
 		}
@@ -53,7 +53,7 @@ func (m *MatchJob) Execute() {
 }
 
 //加载需要推送的用户
-func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string, fn func(obj map[string]interface{}, tp int) bool) (int, *FreeUser) {
+func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *FreeUser) {
 	defer util.Catch()
 	q := map[string]interface{}{
 		"i_appid": 2,
@@ -89,21 +89,7 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string, fn func(obj
 				<-loadUserPool
 				loadUserWaitGroup.Done()
 			}()
-			aui := &UserInfo{
-				Id: BsonIdToSId(temp["_id"]),
-			}
-			lock.Lock()
-			freeUser.AllUsers[aui] = true
-			lock.Unlock()
-			if fn != nil && !fn(temp, -1) {
-				return
-			}
 			user := NewUserInfo(temp, 1)
-			if user.MemberStatus > 0 || user.VipStatus > 0 {
-				lock.Lock()
-				delete(freeUser.AllUsers, aui)
-				lock.Unlock()
-			}
 			if user.PushSet.SubSet.WxPush != 1 && user.PushSet.SubSet.AppPush != 1 && user.PushSet.SubSet.MailPush != 1 {
 				logger.Info(user.Id, "过滤掉,开关都是关闭的")
 				return

+ 6 - 13
pushsubscribe/push/job/nomsgtipjob.go

@@ -67,13 +67,7 @@ func (n *NoMsgTipJob) Execute(taskType int) {
 				pushWait.Done()
 			}()
 			user := NewUserInfo(m, 1)
-			if user.SubPushInactive == 1 {
-				logger.Info("无消息提醒任务", taskType, "不活跃用户,过滤掉", user.Id)
-				return
-			} else if len(user.SubSet.Keys) == 0 {
-				logger.Info("无消息提醒任务", taskType, "没有订阅词,过滤掉", user.Id)
-				return
-			} else if user.MemberStatus > 0 || user.VipStatus > 0 {
+			if user.MemberStatus > 0 || user.VipStatus > 0 {
 				logger.Info("无消息提醒任务", taskType, "过滤掉,超级订阅/大会员用户", user.Id)
 				return
 			} else if user.PushSet.SubSet.Nomsgtip == 0 {
@@ -112,7 +106,7 @@ func (n *NoMsgTipJob) tip(taskType int, user *UserInfo) {
 		logger.Info("无消息提醒任务", taskType, "三天内已经提醒过,过滤掉", user.Id)
 		return
 	}
-	firstTitle, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
+	firstTitle, area, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
 	if infoCount == 0 {
 		logger.Info("无消息提醒任务", taskType, "没有要推荐的信息,过滤掉", user.Id)
 		return
@@ -139,7 +133,7 @@ func (n *NoMsgTipJob) tip(taskType int, user *UserInfo) {
 	}
 	if user.PushSet.SubSet.WxPush == 1 {
 		logger.Info("无消息提醒任务", taskType, "开始微信推送", user.Id)
-		isPushOk := n.sendWeixin(user, firstTitle, infoCount)
+		isPushOk := n.sendWeixin(user, firstTitle, area, infoCount)
 		logger.Info("无消息提醒任务", taskType, "微信推送结束", isPushOk, user.Id)
 	}
 	if user.PushSet.SubSet.MailPush == 1 {
@@ -150,8 +144,7 @@ func (n *NoMsgTipJob) tip(taskType int, user *UserInfo) {
 }
 
 //推送微信
-func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle string, infoCount int) bool {
-	_, wxtplmsg_area := GetWxTplMsg(user.SubSet)
+func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle, area string, infoCount int) bool {
 	tmplData := map[string]*qrpc.TmplItem{
 		"thing3": &qrpc.TmplItem{
 			Value: "智能推荐",
@@ -160,13 +153,13 @@ func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle string, infoCount in
 			Value: firstTitle,
 		},
 		"thing7": &qrpc.TmplItem{
-			Value: wxtplmsg_area,
+			Value: area,
 		},
 		"time9": &qrpc.TmplItem{
 			Value: NowFormat(Date_Time_Layout),
 		},
 		"thing6": &qrpc.TmplItem{
-			Value: fmt.Sprint(infoCount),
+			Value: fmt.Sprintf("%d条", infoCount),
 		},
 	}
 	ok := putil.SendWeixin(user, &qrpc.WxTmplMsg{

+ 1 - 1
pushsupersub/go.mod

@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66
-	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844
+	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 )
 

+ 2 - 2
pushsupersub/go.sum

@@ -2,8 +2,8 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+j
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66 h1:kCRYqzclN4dtGuGC89ID2w5lGrJgqZC8bNL8mRR+tiU=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844 h1:LoKokrHOYY7mextl6gZx42Pk6XxyPmUQzftOH0P+orE=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302 h1:CT0UatwS06M44BJZfVRkmJt+G7xqO7rF4T7OsL4XBHk=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240319084225-7516d93a6302/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0 h1:60fFbyRAnn5vrnsPk99pVB2aJVin6nDIkNnmekdpFso=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0/go.mod h1:rRiGzKG4F/fmkNxXQCxrkxNWc8yf1SmW8qWCKfGIQSM=
 bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.17 h1:QHjAuAYPJjml8e19ytWxgKAboo9+f6aQUH/s1UUEfrA=

+ 2 - 10
pushsupersub/match/job/matchjob.go

@@ -50,7 +50,7 @@ func (m *MatchJob) Execute() {
 	batchIndex := 0
 	for {
 		batchIndex++
-		batchSize, payUser := m.OnceUserBatch(batchIndex, &lastUserId, nil)
+		batchSize, payUser := m.OnceUserBatch(batchIndex, &lastUserId)
 		if batchSize == 0 {
 			break
 		}
@@ -67,7 +67,7 @@ func (m *MatchJob) Execute() {
 }
 
 //加载需要推送的用户
-func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string, fn func(obj map[string]interface{}, tp int) bool) (int, *PayUser) {
+func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *PayUser) {
 	defer util.Catch()
 	q := map[string]interface{}{
 		"i_appid": 2,
@@ -109,14 +109,6 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string, fn func(obj
 				<-loadUserPool
 				loadUserWaitGroup.Done()
 			}()
-			lock.Lock()
-			payUser.AllUsers[&UserInfo{
-				Id: BsonIdToSId(temp["_id"]),
-			}] = true
-			lock.Unlock()
-			if fn != nil && !fn(temp, -2) {
-				return
-			}
 			user := NewUserInfo(temp, 2)
 			if user.BaseUserId == 0 {
 				logger.Info(user.Id, "过滤掉,base_user_id不存在")

+ 5 - 10
pushsupersub/push/job/nomsgtipjob.go

@@ -73,10 +73,6 @@ func (n *NoMsgTipJob) Execute(taskType, hour int) {
 				pushWait.Done()
 			}()
 			user := NewUserInfo(m, 2)
-			if len(user.SubSet.Keys) == 0 {
-				logger.Info("无消息提醒任务", taskType, "没有订阅词,过滤掉", user.Id)
-				return
-			}
 			if user.PushSet.SubSet.Nomsgtip == 0 {
 				logger.Info("无消息提醒任务", taskType, "无消息提醒开关 关闭状态,过滤掉", user.Id)
 				return
@@ -144,7 +140,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 		logger.Info("无消息提醒任务", taskType, "mysql判断超级订阅用户该时间段推送过,过滤掉", startUnix, endUnix, user.Id)
 		return
 	}
-	firstTitle, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
+	firstTitle, area, mailContent, infoCount := VarRecommend.SubRecommend(Clickhouse, Config.JianyuDomain, user.Id, Config.NoMsgTip.Mail.Content, user.PushSet.SubSet.MailPush)
 	if infoCount == 0 {
 		logger.Info("无消息提醒任务", taskType, "没有要推荐的信息,过滤掉", user.Id)
 		return
@@ -169,7 +165,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 	}
 	if user.PushSet.SubSet.WxPush == 1 {
 		logger.Info("无消息提醒任务", taskType, "开始微信推送", user.Id)
-		isPushOk := n.sendWeixin(user, firstTitle, infoCount)
+		isPushOk := n.sendWeixin(user, firstTitle, area, infoCount)
 		logger.Info("无消息提醒任务", taskType, "微信推送结束", isPushOk, user.Id)
 	}
 	if user.PushSet.SubSet.MailPush == 1 {
@@ -180,8 +176,7 @@ func (n *NoMsgTipJob) tip(taskType, hour int, user *UserInfo) {
 }
 
 //推送微信
-func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle string, infoCount int) bool {
-	_, wxtplmsg_area := GetWxTplMsg(user.SubSet)
+func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle, area string, infoCount int) bool {
 	tmplData := map[string]*qrpc.TmplItem{
 		"thing3": &qrpc.TmplItem{
 			Value: "智能推荐",
@@ -190,13 +185,13 @@ func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle string, infoCount in
 			Value: firstTitle,
 		},
 		"thing7": &qrpc.TmplItem{
-			Value: wxtplmsg_area,
+			Value: area,
 		},
 		"time9": &qrpc.TmplItem{
 			Value: NowFormat(Date_Time_Layout),
 		},
 		"thing6": &qrpc.TmplItem{
-			Value: fmt.Sprint(infoCount),
+			Value: fmt.Sprintf("%d条", infoCount),
 		},
 	}
 	ok := putil.SendWeixin(user, &qrpc.WxTmplMsg{

+ 1 - 1
subrecommend/go.mod

@@ -4,7 +4,7 @@ go 1.20
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66
-	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844
+	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240318095734-2ea90e3c94b7
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 	pushentniche v0.0.0-00010101000000-000000000000
 	pushmember v0.0.0-00010101000000-000000000000

+ 2 - 2
subrecommend/go.sum

@@ -2,8 +2,8 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+j
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66 h1:kCRYqzclN4dtGuGC89ID2w5lGrJgqZC8bNL8mRR+tiU=
 app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844 h1:LoKokrHOYY7mextl6gZx42Pk6XxyPmUQzftOH0P+orE=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240315015514-a7f159b52844/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240318095734-2ea90e3c94b7 h1:dtWjTFgCXvpYbVMv9TsvBWlkw9g0rpM4zu8fIcIkIpE=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20240318095734-2ea90e3c94b7/go.mod h1:ECcF3i8XJ9J6vZ9ZK0gyxHqMRm9UBtgQAdWD2Tw7vvA=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0 h1:60fFbyRAnn5vrnsPk99pVB2aJVin6nDIkNnmekdpFso=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.0/go.mod h1:rRiGzKG4F/fmkNxXQCxrkxNWc8yf1SmW8qWCKfGIQSM=
 bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.17 h1:QHjAuAYPJjml8e19ytWxgKAboo9+f6aQUH/s1UUEfrA=

+ 39 - 12
subrecommend/matcher/ent.go

@@ -58,8 +58,43 @@ func (e *EntMatch) Start() {
 func (e *EntMatch) ToMatch(matcher mr.Matcher) {
 	logger.Info("开始匹配订阅规则。。。")
 	entRuleMap, _ := matcher.Match(Config.MatchPoolSize, e.Datas)
-	for k, _ := range *entRuleMap {
-		k.Id = fmt.Sprint(k.Entniche.UserId)
+	newEntRuleMap := map[*UserInfo]*SortList{}
+	userIdMap := map[int]*UserInfo{}
+	for k, v := range *entRuleMap {
+		if k.Entniche.IsDis == 1 {
+			delete(*entRuleMap, k)
+			if dus := GetDisUser(k.Entniche); dus != nil {
+				for duk, _ := range dus {
+					nk := &UserInfo{
+						Id:           fmt.Sprint(duk),
+						VipStatus:    1,
+						MemberStatus: 1,
+						NicheStatus:  1,
+						Entniche: &Entniche{
+							UserId: duk,
+						},
+					}
+					if userIdMap[duk] == nil {
+						userIdMap[duk] = nk
+					}
+					if newEntRuleMap[userIdMap[duk]] == nil {
+						newEntRuleMap[userIdMap[duk]] = v
+					} else {
+						newEntRuleMap[userIdMap[duk]] = MergeSortList(newEntRuleMap[userIdMap[duk]], v, getMaxSize(userIdMap[duk]))
+					}
+				}
+			}
+		} else if k.Entniche.UserId > 0 {
+			k.Id = fmt.Sprint(k.Entniche.UserId)
+			if userIdMap[k.Entniche.UserId] == nil {
+				userIdMap[k.Entniche.UserId] = k
+			}
+			if newEntRuleMap[userIdMap[k.Entniche.UserId]] == nil {
+				newEntRuleMap[userIdMap[k.Entniche.UserId]] = v
+			} else {
+				newEntRuleMap[userIdMap[k.Entniche.UserId]] = MergeSortList(newEntRuleMap[userIdMap[k.Entniche.UserId]], v, getMaxSize(userIdMap[k.Entniche.UserId]))
+			}
+		}
 	}
 	allUsers := map[*UserInfo]bool{}
 	for k, _ := range EntUsers {
@@ -70,7 +105,7 @@ func (e *EntMatch) ToMatch(matcher mr.Matcher) {
 			},
 		}] = true
 	}
-	(&MatchOther{IsEnt: true, UserMap: entRuleMap, AllUsers: allUsers, Datas: e.Datas}).Match()
+	(&MatchOther{IsEnt: true, UserMap: &newEntRuleMap, AllUsers: allUsers, Datas: e.Datas}).Match()
 	logger.Info("订阅规则匹配结束。。。")
 	logger.Info("开始保存。。。")
 	index := 0
@@ -86,15 +121,7 @@ func (e *EntMatch) ToMatch(matcher mr.Matcher) {
 				<-savePool
 				saveWaitGroup.Done()
 			}()
-			if user.Entniche.IsDis == 1 {
-				if dus := GetDisUser(user.Entniche); dus != nil {
-					for duk, _ := range dus {
-						Save(fmt.Sprint(duk), "", infos, Config.PayMaxSize)
-					}
-				}
-			} else if user.Entniche.UserId > 0 {
-				Save(user.Id, "", infos, getMaxSize(user))
-			}
+			Save(user, infos)
 		}(k, v)
 		index++
 		if index%500 == 0 {

+ 24 - 9
subrecommend/matcher/matcher.go

@@ -40,6 +40,7 @@ type Browse struct {
 	Infoid   string //信息id
 	Classify string //分类标签,bidding表gov_classify.root,过滤掉只有一级的,取最后一级
 	Datetime string //访问时间
+	Area     string //地区
 }
 
 type MatchOther struct {
@@ -113,7 +114,7 @@ func (m *MatchOther) MatchSearchfor() {
 			}
 			lock.Lock()
 			defer lock.Unlock()
-			if cnss := m.CreateNewUserInfo(ui, keys); cnss != nil {
+			if cnss := m.CreateNewUserInfo(ui, "", keys); cnss != nil {
 				onceUserMap = append(onceUserMap, cnss)
 			}
 		}(k)
@@ -135,6 +136,7 @@ func (m *MatchOther) MatchBrowse(browseCache map[string][]*Browse) {
 			continue
 		}
 		keys := []string{}
+		area := ""
 		for _, vv := range browseCache[ui.Id] {
 			datetime, err := time.ParseInLocation(Date_Full_Layout, vv.Datetime, time.Local)
 			if err != nil {
@@ -144,9 +146,12 @@ func (m *MatchOther) MatchBrowse(browseCache map[string][]*Browse) {
 			if datetime.Before(time.Now().AddDate(0, 0, -Config.BrowseLimitDay)) {
 				continue
 			}
+			if len(keys) == 0 {
+				area = vv.Area
+			}
 			keys = append(keys, vv.Classify)
 		}
-		if cnss := m.CreateNewUserInfo(ui, keys); cnss != nil {
+		if cnss := m.CreateNewUserInfo(ui, area, keys); cnss != nil {
 			onceUserMap = append(onceUserMap, cnss)
 		}
 	}
@@ -156,7 +161,7 @@ func (m *MatchOther) MatchBrowse(browseCache map[string][]*Browse) {
 }
 
 //
-func (m *MatchOther) CreateNewUserInfo(ui *UserInfo, keys []string) *UserInfo {
+func (m *MatchOther) CreateNewUserInfo(ui *UserInfo, area string, keys []string) *UserInfo {
 	if len(keys) == 0 {
 		return nil
 	}
@@ -167,6 +172,11 @@ func (m *MatchOther) CreateNewUserInfo(ui *UserInfo, keys []string) *UserInfo {
 			Keys:         keys,
 			OriginalKeys: keys,
 		},
+		Extend: &UserInfoExtend{
+			Object: map[string]interface{}{
+				"area": area,
+			},
+		},
 	}
 	if ui.SubSet != nil {
 		userInfo.SubSet.Area = ui.SubSet.Area
@@ -242,10 +252,15 @@ func (m *MatchOther) MergeInfos(userMap *map[*UserInfo]*SortList) {
 }
 
 //
-func Save(userId, area string, infos *SortList, maxSize int) {
+func Save(ui *UserInfo, infos *SortList) {
 	// for _, vv := range *infos {
 	// 	logger.Info(userId, "-----", vv.Info["title"], vv.Keys)
 	// }
+	area := ""
+	if ui.Extend != nil && ui.Extend.Object != nil {
+		area, _ = ui.Extend.Object["area"].(string)
+	}
+	maxSize := getMaxSize(ui)
 	subCount, searchforCount, browseCount := 0, 0, 0
 	sort.Sort(infos)
 	matchLen := len(*infos)
@@ -264,18 +279,18 @@ func Save(userId, area string, infos *SortList, maxSize int) {
 			subCount++
 		}
 	}
-	logger.Info(userId, "匹配上", matchLen, "条", "保存", len(*infos), "条", "订阅", subCount, "搜索", searchforCount, "浏览", browseCount)
+	logger.Info(ui.Id, "匹配上", matchLen, "条", "保存", len(*infos), "条", "订阅", subCount, "搜索", searchforCount, "浏览", browseCount)
 	if len(ids) == 0 {
 		return
 	}
 	nowFormat := NowFormat(Date_Full_Layout)
-	datas := Clickhouse.SelectBySql(`select bitmapToArray(infoids) as infoids from jianyu.sub_recommend_list where userid=? order by update_time desc limit 1`, userId)
+	datas := Clickhouse.SelectBySql(`select bitmapToArray(infoids) as infoids from jianyu.sub_recommend_list where userid=? order by update_time desc limit 1`, ui.Id)
 	if datas == nil {
-		logger.Error(userId, "查询clickhouse失败")
+		logger.Error(ui.Id, "查询clickhouse失败")
 		return
 	}
 	if len(*datas) == 0 {
-		Clickhouse.InsertBySql(`INSERT INTO jianyu.sub_recommend_list (userid, infoids, area, update_time) values ('` + userId + `',bitmapBuild([` + toUInt64(ids) + `]),'` + area + `','` + nowFormat + `')`)
+		Clickhouse.InsertBySql(`INSERT INTO jianyu.sub_recommend_list (userid, infoids, area, update_time) values ('` + ui.Id + `',bitmapBuild([` + toUInt64(ids) + `]),'` + area + `','` + nowFormat + `')`)
 	} else {
 		infoids, _ := (*datas)[0]["infoids"].([]uint64)
 		intIds := []int{}
@@ -293,7 +308,7 @@ func Save(userId, area string, infos *SortList, maxSize int) {
 		if len(intIds) > maxSize {
 			intIds = intIds[len(intIds)-maxSize:]
 		}
-		text := `ALTER TABLE jianyu.sub_recommend_list update area='` + area + `',infoids=bitmapBuild([` + toUInt64(intIds) + `]),update_time='` + nowFormat + `' where userid='` + userId + `'`
+		text := `ALTER TABLE jianyu.sub_recommend_list update area='` + area + `',infoids=bitmapBuild([` + toUInt64(intIds) + `]),update_time='` + nowFormat + `' where userid='` + ui.Id + `'`
 		Clickhouse.UpdateOrDeleteBySql(text)
 	}
 }

+ 2 - 2
subrecommend/matcher/person.go

@@ -25,9 +25,9 @@ type PersonMatch struct {
 
 //定时任务,匹配数据,存库
 func (p *PersonMatch) Start() {
+	p.ToMatchFree()
 	p.ToMatchPay(&mrjob.MatchJob{})
 	p.ToMatchPay(&sbjob.MatchJob{})
-	p.ToMatchFree()
 }
 func (p *PersonMatch) ToMatchFree() {
 	logger.Info("开始匹配免费用户数据任务。。。")
@@ -100,7 +100,7 @@ func (p *PersonMatch) ToMatch(batchIndex int, matcher mr.Matcher, isMatch bool,
 			}
 			users = append(users, uiSons...)
 			for _, u := range users {
-				Save(u.Id, "", infos, getMaxSize(u))
+				Save(u, infos)
 			}
 		}(k, v)
 		index++