瀏覽代碼

消息通知默认设置

WH01243 1 年之前
父節點
當前提交
31e7870870
共有 2 個文件被更改,包括 17 次插入31 次删除
  1. 15 1
      rpc/internal/common/appPush.go
  2. 2 30
      rpc/internal/common/sendWxTmplMsg.go

+ 15 - 1
rpc/internal/common/appPush.go

@@ -22,7 +22,21 @@ func AppPushMsg(userInfo map[string]interface{}, sth, appPushUrl, title, detail
 	userId := mongodb.BsonIdToSId(userInfo["_id"])
 	if pushSetMap := qutil.ObjToMap(userInfo["o_pushset"]); pushSetMap != nil && len(*pushSetMap) > 0 {
 		if pushKeyMap := qutil.ObjToMap((*pushSetMap)[sth]); pushKeyMap != nil && len(*pushKeyMap) > 0 {
-			if qutil.Int64All((*pushKeyMap)["i_apppush"]) == 1 {
+			i_apppush := int64(0)
+			switch sth {
+			case "o_msg_active", "o_msg_service", "o_msg_jyschool", "o_msg_privateletter", "o_msg_business", "o_msg_pending":
+				registedate := qutil.Int64All(userInfo["l_registedate"])
+				if registedate > config.ConfigJson.Registedate {
+					if (*pushKeyMap)["i_apppush"] == nil {
+						i_apppush = 1
+					} else {
+						i_apppush = qutil.Int64All((*pushKeyMap)["i_apppush"])
+					}
+				}
+			default:
+				i_apppush = qutil.Int64All((*pushKeyMap)["i_apppush"])
+			}
+			if i_apppush == 1 {
 				//用户信息
 				var otherPushId, jgPushId, phoneType, name, appVersion = "", "", "", "", ""
 				otherPushId = qutil.ObjToString(userInfo["s_opushid"])

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

@@ -231,37 +231,9 @@ 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 {
-			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
-				}
+			if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
+				return nil
 			}
-
 		}
 	}
 	return fmt.Errorf("未开启推送设置")