This commit is contained in:
suyl
2021-07-08 18:23:13 +08:00
parent 2d0824f82a
commit b7ed047e7c
6 changed files with 30 additions and 53 deletions

View File

@@ -24,6 +24,10 @@ func AddPrinters(c *gin.Context, tokenInfo *model.TokenInfo, appID int, printInf
return fmt.Errorf("未查询到此应用app_id:%d", appID)
}
for _, v := range printInfos {
if v.PrintNo == "" {
errs = append(errs, fmt.Errorf("请输入正确的打印机编号print_no :%s 。", v.PrintNo))
continue
}
printers, _ := dao.GetPrinters(db, appID, v.PrintNo)
if len(printers) > 0 {
errs = append(errs, fmt.Errorf("此打印机已被其他应用绑定print_no :%s 。", v.PrintNo))
@@ -68,6 +72,10 @@ func DelPrinters(c *gin.Context, appID int, tokenInfo *model.TokenInfo, printNos
return fmt.Errorf("未查询到此应用app_id:%d", appID)
}
for _, v := range printNos {
if v == "" {
errs = append(errs, fmt.Errorf("请输入正确的打印机编号print_no :%s 。", v))
continue
}
printers, _ := dao.GetPrinters(db, appID, v)
if len(printers) == 0 {
errs = append(errs, fmt.Errorf("未在该应用下查到此打印机app_id: %d, print_no: %s", appID, v))