Browse Source

消息通知默认设置

WH01243 1 year ago
parent
commit
319b1d2821
1 changed files with 29 additions and 2 deletions
  1. 29 2
      rpc/internal/common/sendWxTmplMsg.go

+ 29 - 2
rpc/internal/common/sendWxTmplMsg.go

@@ -231,8 +231,35 @@ 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"])
+				s_m_openid := common.InterfaceToStr(uData["s_m_openid"])
+				ShowWx := false
+				if s_m_openid != "" {
+					//微信是否关注处理
+					subscribeList := &[]map[string]interface{}{}
+					subscribeList, _ = entity.MQFW.Find("jy_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 (*pushKeyMap)["i_wxpush"] != nil {
+					if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
+						return nil
+					}
+				} else {
+					if registedate > config.ConfigJson.Registedate && ShowWx {
+						return nil
+					}
+				}
+			default:
+				if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
+					return nil
+				}
 			}
 		}
 	}