修复用户同步请求数据问题
This commit is contained in:
parent
27858d41e7
commit
9d01e83d71
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"videoplayer/proto"
|
||||
)
|
||||
|
|
@ -159,15 +160,16 @@ func SyncDataFromMasterReq2(url string, data proto.SyncUserReq) (proto.UserSync,
|
|||
}
|
||||
defer resp.Body.Close()
|
||||
//解析数据
|
||||
var m map[string]interface{}
|
||||
var m map[string]string
|
||||
err = json.NewDecoder(resp.Body).Decode(&m)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
if m["code"].(float64) != 0 {
|
||||
code, _ := strconv.Atoi(m["code"])
|
||||
if code != 0 {
|
||||
return res, err
|
||||
}
|
||||
err = json.Unmarshal([]byte(m["data"].(string)), &res)
|
||||
err = json.Unmarshal([]byte(m["data"]), &res)
|
||||
if err != nil {
|
||||
fmt.Println("SyncDataFromMasterReq2 error decode data:", err)
|
||||
return res, err
|
||||
|
|
|
|||
Loading…
Reference in New Issue