瀏覽代碼

feat:消息分类

wangchuanjin 1 年之前
父節點
當前提交
76e049f1ad
共有 2 個文件被更改,包括 24 次插入14 次删除
  1. 12 7
      rpc/internal/common/appPush.go
  2. 12 7
      rpc/internal/common/sendMsg.go

+ 12 - 7
rpc/internal/common/appPush.go

@@ -1,18 +1,19 @@
 package common
 
 import (
-	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
-	qutil "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/mongodb"
 	"errors"
 	"fmt"
-	"k8s.io/apimachinery/pkg/util/json"
 	"log"
 	"net/rpc"
 	"strings"
+
+	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"k8s.io/apimachinery/pkg/util/json"
 )
 
-func AppPushMsg(userInfo map[string]interface{}, sth, appPushUrl, title, detail string, msgType int64) error {
+func AppPushMsg(userInfo map[string]interface{}, sth, appPushUrl, title, detail string, msgType int64, category string) error {
 	if userInfo == nil {
 		return fmt.Errorf("为查询到用户信息")
 	}
@@ -44,7 +45,10 @@ func AppPushMsg(userInfo map[string]interface{}, sth, appPushUrl, title, detail
 				}
 				//推送消息
 				if appVersion > "3.0.3" {
-					if err := AppGrpcPush(dt, otherPushId, jgPushId, phoneType, appPushUrl); err != nil {
+					if sth == "o_msg_privateletter" {
+						category = "私信"
+					}
+					if err := AppGrpcPush(dt, otherPushId, jgPushId, phoneType, appPushUrl, category); err != nil {
 						return err
 					}
 					//redis.Put(CacheDb, userKey, 1, config.ConfigJson.WxTmplConfig.Limit.DuringMine*60)
@@ -56,7 +60,7 @@ func AppPushMsg(userInfo map[string]interface{}, sth, appPushUrl, title, detail
 	return nil
 }
 
-func AppGrpcPush(pushData map[string]interface{}, otherPushId, jgPushId, phoneType, appPushUrl string) error {
+func AppGrpcPush(pushData map[string]interface{}, otherPushId, jgPushId, phoneType, appPushUrl, category string) error {
 	menuName := "message"
 	if value, ok := pushData["menuName"]; ok {
 		menuName = qutil.ObjToString(value)
@@ -91,6 +95,7 @@ func AppGrpcPush(pushData map[string]interface{}, otherPushId, jgPushId, phoneTy
 		"url":         appPushUrl,                //点了消息以后,跳转的链接地址,不需要带域名
 		"menuName":    menuName,                  //在哪个webview打开链接,search:搜索 subscribe:订阅 box:百宝箱 me:我的 other:新的webview  消息中心 message
 		"redDot":      "",                        //在哪个底部菜单显示小红点,空值则不显示小红点,search:搜索 subscribe:订阅 box:百宝箱 me:我的
+		"category":    category,
 	}
 	log.Println("push推送内容====", push)
 	b, _ := json.Marshal(push)

+ 12 - 7
rpc/internal/common/sendMsg.go

@@ -1,18 +1,19 @@
 package common
 
 import (
-	"app.yhyue.com/moapp/MessageCenter/entity"
-	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
-	"app.yhyue.com/moapp/MessageCenter/util"
-	"app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/redis"
 	"fmt"
-	"github.com/zeromicro/go-zero/core/logx"
 	"log"
 	"strconv"
 	"strings"
 	"sync"
 	"time"
+
+	"app.yhyue.com/moapp/MessageCenter/entity"
+	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
+	"app.yhyue.com/moapp/MessageCenter/util"
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/redis"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 
 // 类型的顺序
@@ -486,7 +487,11 @@ func MultSave(this message.MultipleSaveMsgReq) (int64, string) {
 				//app推送
 				if this.MsgType != 10 {
 					uData := p.GetUserPushInfo()
-					if err = AppPushMsg(uData, AppPushMsgType[group_id], this.AppPushUrl, this.Title, this.Content, this.MsgType); err != nil {
+					category := ""
+					if this.SendUserId == "cbgl" {
+						category = "服务通知_工作事项"
+					}
+					if err = AppPushMsg(uData, AppPushMsgType[group_id], this.AppPushUrl, this.Title, this.Content, this.MsgType, category); err != nil {
 						logx.Error(fmt.Sprintf("SendAppMsg uId %s  Error %s", v, err.Error()))
 					}
 				}