修改打印机增加sound
This commit is contained in:
@@ -114,6 +114,8 @@ func UpdatePrinter(c *gin.Context) {
|
||||
PrintNo string `json:"print_no" form:"print_no" binding:"required"` //打印机编号
|
||||
Name string `json:"name" form:"name"` //打印机备注,模糊
|
||||
SIM string `json:"sim" form:"sim"` //sim卡
|
||||
Sound string `json:"sound" form:"sound"` //声音类型
|
||||
Volume int `json:"volume" form:"volume"` //音量大小
|
||||
}{}
|
||||
)
|
||||
globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, c.Params, c.ClientIP())
|
||||
@@ -125,7 +127,7 @@ func UpdatePrinter(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if !callFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
err = services.UpdatePrinter(c, param.AppID, tokenInfo, param.PrintNo, param.Name, param.SIM)
|
||||
err = services.UpdatePrinter(c, param.AppID, tokenInfo, param.PrintNo, param.Name, param.SIM, param.Sound, param.Volume)
|
||||
return retVal, "", err
|
||||
}) {
|
||||
return
|
||||
|
||||
@@ -106,7 +106,7 @@ func DelPrinters(c *gin.Context, appID int, tokenInfo *model.TokenInfo, printNos
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdatePrinter(c *gin.Context, appID int, tokenInfo *model.TokenInfo, printNo, name, sim string) (err error) {
|
||||
func UpdatePrinter(c *gin.Context, appID int, tokenInfo *model.TokenInfo, printNo, name, sim, sound string, volume int) (err error) {
|
||||
var (
|
||||
db = globals.GetDB()
|
||||
now = time.Now()
|
||||
@@ -129,6 +129,14 @@ func UpdatePrinter(c *gin.Context, appID int, tokenInfo *model.TokenInfo, printN
|
||||
printer.SIM = sim
|
||||
fields = append(fields, "sim")
|
||||
}
|
||||
if sound != printer.Sound {
|
||||
printer.Sound = sound
|
||||
fields = append(fields, "sound")
|
||||
}
|
||||
if volume != printer.Volume {
|
||||
printer.Volume = volume
|
||||
fields = append(fields, "volume")
|
||||
}
|
||||
printer.DeletedAt = &now
|
||||
printer.LastOperator = tokenInfo.User.Name
|
||||
fields = append(fields, model.FieldLastOperator, model.FieldDeletedAt)
|
||||
|
||||
Reference in New Issue
Block a user