File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import (
3131
3232 log "github.com/cihub/seelog"
3333 "bytes"
34+ "strings"
3435)
3536
3637// ErrorCode struct
@@ -79,7 +80,19 @@ func Return(b interface{}) string {
7980 ret .Code = 1
8081 ret .Msg = "ok"
8182
82- body , err := json .Marshal (ret )
83+ //fix json.Unmarshal bug,when param is (u)int64
84+ decoder := json .NewDecoder (strings .NewReader (string (buf )))
85+ decoder .UseNumber ()
86+ para := make (map [string ]interface {})
87+ err = decoder .Decode (& para )
88+ if err != nil {
89+ log .Error (err )
90+ panic (err )
91+ }
92+
93+ body , err := json .Marshal (para )
94+
95+ //body, err := json.Marshal(ret)
8396 if err != nil {
8497 log .Error (err )
8598 panic (err )
Original file line number Diff line number Diff line change @@ -163,20 +163,38 @@ func AccountInfo(account string) (*user_proto.AccountInfoData, error) {
163163 return nil , errors .New (string (body ))
164164 }
165165
166- resultBuf , err := json .Marshal (commonRet .Result )
166+ //fix json.Unmarshal bug,when param is (u)int64
167+ decoder := json .NewDecoder (strings .NewReader (string (body )))
168+ decoder .UseNumber ()
169+ para := make (map [string ]interface {})
170+ err = decoder .Decode (& para )
167171 if err != nil {
168172 log .Error (err )
169- return nil , err
173+ panic ( err )
170174 }
171175
176+ log .Info (para ["result" ])
177+
178+ var resultBuf []byte
172179 var accountInfo = & user_proto.AccountInfoData {}
180+ if para ["result" ] != nil {
181+ resultBuf , err = json .Marshal (para ["result" ])
182+ //resultBuf, err := json.Marshal(commonRet.Result)
183+ if err != nil {
184+ log .Error (err )
185+ return nil , err
186+ }
187+
173188 err = json .Unmarshal (resultBuf , accountInfo )
174189 if err != nil {
175190 log .Error (err )
176191 return nil , err
177192 }
178193
179194 return accountInfo , nil
195+ } else {
196+ return accountInfo , nil
197+ }
180198}
181199
182200// QueryObject get Object
You can’t perform that action at this time.
0 commit comments