Prechádzať zdrojové kódy

修改推送增加展示title

wangkaiyue 6 rokov pred
rodič
commit
fea85451a7

+ 9 - 3
core/src/qfw/manage/message.go

@@ -157,6 +157,12 @@ func (m *Message) Sase() error {
 		data["i_delivery"], _ = m.GetInteger("delivery")
 		data["i_click"], _ = m.GetInteger("click")
 		data["s_sender"] = m.GetSession("loginName")
+
+		mtype := "message"
+		if util.ObjToString(m.GetSession("showTitle")) == "T" { //点击通知 使用客户端带title
+			mtype = "titleMessage"
+		}
+
 		data["l_submitdate"] = time.Now().Unix()
 		id := Save("message_app", data)
 		if len(id) > 0 {
@@ -166,7 +172,7 @@ func (m *Message) Sase() error {
 			if len([]rune(subtitle)) > 80 {
 				subtitle = string([]rune(subtitle)[:80]) + "..."
 			}
-			go sendMes(id, title, subtitle, m.GetString("url"), pic)
+			go sendMes(id, title, subtitle, m.GetString("url"), pic, mtype)
 			//			jpushid := "18171adc035c24ee76e"
 			//			openid := "ocXeA0juxw7b7A_bjXVy0NSJF5f0"
 			//			jgpush.JgpushD_Nc(subtitle, "message", []string{jpushid}, map[string]interface{}{
@@ -185,7 +191,7 @@ func (m *Message) Sase() error {
 }
 
 //
-func sendMes(id, title, subtitle, url, pic string) error {
+func sendMes(id, title, subtitle, url, pic, mtype string) error {
 	defer util.Catch()
 	if id == "" {
 		log.Println("id 是空的!")
@@ -263,7 +269,7 @@ func sendMes(id, title, subtitle, url, pic string) error {
 				"jgPushId":    jpushid,
 				"url":         url + "==" + id,
 				"userId":      _id,
-				"type":        "message",
+				"type":        mtype,
 				"content":     pic,
 				"descript":    subtitle,
 				"title":       title,

+ 12 - 3
core/src/web/templates/manage/message/sendIndex.html

@@ -55,7 +55,6 @@ font-size:14px;
 		</div>
 		<div class="sendform">
 			<form class="registerform form-horizontal" role="form" id="mgcontent" method="post">
-	        
 	        <div class="form-group">
 	        <label id="col-sm-2" class="col-sm-2 control-label" for="name">标题:</label>
 		    <div class="col-sm-6">
@@ -89,14 +88,24 @@ font-size:14px;
 					 <table id="table1"><tr id="tr1"></tr></table>
 			    </div>
 					<input type="hidden" value="" name="pic" id="imgurl"/> 
+                    
 				<div id="mm" style="position:relative;"><span style="color:#999999; display:inline-block; position:absolute; left:80px; top:5px;"> 图片尺寸78*78</span>
 				</div>
 		
 			</div>
-			<div class="col-sm-4">
+      
 			</div>
+      
+      
+			<div class="form-group">
+	      <label id="col-sm-2" class="col-sm-2 control-label" for="name">打开推送显示title:</label>
+		    <div class="col-sm-6">
+        <input  type="checkbox" id="showTitle" name="showTitle" value="T" style="margin-top: 15px;"/>  
+	      </div>
+		
 			</div>
-			
+      
+      
 	        <div class="form-group" style="margin: 60px -15px 0px;">
 	        <label class="col-sm-2 control-label" for="name"></label>
 		    <div class="col-sm-6" id="submit">