Procházet zdrojové kódy

feat:消息推送参数调整

fuwencai před 2 roky
rodič
revize
5ed9bf5b4c

+ 1 - 0
src/customerService/customController.go

@@ -26,6 +26,7 @@ type customMsg struct {
 	UserArr      []map[string]interface{} `form:"userArr"`      //已选择的用户信息集合
 	UserAddWay   int                      `form:"userAddWay"`   //添加用户的方式
 	TemplateName string                   `form:"templateName"` //模板名称 - 自定义消息
+	MenuName     string                   `form:"menuname"`     // search:搜索 subscribe:订阅 box:百宝箱 me:我的 other:新的webview  消息中心 message
 }
 
 // CustomSendMsg 自定义发送消息

+ 3 - 0
src/customerService/customService.go

@@ -61,6 +61,7 @@ func CustomSendMsgService(param *customMsg, sendStatus int, loginUserName string
 				"user_add_way":        param.UserAddWay,
 				"template_name":       param.TemplateName,
 				"update_user":         loginUserName,
+				"menu_name":           param.MenuName,
 			})
 			return ok1 && ok && count > 0
 		})
@@ -118,6 +119,7 @@ func CustomSendMsgService(param *customMsg, sendStatus int, loginUserName string
 				"user_add_way":  param.UserAddWay,
 				"template_name": param.TemplateName,
 				"update_user":   loginUserName,
+				"menu_name":     param.MenuName,
 			})
 
 			var args []interface{}
@@ -234,6 +236,7 @@ func CustomSendMsgService(param *customMsg, sendStatus int, loginUserName string
 				"msgType":       msgType,
 				"link":          param.Link,
 				"appid":         util.AppId,
+				"menuName":      param.MenuName,
 			}
 			//推送消息
 			if appVersion > "3.0.3" {

+ 1 - 0
src/customerService/newsController.go

@@ -41,6 +41,7 @@ type SendMessage struct {
 	IosUrl       string `form:"iosUrl"`       //ios连接
 	WeChatUrl    string `form:"weChatUrl"`    //微信连接
 	CallPlatform string `form:"callPlatform"` //调用平台
+	MenuName     string `form:"menuname"`     // search:搜索 subscribe:订阅 box:百宝箱 me:我的 other:新的webview  消息中心 message
 }
 
 // 查看消息内容

+ 4 - 0
src/customerService/newsService.go

@@ -180,6 +180,7 @@ func SendMsg(param *public.Message, sendStatus int, loginUserName string, loginU
 			"show_buoy":           param.ShowBuoy,
 			"show_content":        param.ShowContent,
 			"Sign":                param.Sign,
+			"menu_name":           param.MenuName,
 		})
 		if !ok {
 			return 0, errors.New("发送消息出错")
@@ -229,6 +230,7 @@ func SendMsg(param *public.Message, sendStatus int, loginUserName string, loginU
 			"update_user":         loginUserName,
 			"show_buoy":           param.ShowBuoy,
 			"show_content":        param.ShowContent,
+			"menu_name":           param.MenuName,
 		})
 		msgLogId = strconv.FormatInt(msgId, 10)
 		//如果是定时发送
@@ -295,6 +297,7 @@ func pushMsg(param *SendMessage, sendStatus int) (int, error) {
 		"isdel":               1,
 		"send_userid":         param.CallPlatform, //呼叫中心
 		"sign":                3,
+		"menu_name":           param.MenuName,
 	})
 	msgLogId = strconv.FormatInt(msgId, 10)
 	//立即发送
@@ -373,6 +376,7 @@ func pushMsg(param *SendMessage, sendStatus int) (int, error) {
 				"msgType":       msgType,
 				"link":          param.Link,
 				"appid":         util.AppId,
+				"menuName":      param.MenuName,
 			}
 			//推送消息
 			if appVersion > "3.0.3" {

+ 2 - 0
src/public/message.go

@@ -28,6 +28,7 @@ type Message struct {
 	ShowBuoy      int    `form:"showBuoy"`      //是否展示为浮标
 	ShowContent   string `form:"showContent"`   //展示文案
 	Sign          int    `form:"sign"`          //0 群发消息  1自定义消息 3 呼叫中心  4 新用户
+	MenuName      string `form:"menuname"`      // search:搜索 subscribe:订阅 box:百宝箱 me:我的 other:新的webview  消息中心 message
 }
 
 // AllUserSendMsg 全部用户发送消息
@@ -129,6 +130,7 @@ func AppPushMsg(param *Message, userInfo map[string]interface{}, loginUserId int
 		"msgType":       msgType,
 		"link":          param.Link,
 		"appid":         util.AppId,
+		"menuName":      param.MenuName,
 	}
 	//推送消息
 	if appVersion > "3.0.3" {

+ 3 - 0
src/task/task2.go

@@ -78,6 +78,7 @@ func Task(msgId int, sendTime, androidUrl, iosUrl string) {
 				SendMode:    qutil.IntAll((*msg)["send_mode"]),
 				ShowBuoy:    qutil.IntAll((*msg)["show_buoy"]),
 				ShowContent: qutil.ObjToString((*msg)["show_content"]),
+				MenuName:    qutil.ObjToString((*msg)["menu_name"]),
 			}
 			// 执行全部发送定时任务
 			public.AllUserSendMsg(&message, qutil.IntAll((*msg)["send_userid"]), qutil.ObjToString((*msg)["send_name"]), strconv.Itoa(msgId))
@@ -205,6 +206,7 @@ func TaskSaveMsg(msgId int, msg *map[string]interface{}, androidUrl, iosUrl stri
 			"msgType":       msgType,
 			"link":          msgs["link"],
 			"appid":         util.AppId,
+			"menuName":      msgs["menu_name"],
 		}
 		//推送消息
 		if appVersion > "3.0.3" {
@@ -327,6 +329,7 @@ func CustomTaskSaveMsg(msgId int, msg *map[string]interface{}, androidUrl, iosUr
 				"msgType":       msgType,
 				"link":          msgs["link"],
 				"appid":         util.AppId,
+				"menuName":      msgs["menu_name"],
 			}
 			//推送消息
 			if appVersion > "3.0.3" {

+ 5 - 1
src/util/common.go

@@ -248,6 +248,10 @@ func EtcdCountAdd(userId, msgType string) {
 	}
 }
 func AppGrpcPush(pushData map[string]interface{}, otherPushId, jgPushId, phoneType, appPushUrl string) {
+	menuName := "message"
+	if value, ok := pushData["menuName"]; ok {
+		menuName = qutil.ObjToString(value)
+	}
 	var repl string
 	client, err := rpc.DialHTTP("tcp", config.SysConfigs.PushGrpcServer)
 	if err != nil {
@@ -264,7 +268,7 @@ func AppGrpcPush(pushData map[string]interface{}, otherPushId, jgPushId, phoneTy
 		"phoneType":   phoneType,                 //mongodb库user表中s_appponetype
 		"type":        "messagecenter",           //消息类型,消息中心推送的消息使用messagecenter
 		"url":         appPushUrl,                //点了消息以后,跳转的链接地址,不需要带域名
-		"menuName":    "message",                 //在哪个webview打开链接,search:搜索 subscribe:订阅 box:百宝箱 me:我的 other:新的webview  消息中心 message
+		"menuName":    menuName,                  //在哪个webview打开链接,search:搜索 subscribe:订阅 box:百宝箱 me:我的 other:新的webview  消息中心 message
 		"redDot":      "",                        //在哪个底部菜单显示小红点,空值则不显示小红点,search:搜索 subscribe:订阅 box:百宝箱 me:我的
 	}
 	b, _ := json.Marshal(push)