1
This commit is contained in:
@@ -222,12 +222,6 @@ func (t *TcpClient) doPrint(key string) (err error) {
|
||||
case printerStatusOnline:
|
||||
if c = t.getPrintConn(printMsg.PrintNo); c != nil {
|
||||
data, err = buildMsg(printMsg)
|
||||
encryption := ""
|
||||
for _, v := range data {
|
||||
encryption += fmt.Sprintf("%d", v)
|
||||
}
|
||||
printMsg.ContentEncryption = encryption
|
||||
dao.UpdateEntity(db, printMsg, "ContentEncryption")
|
||||
}
|
||||
case printerStatusOffline:
|
||||
err = fmt.Errorf("打印机离线!")
|
||||
@@ -246,6 +240,13 @@ func (t *TcpClient) doPrint(key string) (err error) {
|
||||
close(t.TimeoutMap[key])
|
||||
} else {
|
||||
if c != nil {
|
||||
encryption := ""
|
||||
for _, v := range data {
|
||||
encryption += fmt.Sprintf("%d", v)
|
||||
}
|
||||
printMsg.ContentEncryption = encryption
|
||||
|
||||
dao.UpdateEntity(db, printMsg, "ContentEncryption")
|
||||
if _, err = c.Write(data); err != nil {
|
||||
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
|
||||
//t.delConn(printMsg.PrintNo)
|
||||
|
||||
@@ -52,9 +52,9 @@ func Init() {
|
||||
orm.RegisterModel(&model.WithdrawalRecord{}) // 提现申请
|
||||
} else {
|
||||
orm.RegisterDataBase("default", "mysql", "root:WebServer@1@tcp(127.0.0.1:3306)/api?charset=utf8mb4&loc=Local&parseTime=true")
|
||||
//打印机
|
||||
orm.RegisterModel(&model.PrintMsg{})
|
||||
orm.RegisterModel(&model.Printer{})
|
||||
// 打印机,迁移至api做
|
||||
//orm.RegisterModel(&model.PrintMsg{})
|
||||
//orm.RegisterModel(&model.Printer{})
|
||||
}
|
||||
// create table
|
||||
orm.RunSyncdb("default", false, true)
|
||||
|
||||
Reference in New Issue
Block a user