This commit is contained in:
suyl
2021-07-13 16:02:08 +08:00
parent 7a1fb943de
commit a920e1fe80

View File

@@ -150,7 +150,7 @@ func (c *ApiController) CallOpenAPI() {
err = buildMethodParamErr() err = buildMethodParamErr()
goto end goto end
} }
globals.SugarLogger.Debugf("Begin API CallOpenAPI Method: %s, accessUUID:%s, sign:%s\n", method, accessID, sign) globals.SugarLogger.Debugf("Begin API CallOpenAPI Method: %s, accessUUID:%s, sign:%s, ip:%s\n", method, accessID, sign, getRealRemoteIP(c.Ctx.Request))
if err == nil { if err == nil {
result = routerMap[method].Call(parms) result = routerMap[method].Call(parms)
if result[2].Interface() != nil { if result[2].Interface() != nil {
@@ -249,20 +249,28 @@ func (c *ApiController) UpdatePrinter(dataMap map[string]interface{}) (data, err
var ( var (
printNo, name, sim, sound string printNo, name, sim, sound string
appID, volume int appID, volume int
ok bool
) )
globals.SugarLogger.Debugf("Begin API UpdatePrinter data: [%v], ip: %v", utils.Format4Output(dataMap, false)) globals.SugarLogger.Debugf("Begin API UpdatePrinter data: [%v]", utils.Format4Output(dataMap, false))
//, getRealRemoteIP(c.Ctx.Request) if _, ok = dataMap[keyPrintNo].(string); !ok {
if _, ok := dataMap[keyPrintNo].(string); !ok {
return buildParamErrCodeAndErr(keyPrintNo) return buildParamErrCodeAndErr(keyPrintNo)
} else { } else {
if printNo = dataMap[keyPrintNo].(string); printNo == "" { if printNo = dataMap[keyPrintNo].(string); printNo == "" {
return buildParamErrCodeAndErr(keyPrintNo) return buildParamErrCodeAndErr(keyPrintNo)
} }
} }
name = dataMap[keyName].(string) if name, ok = dataMap[keyName].(string); !ok {
sim = dataMap["sim"].(string) name = ""
sound = dataMap["sound"].(string) }
volume = dataMap["volume"].(int) if sim, ok = dataMap["sim"].(string); !ok {
sim = ""
}
if sound, ok = dataMap["sound"].(string); !ok {
sound = ""
}
if volume, ok = dataMap["volume"].(int); !ok {
volume = 0
}
appID = utils.Str2Int(dataMap[keyAppID].(string)) appID = utils.Str2Int(dataMap[keyAppID].(string))
if err = cms.UpdatePrinter(appID, printNo, name, sim, sound, volume); err != nil { if err = cms.UpdatePrinter(appID, printNo, name, sim, sound, volume); err != nil {
globals.SugarLogger.Debugf("End API UpdatePrinter err: %v", err) globals.SugarLogger.Debugf("End API UpdatePrinter err: %v", err)