作者 yangfu

推送增加配置,设置响铃文件 sound

@@ -48,7 +48,12 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ @@ -48,7 +48,12 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ
48 return 48 return
49 } 49 }
50 if extInfo, ok := appInfo.GetExtInfo(); ok { 50 if extInfo, ok := appInfo.GetExtInfo(); ok {
51 - requestOriginal.Ext["intent"] = extInfo.Intent 51 + if len(extInfo.Intent) > 0 {
  52 + requestOriginal.Ext["intent"] = extInfo.Intent
  53 + }
  54 + if len(extInfo.Sound) > 0 {
  55 + requestOriginal.Ext["sound"] = extInfo.Sound
  56 + }
52 } 57 }
53 if len(deviceList) == 0 { 58 if len(deviceList) == 0 {
54 err = protocol.NewSuccessWithMessage(fmt.Sprintf("接收人:%v 未查询到注册的设备信息!", request.Receivers)) 59 err = protocol.NewSuccessWithMessage(fmt.Sprintf("接收人:%v 未查询到注册的设备信息!", request.Receivers))
@@ -65,6 +65,7 @@ type AppInfo struct { @@ -65,6 +65,7 @@ type AppInfo struct {
65 65
66 type ExtInfo struct { 66 type ExtInfo struct {
67 Intent string `json:"intent"` 67 Intent string `json:"intent"`
  68 + Sound string `json:"sound,omitempty"`
68 } 69 }
69 70
70 func (t *AppInfo) GetExtInfo() (*ExtInfo, bool) { 71 func (t *AppInfo) GetExtInfo() (*ExtInfo, bool) {