From b572c36868f5bdfd4f7d901923342ab2265054b8 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Wed, 21 Jul 2021 17:44:52 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 324f6fe87..fd9892aca 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -264,7 +264,7 @@ func printFail() (err error) { c net.Conn ) if printMsg != nil { - if err = checkPrintMsg(printMsg); err == nil { + if err = checkPrintMsg(db, printMsg); err == nil { tcpClient.s.RLock() if tcpClient.Clients[printMsg.PrintNo] != nil { if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline { @@ -355,7 +355,7 @@ func HandleTcpMessages() { c net.Conn ) if printMsg != nil { - if err = checkPrintMsg(printMsg); err == nil { + if err = checkPrintMsg(db, printMsg); err == nil { tcpClient.s.RLock() if tcpClient.Clients[printMsg.PrintNo] != nil { if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline { @@ -556,7 +556,7 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { return result } -func checkPrintMsg(printMsg *model.PrintMsg) (err error) { +func checkPrintMsg(db *dao.DaoDB, printMsg *model.PrintMsg) (err error) { if printMsg.Content == "" { return fmt.Errorf("此打印信息内容为空!printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo) } @@ -566,6 +566,13 @@ func checkPrintMsg(printMsg *model.PrintMsg) (err error) { if printMsg.OrderNo == 0 { return fmt.Errorf("此打印信息订单序号为空!printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo) } + if printer, err := dao.GetPrinter(db, printMsg.PrintNo); err == nil { + if printer != nil { + if printer.FlowFlag == 1 { + return fmt.Errorf("此打印机当月流量已用完,请及时充值!printNo:[%v]", printMsg.PrintNo) + } + } + } return err }