From 756b904cb22ee859333ecce10e90270af92551ff Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 9 Jul 2021 15:52:05 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 2 +- business/model/dao/dao_print.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 82cef4a9c..b87c39e7e 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -292,7 +292,7 @@ func HandleTcpMessages() { //一直读? var err error time.Sleep(time.Second / 2) - prints, _ := dao.GetPrintMsgs(db, printMsgWait, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize) + prints, _ := dao.GetPrintMsgs(db, []int{printMsgWait, printMsgAlreadySend}, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize) for _, printMsg := range prints { var ( data []byte diff --git a/business/model/dao/dao_print.go b/business/model/dao/dao_print.go index c784ced2e..58733ec22 100644 --- a/business/model/dao/dao_print.go +++ b/business/model/dao/dao_print.go @@ -25,14 +25,17 @@ func GetPrintMsg(db *DaoDB, printNo string, orderNo int64) (prints *model.PrintM return prints, err } -func GetPrintMsgs(db *DaoDB, status int, beginAt, endAt time.Time, offset, pageSize int) (prints []*model.PrintMsg, err error) { +func GetPrintMsgs(db *DaoDB, statuss []int, beginAt, endAt time.Time, offset, pageSize int) (prints []*model.PrintMsg, err error) { sql := ` SELECT * FROM print_msg WHERE 1 = 1 AND deleted_at = ? - AND status = ? ` - sqlParams := []interface{}{utils.DefaultTimeValue, status} + sqlParams := []interface{}{utils.DefaultTimeValue} + if len(statuss) > 0 { + sql += " AND status IN(" + GenQuestionMarks(len(statuss)) + ")" + sqlParams = append(sqlParams, statuss) + } if !utils.IsTimeZero(beginAt) { sql += " AND created_at > ?" sqlParams = append(sqlParams, beginAt)