zhangmeng
2024-01-19 bb8b8ac4ce9d4a5566f271cb5fdc05e77ab331c6
replace json lib
3个文件已修改
12 ■■■■ 已修改文件
hbusc.go 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
micronode.go 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
param.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hbusc.go
@@ -7,7 +7,7 @@
    // "encoding/json"
    "errors"
    "fmt"
    json "github.com/json-iterator/go"
    jsoniter "github.com/json-iterator/go"
    "os"
    "sync"
    "time"
@@ -263,6 +263,7 @@
    dest := bhome_msg.BHAddress{}
    if bhsgo.Request(&dest, req, &pid, &mrt, milliSecs) {
        var reply Reply
        var json = jsoniter.ConfigCompatibleWithStandardLibrary
        if err := json.Unmarshal(mrt.Data, &reply); err != nil {
            h.printLog("bhsgo.Request ret true, but unmarshal err:", err, " mrt.Data:", string(mrt.Data))
            return nil, err
@@ -295,6 +296,7 @@
}
func (h *BHBus) Reply(src unsafe.Pointer, i *Reply) error {
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    data, err := json.Marshal(i)
    if err != nil {
        return err
micronode.go
@@ -3,9 +3,9 @@
import (
    "basic.com/valib/c_bhomebus.git/proto/source/bhome_msg"
    "context"
    "encoding/json"
    "errors"
    "fmt"
    jsoniter "github.com/json-iterator/go"
    "os"
    "sync"
    "time"
@@ -111,6 +111,7 @@
    ms.printLog("1:", time.Since(t))
    t = time.Now()
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    rb, _ := json.Marshal(request)
    msgR := &bhome_msg.MsgRequestTopic{
        Topic: []byte(request.Path),
@@ -121,6 +122,7 @@
}
func (ms *MicroNode) RequestTopic(serverId string, request Request, milliSecs int) (*Reply, error) {
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    rb, _ := json.Marshal(request)
    msgR := &bhome_msg.MsgRequestTopic{
        Topic: []byte(request.Path),
@@ -161,6 +163,7 @@
    if ms.handlers == nil {
        return
    }
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    var reqBody Request
    var ri *Reply
param.go
@@ -1,8 +1,8 @@
package bhomeclient
import (
    "encoding/json"
    "errors"
    jsoniter "github.com/json-iterator/go"
)
type Request struct {
@@ -54,6 +54,7 @@
}
func (r *Request) BindJSON(v interface{}) error {
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    return json.Unmarshal(r.Body, &v)
}