1.推送修改 :默认ios通知栏里面只有内容行,不显示标题行,后期需要标题需要 ext里面增加扩展配置
正在显示
2 个修改的文件
包含
16 行增加
和
4 行删除
@@ -3,6 +3,7 @@ package utils | @@ -3,6 +3,7 @@ package utils | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | "fmt" | 5 | "fmt" |
6 | + "strings" | ||
6 | "testing" | 7 | "testing" |
7 | ) | 8 | ) |
8 | 9 | ||
@@ -61,13 +62,21 @@ func TestMergeMap(t *testing.T) { | @@ -61,13 +62,21 @@ func TestMergeMap(t *testing.T) { | ||
61 | } | 62 | } |
62 | 63 | ||
63 | func TestIntUnmarsh(t *testing.T) { | 64 | func TestIntUnmarsh(t *testing.T) { |
64 | - jsonString := `{"id":8242051651122944}` | 65 | + jsonString := `{"id":117605700954227712}` |
65 | type param struct { | 66 | type param struct { |
66 | - Id int `json:"id"` | 67 | + Id interface{} `json:"id"` |
67 | } | 68 | } |
68 | var p param | 69 | var p param |
69 | json.Unmarshal([]byte(jsonString), &p) | 70 | json.Unmarshal([]byte(jsonString), &p) |
70 | t.Log(p) | 71 | t.Log(p) |
71 | jsonByte, _ := json.Marshal(p) | 72 | jsonByte, _ := json.Marshal(p) |
72 | t.Log(string(jsonByte)) | 73 | t.Log(string(jsonByte)) |
74 | + | ||
75 | + decoder := json.NewDecoder(strings.NewReader(jsonString)) | ||
76 | + decoder.UseNumber() | ||
77 | + var p2 param | ||
78 | + decoder.Decode(&p2) | ||
79 | + t.Log(p2) | ||
80 | + jsonByte2, _ := json.Marshal(p2) | ||
81 | + t.Log(string(jsonByte2)) | ||
73 | } | 82 | } |
1 | package v1 | 1 | package v1 |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "bytes" | ||
4 | "encoding/json" | 5 | "encoding/json" |
5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | 6 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" |
6 | - push "openapi/pkg/application/push/service" | 7 | + "openapi/pkg/application/push/service" |
7 | protocol "openapi/pkg/domain" | 8 | protocol "openapi/pkg/domain" |
8 | "openapi/pkg/port/beego/controllers" | 9 | "openapi/pkg/port/beego/controllers" |
9 | ) | 10 | ) |
@@ -20,7 +21,9 @@ func (this *PushController) PushInfo() { | @@ -20,7 +21,9 @@ func (this *PushController) PushInfo() { | ||
20 | this.Resp(msg) | 21 | this.Resp(msg) |
21 | }() | 22 | }() |
22 | var request *protocol.PushInfoRequest | 23 | var request *protocol.PushInfoRequest |
23 | - if err := json.Unmarshal(this.ByteBody, &request); err != nil { | 24 | + decoder := json.NewDecoder(bytes.NewBuffer(this.ByteBody)) |
25 | + decoder.UseNumber() | ||
26 | + if err := decoder.Decode(&request); err != nil { | ||
24 | log.Error(err) | 27 | log.Error(err) |
25 | msg = protocol.BadRequestParam(1) | 28 | msg = protocol.BadRequestParam(1) |
26 | return | 29 | return |
-
请 注册 或 登录 后发表评论