Ver código fonte

自定义消息发送模板修改

renjiaojiao 1 ano atrás
pai
commit
9c2bddb7ce

+ 0 - 2
src/customerService/customController.go

@@ -42,8 +42,6 @@ func CustomSendMsg(context *admin.Context) (interface{}, error) {
 	if param.SendMode == 2 {
 		sendStatus = 4
 	}
-	//拼接link
-	param.Link = param.Link + "," + param.AndroidUrl + "," + param.IosUrl + "," + param.WeChatUrl
 	status, err := CustomSendMsgService(param, sendStatus, context.User.Username, context.User.Id)
 	return map[string]interface{}{
 		"status": status,

+ 1 - 0
src/customerService/customService.go

@@ -153,6 +153,7 @@ func CustomSendMsgService(param *customMsg, sendStatus int, loginUserName string
 	}
 	log.Println("发送消息记录id*********", msgLogId)
 	//立即发送
+	param.Link, _, _, param.WeChatUrl = public.GetMsgUrlString(param.Link, param.AndroidUrl, param.IosUrl, param.WeChatUrl, msgLogId)
 	if param.SendMode == 2 {
 		projectIdMap := sync.Map{}
 		userNames := ""

+ 2 - 1
src/customerService/newsService.go

@@ -15,7 +15,7 @@ import (
 	"util"
 )
 
-var Str = "a.send_usergroup_name,a.msg_type,a.title,a.content,a.send_mode,a.send_time,a.send_status,a.update_time,a.createtime,a.link,a.isdel,a.send_name,a.send_usergroup_id,a.sign,a.user_add_way,a.template_name,a.user_add_way"
+var Str = "a.send_usergroup_name,a.msg_type,a.group_id,a.title,a.content,a.send_mode,a.send_time,a.send_status,a.update_time,a.createtime,a.link,a.isdel,a.send_name,a.send_usergroup_id,a.sign,a.user_add_way,a.template_name,a.user_add_way"
 
 type Group struct {
 	Id          int    `json:"id"`
@@ -140,6 +140,7 @@ func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int, loginUserName s
 	data := util.JysqlDB.SelectBySql(sql)
 	if data != nil && len(*data) > 0 {
 		for _, v := range *data {
+			log.Println(v["group_id"])
 			v["msg_type"] = v["group_id"]
 			list = append(list, v)
 		}

+ 5 - 2
src/public/message.go

@@ -92,7 +92,6 @@ func AllUserSendMsg(param *Message, loginUserId int, loginUserName string, msgLo
 			if userInfo == nil || len(userInfo) == 0 {
 				continue
 			}
-			//name := qutil.ObjToString(userInfo["s_name"])
 			userId := mongodb.BsonIdToSId(userInfo["_id"])
 			userNames += "" + "," // 由于部分昵称包含表情、数据库存不进去,所以消息表不保存用户昵称
 			userIds += userId + ","
@@ -150,7 +149,9 @@ func AppPushMsg(param *Message, userInfo map[string]interface{}, loginUserId int
 				appPushUrl := "/jyapp/frontPage/messageCenter/sess/index"
 				if strings.Contains(phoneType, "iPhone") {
 					if param.IosUrl != "" {
-						appPushUrl = param.IosUrl
+						if strings.HasPrefix(appPushUrl, "/") {
+							appPushUrl = appPushUrl[1:]
+						}
 					}
 				} else {
 					if param.AndroidUrl != "" {
@@ -188,6 +189,7 @@ func WxTmplPushMsg(param *Message, userInfo map[string]interface{}) {
 		log.Println("未知消息类型")
 		return
 	}
+	log.Println(param.Title, param.SendTime, param.Content, "", param.WeChatUrl, param.MsgType)
 	if err := SendWxTmplMsg(mongodb.BsonIdToSId(userInfo["_id"]), param.Title, param.SendTime, param.Content, "", param.WeChatUrl, param.MsgType); err != nil {
 		log.Println("WxTmplPushMsg error ", err.Error())
 	}
@@ -263,6 +265,7 @@ func GetMegType() {
 			}
 		}
 	}
+
 	BlackClassMap = blackClassMap
 	WxBlackPush = wxBlackPush
 	BlackNameType = nameTypeMap