This commit is contained in:
suyl
2021-07-13 16:15:09 +08:00
parent 3af00e3aad
commit 41f36bd16c

View File

@@ -128,19 +128,19 @@ func UpdatePrinter(appID int, printNo string, name, sim, sound *string, volume *
if printers, _ := dao.GetPrinters(db, appID, printNo); len(printers) == 0 { if printers, _ := dao.GetPrinters(db, appID, printNo); len(printers) == 0 {
return fmt.Errorf("该应用下未找到该打印机print_no : %v", printNo) return fmt.Errorf("该应用下未找到该打印机print_no : %v", printNo)
} else { } else {
if printers[0].Name != *name { if name != nil && printers[0].Name != *name {
printers[0].Name = *name printers[0].Name = *name
fields = append(fields, "name") fields = append(fields, "name")
} }
if printers[0].SIM != *sim { if sim != nil && printers[0].SIM != *sim {
printers[0].SIM = *sim printers[0].SIM = *sim
fields = append(fields, "sim") fields = append(fields, "sim")
} }
if printers[0].Sound != *sound { if sound != nil && printers[0].Sound != *sound {
printers[0].Sound = *sound printers[0].Sound = *sound
fields = append(fields, "sound") fields = append(fields, "sound")
} }
if printers[0].Volume != *volume { if volume != nil && printers[0].Volume != *volume {
printers[0].Volume = *volume printers[0].Volume = *volume
fields = append(fields, "volume") fields = append(fields, "volume")
} }