From de510f42ac9b927d37ef6b11b77753422cd2e624 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 9 Aug 2022 11:29:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5dev=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=9A=84=E5=85=B1=E9=B8=A3=E9=99=84=E5=8A=A0?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/bench/main_test.go | 2 +- lego/sys/rpcx/options.go | 8 ++++---- lego/utils/codec/factory/factory_array.go | 2 +- lego/utils/codec/factory/factory_slice.go | 2 +- lego/utils/codec/factory/factory_struct.go | 2 +- modules/hero/model_hero.go | 2 +- modules/hero/model_record.go | 2 ++ 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/bench/main_test.go b/cmd/bench/main_test.go index 9b00dc0b2..2502f8d1b 100644 --- a/cmd/bench/main_test.go +++ b/cmd/bench/main_test.go @@ -76,7 +76,7 @@ func BenchmarkRedis(b *testing.B) { keys, _ := cache.Redis().HGetAllToMapString(key) // fmt.Println(keys) for _, v := range keys { - cache.Redis().Pipeline(ctx, func(pipe redis.Pipeliner) error { + cache.Redis().Pipelined(ctx, func(pipe redis.Pipeliner) error { pipe.HGetAll(ctx, v).Result() _, err := pipe.Exec(ctx) // fmt.Println(v) diff --git a/lego/sys/rpcx/options.go b/lego/sys/rpcx/options.go index 2c9df5714..0710814b4 100644 --- a/lego/sys/rpcx/options.go +++ b/lego/sys/rpcx/options.go @@ -99,11 +99,11 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options if len(options.ServiceTag) == 0 || len(options.ServiceType) == 0 || len(options.ServiceId) == 0 || len(options.ConsulServers) == 0 { return options, errors.New("[Sys.RPCX] newOptions err: 启动参数异常") } - if options.Debug && options.Log == nil { - if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.rpc", 2)); options.Log == nil { - err = errors.New("log is nil") - } + + if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.rpc", 2)); options.Log == nil { + err = errors.New("log is nil") } + return options, nil } diff --git a/lego/utils/codec/factory/factory_array.go b/lego/utils/codec/factory/factory_array.go index 19eaf8396..dd6e8419b 100644 --- a/lego/utils/codec/factory/factory_array.go +++ b/lego/utils/codec/factory/factory_array.go @@ -65,7 +65,7 @@ func (this *arrayEncoder) EncodeToSliceJson(ptr unsafe.Pointer, w codecore.IWrit err = w.Error() return } - ret[i] = BytesToString(w.Buffer()) + ret[i] = string(w.Buffer()) w.Reset() } return diff --git a/lego/utils/codec/factory/factory_slice.go b/lego/utils/codec/factory/factory_slice.go index c093efdcd..2727f9e1f 100644 --- a/lego/utils/codec/factory/factory_slice.go +++ b/lego/utils/codec/factory/factory_slice.go @@ -76,7 +76,7 @@ func (this *sliceEncoder) EncodeToSliceJson(ptr unsafe.Pointer, w codecore.IWrit err = w.Error() return } - ret[i] = BytesToString(w.Buffer()) + ret[i] = string(w.Buffer()) w.Reset() } return diff --git a/lego/utils/codec/factory/factory_struct.go b/lego/utils/codec/factory/factory_struct.go index e2999283d..a475652e3 100644 --- a/lego/utils/codec/factory/factory_struct.go +++ b/lego/utils/codec/factory/factory_struct.go @@ -282,7 +282,7 @@ func (this *structEncoder) EncodeToMapJson(ptr unsafe.Pointer, w codecore.IWrite err = w.Error() return } - ret[field.toName] = BytesToString(w.Buffer()) + ret[field.toName] = string(w.Buffer()) } return } diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 0ebea8e2b..5cd2a954a 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -375,7 +375,7 @@ func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[st // 合并附加能量属性 func (this *ModelHero) mergeEnegryProperty(uid string, hero *pb.DBHero, data map[string]int32) { - //hero.EnergyProperty = data + hero.EnergyProperty = data if err := this.ChangeList(uid, hero.Id, map[string]interface{}{ "enegryProperty": data, diff --git a/modules/hero/model_record.go b/modules/hero/model_record.go index ff9ea8b1e..4c31cf6da 100644 --- a/modules/hero/model_record.go +++ b/modules/hero/model_record.go @@ -5,6 +5,7 @@ import ( "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" + "time" ) // 记录一些扩展数据 图鉴 改名次数等 @@ -42,5 +43,6 @@ func (this *ModelRecord) ChangeUserRecord(uid string, value map[string]interface if len(value) == 0 { return nil } + value["mtime"] = time.Now().Unix() //修改时间 return this.Change(uid, value) }