上传武器添加数据库报错问题,以及日志堆栈信息调整
This commit is contained in:
parent
ccbac50506
commit
18edbbad87
@ -102,7 +102,7 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options
|
||||
MaxBackups: 250,
|
||||
Compress: false,
|
||||
Encoder: TextEncoder,
|
||||
CallerSkip: 0,
|
||||
CallerSkip: 3,
|
||||
ReportCaller: ErrorLevel,
|
||||
IsDebug: true,
|
||||
}
|
||||
@ -128,7 +128,7 @@ func newOptionsByOption(opts ...Option) (options *Options, err error) {
|
||||
MaxBackups: 250,
|
||||
Compress: false,
|
||||
Encoder: TextEncoder,
|
||||
CallerSkip: 0,
|
||||
CallerSkip: 3,
|
||||
ReportCaller: ErrorLevel,
|
||||
IsDebug: true,
|
||||
}
|
||||
|
38
lego/utils/codec/json/json_test.go
Normal file
38
lego/utils/codec/json/json_test.go
Normal file
@ -0,0 +1,38 @@
|
||||
package json_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/utils/codec/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type TestData struct {
|
||||
Name string
|
||||
Age int
|
||||
List []string
|
||||
Map map[string]interface{}
|
||||
}
|
||||
|
||||
//测试api_getlist
|
||||
func Test_Json_Write(t *testing.T) {
|
||||
ret, err := json.MarshalMap(&TestData{
|
||||
Name: "liwei",
|
||||
Age: 10,
|
||||
List: []string{"123", "456", "789"},
|
||||
Map: map[string]interface{}{
|
||||
"aa": 123,
|
||||
"b": "123123",
|
||||
},
|
||||
})
|
||||
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)
|
||||
}
|
@ -33,7 +33,7 @@ func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
||||
err = mapstructure.Decode(settings, this)
|
||||
}
|
||||
|
||||
if this.Log = log.NewTurnlog(this.Debug, log.Clone("", 2)); this.Log == nil {
|
||||
if this.Log = log.NewTurnlog(this.Debug, log.Clone("", 3)); this.Log == nil {
|
||||
err = errors.New("log is nil")
|
||||
}
|
||||
return
|
||||
|
@ -190,7 +190,7 @@ func (this *DBModel) AddLists(uid string, data interface{}, opt ...DBOption) (er
|
||||
}
|
||||
listskeys := make(map[string]string)
|
||||
keys := vof.MapKeys()
|
||||
lists := make([]interface{}, len(keys))
|
||||
lists := make([]interface{}, 0, len(keys))
|
||||
pipe := this.Redis.RedisPipe(context.TODO())
|
||||
for _, k := range keys {
|
||||
value := vof.MapIndex(k)
|
||||
@ -199,6 +199,7 @@ func (this *DBModel) AddLists(uid string, data interface{}, opt ...DBOption) (er
|
||||
key := this.ukeylist(uid, keydata)
|
||||
pipe.HMSet(key, valuedata)
|
||||
listskeys[keydata] = key
|
||||
lists = append(lists, valuedata)
|
||||
}
|
||||
pipe.HMSetForMap(this.ukey(uid), listskeys)
|
||||
if _, err = pipe.Exec(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user