sound
This commit is contained in:
@@ -71,7 +71,7 @@ func DelPrinter(appID int, printNos []string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdatePrinter(appID int, printNo, name, sim string) (err error) {
|
||||
func UpdatePrinter(appID int, printNo, name, sim, sound string, volume int) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
fields []string
|
||||
@@ -88,6 +88,14 @@ func UpdatePrinter(appID int, printNo, name, sim string) (err error) {
|
||||
printers[0].SIM = sim
|
||||
fields = append(fields, "sim")
|
||||
}
|
||||
if printers[0].Sound != sound {
|
||||
printers[0].Sound = sound
|
||||
fields = append(fields, "sound")
|
||||
}
|
||||
if printers[0].Volume != volume {
|
||||
printers[0].Volume = volume
|
||||
fields = append(fields, "volume")
|
||||
}
|
||||
if _, err = dao.UpdateEntity(db, printers[0], fields...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -246,8 +246,8 @@ 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 string
|
||||
appID int
|
||||
printNo, name, sim, sound string
|
||||
appID, volume int
|
||||
)
|
||||
globals.SugarLogger.Debugf("Begin API UpdatePrinter data: [%v]", utils.Format4Output(dataMap, false))
|
||||
if _, ok := dataMap[keyPrintNo].(string); !ok {
|
||||
@@ -259,8 +259,10 @@ func (c *ApiController) UpdatePrinter(dataMap map[string]interface{}) (data, err
|
||||
}
|
||||
name = dataMap[keyName].(string)
|
||||
sim = dataMap["sim"].(string)
|
||||
sound = dataMap["sound"].(string)
|
||||
volume = dataMap["volume"].(int)
|
||||
appID = utils.Str2Int(dataMap[keyAppID].(string))
|
||||
if err = cms.UpdatePrinter(appID, printNo, name, sim); err != nil {
|
||||
if err = cms.UpdatePrinter(appID, printNo, name, sim, sound, volume); err != nil {
|
||||
return "", model.ErrCodeGeneralFailed, err
|
||||
}
|
||||
return "", errCode, err
|
||||
|
||||
Reference in New Issue
Block a user