{"action":"created","issue":{"url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client/issues/4","repository_url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client","labels_url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client/issues/4/comments","events_url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client/issues/4/events","html_url":"https://github.com/DeanThompson/jpush-api-go-client/issues/4","id":158659594,"number":4,"title":"建议去掉notification验证，有些情况只发送message,不发送notification","user":{"login":"weisd","id":2057561,"avatar_url":"https://avatars.githubusercontent.com/u/2057561?v=3","gravatar_id":"","url":"https://api.github.com/users/weisd","html_url":"https://github.com/weisd","followers_url":"https://api.github.com/users/weisd/followers","following_url":"https://api.github.com/users/weisd/following{/other_user}","gists_url":"https://api.github.com/users/weisd/gists{/gist_id}","starred_url":"https://api.github.com/users/weisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weisd/subscriptions","organizations_url":"https://api.github.com/users/weisd/orgs","repos_url":"https://api.github.com/users/weisd/repos","events_url":"https://api.github.com/users/weisd/events{/privacy}","received_events_url":"https://api.github.com/users/weisd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-06T11:49:24Z","updated_at":"2016-06-06T12:25:04Z","closed_at":null,"body":"```\r\nfunc NewPushObject() *PushObject {\r\n\treturn &PushObject{}\r\n}\r\n\r\nfunc (po *PushObject) Validate() error {\r\n\tif po.Message == nil {\r\n\t\treturn common.ErrContentMissing\r\n\t}\r\n\r\n\tif po.Notification != nil {\r\n\t\tif err := po.Notification.Validate(); err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\r\n\tif po.Message != nil {\r\n\t\tif err := po.Message.Validate(); err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\r\n\tif po.Options != nil {\r\n\t\tif err := po.Options.Validate(); err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\r\n\t// for _, v := range []Validator{po.Notification, po.Message, po.Options} {\r\n\t// \tif v != nil {\r\n\t// \t\tif err := v.Validate(); err != nil {\r\n\t// \t\t\treturn err\r\n\t// \t\t}\r\n\t// \t}\r\n\t// }\r\n\r\n\treturn nil\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client/issues/comments/223943955","html_url":"https://github.com/DeanThompson/jpush-api-go-client/issues/4#issuecomment-223943955","issue_url":"https://api.github.com/repos/DeanThompson/jpush-api-go-client/issues/4","id":223943955,"user":{"login":"DeanThompson","id":1628320,"avatar_url":"https://avatars.githubusercontent.com/u/1628320?v=3","gravatar_id":"","url":"https://api.github.com/users/DeanThompson","html_url":"https://github.com/DeanThompson","followers_url":"https://api.github.com/users/DeanThompson/followers","following_url":"https://api.github.com/users/DeanThompson/following{/other_user}","gists_url":"https://api.github.com/users/DeanThompson/gists{/gist_id}","starred_url":"https://api.github.com/users/DeanThompson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DeanThompson/subscriptions","organizations_url":"https://api.github.com/users/DeanThompson/orgs","repos_url":"https://api.github.com/users/DeanThompson/repos","events_url":"https://api.github.com/users/DeanThompson/events{/privacy}","received_events_url":"https://api.github.com/users/DeanThompson/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T12:25:04Z","updated_at":"2016-06-06T12:25:04Z","body":"@weisd 现在的代码允许只发送 Message，不发送 Notification 的吧。\r\n\r\n```go\r\nfunc (po *PushObject) Validate() error {\r\n\tif po.Notification == nil && po.Message == nil {\r\n\t\treturn common.ErrContentMissing\r\n\t}\r\n\r\n\tfor _, v := range []Validator{po.Notification, po.Message, po.Options} {\r\n\t\tif v != nil {\r\n\t\t\tif err := v.Validate(); err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}\r\n```\r\n\r\n其中 `if po.Notification == nil && po.Message == nil` 是判断是否两者都为 `nil`，允许其中一个为 `nil`"}}
{"actor":{"display_login":"DeanThompson"}}