From 7634a28117e94e3031251bbffa21f843acb196cb Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 13 六月 2019 14:14:24 +0800
Subject: [PATCH] fix bugs
---
api_test.go | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/api_test.go b/api_test.go
index 3473da0..620a255 100644
--- a/api_test.go
+++ b/api_test.go
@@ -1,7 +1,8 @@
package dbapi
import (
- "analyweb/protomsg"
+ "basic.com/pubsub/protomsg.git"
+ "encoding/json"
"fmt"
"testing"
"time"
@@ -19,8 +20,11 @@
Parentid: 0,
Name: "鍝堝搱鍝�",
}
+ dataBytes, _ := json.Marshal(area)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
- flag := api.AreaAdd(area)
+ flag := api.AreaAdd(paramBody)
fmt.Println(flag)
}
@@ -31,7 +35,10 @@
Name: "鍖哄煙鏇存柊娴嬭瘯",
Parentid: 0,
}
- flag := api.AreaUpdate(area)
+ dataBytes, _ := json.Marshal(area)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
+ flag := api.AreaUpdate(paramBody)
fmt.Println(flag)
}
@@ -47,7 +54,10 @@
Name:"娴嬭瘯鍟婂晩鍟婂晩鍟婂晩鍟婂晩",
Areaid:0,
}
- result := api.CameraAdd(camera)
+ dataBytes, _ := json.Marshal(camera)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
+ result := api.CameraAdd(paramBody)
fmt.Println("add result: ",result)
}
@@ -61,8 +71,11 @@
Icon:"bbb",
Url:"baidu",
}
- result := api.Save(sdk)
- fmt.Println("add result: ",result)
+ dataBytes, _ := json.Marshal(sdk)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
+ result,data := api.Save(paramBody)
+ fmt.Println("add result: ",result,data)
}
}
@@ -79,7 +92,7 @@
func TestSdkApi_GetById(t *testing.T) {
var api SdkApi
- model := api.GetById("812b674b-2375-4589-919a-5c1c3278a97e")
+ model,_ := api.GetById("812b674b-2375-4589-919a-5c1c3278a97e")
fmt.Println(model)
}
--
Gitblit v1.8.0