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