- 修复处理飞鹅打印机错误消息的BUG
This commit is contained in:
@@ -158,21 +158,25 @@ func (a *API) PrinterAddList(printerList []*PrinterInfo) (ok, no map[string]stri
|
|||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
resultMap := result.(map[string]interface{})
|
resultMap := result.(map[string]interface{})
|
||||||
return interface2PrinterResultList4Add(resultMap["ok"]), interface2PrinterResultList4Add(resultMap["no"]), nil
|
return interface2PrinterResultList4Add(resultMap["ok"], true), interface2PrinterResultList4Add(resultMap["no"], false), nil
|
||||||
}
|
}
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func interface2PrinterResultList4Add(value interface{}) (printerResultMap map[string]string) {
|
func interface2PrinterResultList4Add(value interface{}, isOk bool) (printerResultMap map[string]string) {
|
||||||
printerResultMap = make(map[string]string)
|
printerResultMap = make(map[string]string)
|
||||||
for _, v := range value.([]interface{}) {
|
for _, v := range value.([]interface{}) {
|
||||||
strList := strings.Split(v.(string), "#")
|
strList := strings.Split(v.(string), "#")
|
||||||
if len(strList) == 4 {
|
if len(strList) == 4 {
|
||||||
strList2 := strings.Split(strList[3], " ")
|
if isOk {
|
||||||
if len(strList2) == 1 {
|
strList2 := strings.Split(strList[3], " ")
|
||||||
strList2 = append(strList2, "")
|
if len(strList2) == 1 {
|
||||||
|
strList2 = append(strList2, "")
|
||||||
|
}
|
||||||
|
printerResultMap[strList[0]] = strList2[1]
|
||||||
|
} else {
|
||||||
|
printerResultMap[strList[0]] = strList[3]
|
||||||
}
|
}
|
||||||
printerResultMap[strList[0]] = strList2[1]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return printerResultMap
|
return printerResultMap
|
||||||
|
|||||||
Reference in New Issue
Block a user