Bladeren bron

消息通知默认设置

WH01243 1 jaar geleden
bovenliggende
commit
3150fa32bb
3 gewijzigde bestanden met toevoegingen van 21 en 4 verwijderingen
  1. 2 1
      rpc/etc/message.yaml
  2. 18 3
      rpc/internal/common/sendWxTmplMsg.go
  3. 1 0
      rpc/internal/config/config.go

+ 2 - 1
rpc/etc/message.yaml

@@ -66,4 +66,5 @@ WxTmplConfig:
 Tidb: "root:=PDT49#80Z!RVv52_z@tcp(192.168.3.217:4000)/messageCenter?charset=utf8mb4&parseTime=true&loc=Local"
 ClassSearchList: # 需要按照messageClass 查询的groupId
   - 11  # 待办 group id
-EquityInfoMsgType: 13 #营销权益消息需要特殊处理
+EquityInfoMsgType: 13 #营销权益消息需要特殊处理
+Registedate: 1705556502

+ 18 - 3
rpc/internal/common/sendWxTmplMsg.go

@@ -231,9 +231,24 @@ func (stm *WxTmplPush) getUserOpenIdAndWxPushState() error {
 	log.Println("======", stm.Config.Switch)
 	if pushSetMap := common.ObjToMap(uData["o_pushset"]); pushSetMap != nil && len(*pushSetMap) > 0 {
 		if pushKeyMap := common.ObjToMap((*pushSetMap)[stm.Config.Switch]); pushKeyMap != nil && len(*pushKeyMap) > 0 {
-			if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
-				return nil
+			switch stm.Config.Switch {
+			case "o_msg_active", "o_msg_service", "o_msg_jyschool", "o_msg_privateletter", "o_msg_business", "o_msg_pending":
+				registedate := common.Int64All(uData["l_registedate"])
+				if (*pushKeyMap)["i_wxpush"] != nil {
+					if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
+						return nil
+					}
+				} else {
+					if registedate > config.ConfigJson.Registedate {
+						return nil
+					}
+				}
+			default:
+				if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
+					return nil
+				}
 			}
+
 		}
 	}
 	return fmt.Errorf("未开启推送设置")
@@ -255,7 +270,7 @@ func (stm *WxTmplPush) GetUserPushInfo() map[string]interface{} {
 			}
 		}
 		if len(query) > 0 {
-			rData, _ := entity.MQFW.FindOneByField("user", query, fmt.Sprintf(`{"s_m_openid":1,"s_opushid": 1, "s_jpushid": 1, "s_appponetype": 1, "s_appversion": 1,"o_pushset.%s":1}`, stm.Config.Switch))
+			rData, _ := entity.MQFW.FindOneByField("user", query, fmt.Sprintf(`{"l_registedate":1,"s_m_openid":1,"s_opushid": 1, "s_jpushid": 1, "s_appponetype": 1, "s_appversion": 1,"o_pushset.%s":1}`, stm.Config.Switch))
 			if rData != nil && len(*rData) > 0 {
 				return *rData
 			}

+ 1 - 0
rpc/internal/config/config.go

@@ -26,6 +26,7 @@ type Config struct {
 	TidbEng           string  `json:"Tidb"`
 	ClassSearchList   []int64 `json:"ClassSearchList"`   // 需要按照messageclass 查询的groupId
 	EquityInfoMsgType int64   `json:"EquityInfoMsgType"` // 营销权益消息需要特殊处理的消息类型
+	Registedate       int64
 }
 
 type mysqlConfig struct {