This commit is contained in:
shoopea 2020-01-02 18:12:14 +08:00
parent bbaa434cb7
commit 69e9f770df

21
obj.go
View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"log" "log"
@ -65,18 +66,18 @@ func loadObjType() error {
cacheObjType = make(map[string]int64) cacheObjType = make(map[string]int64)
for _, v := range obj { for _, v := range obj {
id := codeObjTypeId(v.IntlId) id, err := codeObjTypeId(v.IntlId)
if id > 0 { if err == nil {
cacheObjType[v.IntlId] = id cacheObjType[v.IntlId] = id
} else { } else {
err = insertObjType(v.IntlId, v.Name) err = insertObjType(v.IntlId, v.Name)
logOnError(err, "loadObjType : insertObjType") logOnError(err, "loadObjType : insertObjType")
if err == nil { if err == nil {
id = codeObjTypeId(v.IntlId) id, err = codeObjTypeId(v.IntlId)
if id > 0 { if err == nil {
cacheObjType[v.IntlId] = id cacheObjType[v.IntlId] = id
} else { } else {
// issue inserting logOnError(err, "loadObjType : codeObjTypeId")
} }
} }
} }
@ -103,18 +104,18 @@ func loadObjSubType() error {
cacheObjSubType = make(map[string]int64) cacheObjSubType = make(map[string]int64)
for _, v := range obj { for _, v := range obj {
id := codeObjSubTypeId(v.IntlId) id, err := codeObjSubTypeId(v.IntlId)
if id > 0 { if err == nil {
cacheObjSubType[v.IntlId] = id cacheObjSubType[v.IntlId] = id
} else { } else {
err = insertObjSubType(v.IntlId, v.Name, v.ObjType) err = insertObjSubType(v.IntlId, v.Name, v.ObjType)
logOnError(err, "loadObjSubType : insertObjSubType") logOnError(err, "loadObjSubType : insertObjSubType")
if err == nil { if err == nil {
id = codeObjSubTypeId(v.IntlId) id, err = codeObjSubTypeId(v.IntlId)
if id > 0 { if err == nil {
cacheObjSubType[v.IntlId] = id cacheObjSubType[v.IntlId] = id
} else { } else {
// issue inserting logOnError(err, "loadObjSubType : codeObjSubTypeId")
} }
} }
} }