Browse Source

微信未关注处理

WH01243 2 years ago
parent
commit
cd9af81853
1 changed files with 32 additions and 15 deletions
  1. 32 15
      jyBXSubscribe/rpc/model/service/pushSet.go

+ 32 - 15
jyBXSubscribe/rpc/model/service/pushSet.go

@@ -52,9 +52,26 @@ func (this *PushSetService) Update(item, setType, pushType string, ratemode, pus
 }
 func (this *PushSetService) Find() map[string]*bxsubscribe.PushSet {
 	pushSetMap := &map[string]interface{}{}
-	if this.PositionType == 0 {
-		pushSetMap, _ = IC.Mgo.FindById(util.USER, this.UserId, `{"o_pushset":":1}`)
-	} else {
+	//
+	ShowWx := false
+	s_m_openid := ""
+	pushSetMap, _ = IC.Mgo.FindById(util.USER, this.UserId, `{"o_pushset":":1,"s_m_openid":1}`)
+	if pushSetMap != nil && len(*pushSetMap) > 0 {
+		s_m_openid = common.InterfaceToStr((*pushSetMap)["s_m_openid"])
+	}
+	if s_m_openid != "" {
+		//微信是否关注处理
+		subscribeList := &[]map[string]interface{}{}
+		subscribeList, _ = IC.Mgo.Find(util.SUBSCRIBE, map[string]interface{}{"s_m_openid": s_m_openid}, `{"l_date":-1}`, `{"s_event":1"}`, true, -1, -1)
+		if subscribeList != nil && len(*subscribeList) > 0 {
+			s_event := common.InterfaceToStr((*subscribeList)[0]["s_event"])
+			if s_event == "subscribe" {
+				ShowWx = true
+			}
+		}
+	}
+
+	if this.PositionType == 1 {
 		pushSetMap, _ = IC.Mgo.FindOne(util.ENTUSER, map[string]interface{}{"i_entid": this.EntId, "i_userid": this.EntUserId})
 	}
 	pushSet := map[string]*bxsubscribe.PushSet{}
@@ -69,37 +86,37 @@ func (this *PushSetService) Find() map[string]*bxsubscribe.PushSet {
 			Interested: common.Int64All(o_pushset["i_interested"]),
 		}
 	}
-	fool, o_subset := pushSetMontage(o_pushset["o_subset"], "o_subset", powerData)
+	fool, o_subset := pushSetMontage(o_pushset["o_subset"], "o_subset", powerData, ShowWx)
 	if fool {
 		pushSet["o_subset"] = o_subset
 	}
-	fool, o_week_report := pushSetMontage(o_pushset["o_week_report"], "o_week_report", powerData)
+	fool, o_week_report := pushSetMontage(o_pushset["o_week_report"], "o_week_report", powerData, ShowWx)
 	if fool {
 		pushSet["o_week_report"] = o_week_report
 	}
-	fool, o_month_report := pushSetMontage(o_pushset["o_month_report"], "o_month_report", powerData)
+	fool, o_month_report := pushSetMontage(o_pushset["o_month_report"], "o_month_report", powerData, ShowWx)
 	if fool {
 		pushSet["o_month_report"] = o_month_report
 	}
-	fool, o_newproject_forecast := pushSetMontage(o_pushset["o_newproject_forecast"], "o_newproject_forecast", powerData)
+	fool, o_newproject_forecast := pushSetMontage(o_pushset["o_newproject_forecast"], "o_newproject_forecast", powerData, ShowWx)
 	if fool {
 		pushSet["o_newproject_forecast"] = o_newproject_forecast
 	}
-	fool, o_entinfo := pushSetMontage(o_pushset["o_entinfo"], "o_entinfo", powerData)
+	fool, o_entinfo := pushSetMontage(o_pushset["o_entinfo"], "o_entinfo", powerData, ShowWx)
 	if fool {
 		pushSet["o_entinfo"] = o_entinfo
 	}
-	fool, o_follow_project := pushSetMontage(o_pushset["o_follow_project"], "o_follow_project", powerData)
+	fool, o_follow_project := pushSetMontage(o_pushset["o_follow_project"], "o_follow_project", powerData, ShowWx)
 	if fool {
 		pushSet["o_follow_project"] = o_follow_project
 	}
-	fool, o_follow_ent := pushSetMontage(o_pushset["o_follow_ent"], "o_follow_ent", powerData)
+	fool, o_follow_ent := pushSetMontage(o_pushset["o_follow_ent"], "o_follow_ent", powerData, ShowWx)
 	if fool {
 		pushSet["o_follow_ent"] = o_follow_ent
 	}
 	return pushSet
 }
-func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool, *bxsubscribe.PushSet) {
+func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp, ShowWx bool) (bool, *bxsubscribe.PushSet) {
 	data := common.ObjToMap(in)
 	a_times := []string{}
 	if !(data == nil || len(*data) == 0) {
@@ -114,7 +131,7 @@ func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool,
 			returnData = &bxsubscribe.PushSet{
 				ATimes:    util.TimeMap[2],
 				IApppush:  1,
-				IWxpush:   1,
+				IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
 				IMailpush: 0,
 				IRatemode: 2,
 				IsWxShow:  1,
@@ -135,7 +152,7 @@ func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool,
 			returnData = &bxsubscribe.PushSet{
 				ATimes:    a_times,
 				IApppush:  1,
-				IWxpush:   1,
+				IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
 				IMailpush: 0,
 				IRatemode: 1,
 				IsWxShow:  1,
@@ -157,7 +174,7 @@ func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool,
 				returnData = &bxsubscribe.PushSet{
 					ATimes:    a_times,
 					IApppush:  1,
-					IWxpush:   1,
+					IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
 					IMailpush: 0,
 					IRatemode: 1,
 					IsWxShow:  0,
@@ -194,7 +211,7 @@ func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool,
 				returnData = &bxsubscribe.PushSet{
 					ATimes:    a_times,
 					IApppush:  1,
-					IWxpush:   1,
+					IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
 					IMailpush: 0,
 					IRatemode: 3,
 					IsWxShow:  IsWxShow,