From 07bd5cbf8a9b6798b5be6d17f5ea31c7ff738c66 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Sat, 19 Nov 2022 00:45:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sys/configure/configure.go | 6 +++--- sys/db/init_test.go | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/sys/configure/configure.go b/sys/configure/configure.go index 398ef3924..f69926830 100644 --- a/sys/configure/configure.go +++ b/sys/configure/configure.go @@ -249,12 +249,12 @@ func (this *Configure) readoffsettime() { err error ) if file, err = os.Open(this.options.TimestampFile); err != nil { - log.Errorf("[Configure Sys] readoffsettime err:%v", err) + // log.Errorf("[Configure Sys] readoffsettime err:%v", err) return } defer file.Close() if data, err = ioutil.ReadAll(file); err != nil { - log.Errorf("[Configure Sys] readoffsettime err:%v", err) + // log.Errorf("[Configure Sys] readoffsettime err:%v", err) return } offtimeStr = codec.BytesToString(data) @@ -268,7 +268,7 @@ func (this *Configure) writeoffsettime(offset time.Duration) { err error ) if file, err = os.OpenFile(this.options.TimestampFile, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666); err != nil { - log.Errorf("[Configure Sys] writeoffsettime err:%v", err) + // log.Errorf("[Configure Sys] writeoffsettime err:%v", err) return } defer file.Close() diff --git a/sys/db/init_test.go b/sys/db/init_test.go index e23c7907e..c43162d68 100644 --- a/sys/db/init_test.go +++ b/sys/db/init_test.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/mgo" + "go_dreamfactory/lego/sys/redis" "go_dreamfactory/pb" "math/rand" "sync" @@ -14,6 +15,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" ) @@ -81,3 +83,45 @@ func Test_2D(t *testing.T) { } } } + +//测试api_getlist +func Test_Json_RTask(t *testing.T) { + if sys, err := redis.NewSys( + redis.SetRedisType(redis.Redis_Single), + redis.SetRedis_Single_Addr("10.0.0.9:10011"), + redis.SetRedis_Single_Password("li13451234"), + redis.SetRedis_Single_DB(3), + ); err != nil { + fmt.Printf("err:%v", err) + return + } else { + // ret, err := json.MarshalMap(&pb.DBRtaskRecord{ + // Id: "ASDASD", + // Uid: "ASDASDASD", + // Vals: map[int32]*pb.RtaskData{ + // 1: {Data: map[int32]int32{1: 2}, Rtype: 2, Timestamp: 12312}, + // }, + // }) + err = sys.HMSet("test001", &pb.DBRtaskRecord{ + Id: "ASDASD", + Uid: "ASDASDASD", + Vals: map[int32]*pb.RtaskData{ + 1: {Data: map[int32]int32{1: 2}, Rtype: 2, Timestamp: 12312}, + }, + }) + fmt.Printf("err:%v", err) + } + + // sys. + // fmt.Printf("ret:%v err:%v", ret, err) + // ret, err = json.MarshalMap(&TestData{ + // Name: "asdasd", + // Age: 10, + // List: []string{"12asd3", "45sdaa6", "asdasd"}, + // Map: map[string]interface{}{ + // "asd": 586, + // "asdasd": "asd1231", + // }, + // }) + // fmt.Printf("ret:%v err:%v", ret, err) +}