This commit is contained in:
suyl
2021-07-13 16:13:10 +08:00
parent a920e1fe80
commit 3af00e3aad
2 changed files with 30 additions and 21 deletions

View File

@@ -247,29 +247,38 @@ func (c *ApiController) DelPrinter(dataMap map[string]interface{}) (data, errCod
//修改打印机信息
func (c *ApiController) UpdatePrinter(dataMap map[string]interface{}) (data, errCode string, err error) {
var (
printNo, name, sim, sound string
appID, volume int
ok bool
printNo string
name, sim, sound *string
volume *int
appID int
)
globals.SugarLogger.Debugf("Begin API UpdatePrinter data: [%v]", utils.Format4Output(dataMap, false))
if _, ok = dataMap[keyPrintNo].(string); !ok {
if _, ok := dataMap[keyPrintNo].(string); !ok {
return buildParamErrCodeAndErr(keyPrintNo)
} else {
if printNo = dataMap[keyPrintNo].(string); printNo == "" {
return buildParamErrCodeAndErr(keyPrintNo)
}
}
if name, ok = dataMap[keyName].(string); !ok {
name = ""
if nameStr, ok := dataMap[keyName].(string); !ok {
name = nil
} else {
name = &nameStr
}
if sim, ok = dataMap["sim"].(string); !ok {
sim = ""
if simStr, ok := dataMap["sim"].(string); !ok {
sim = nil
} else {
sim = &simStr
}
if sound, ok = dataMap["sound"].(string); !ok {
sound = ""
if soundStr, ok := dataMap["sound"].(string); !ok {
sound = nil
} else {
sound = &soundStr
}
if volume, ok = dataMap["volume"].(int); !ok {
volume = 0
if volumeInt, ok := dataMap["volume"].(int); !ok {
volume = nil
} else {
volume = &volumeInt
}
appID = utils.Str2Int(dataMap[keyAppID].(string))
if err = cms.UpdatePrinter(appID, printNo, name, sim, sound, volume); err != nil {