Compare commits
10 Commits
2b9135903b
...
f74945fab9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f74945fab9 | ||
|
|
88f6e70fc8 | ||
|
|
200cefcfb3 | ||
|
|
d5bea30024 | ||
|
|
a9e521eaf2 | ||
|
|
2055c4bb3b | ||
|
|
e0b26ea5b8 | ||
|
|
1f779012a2 | ||
|
|
2df383a788 | ||
|
|
1f40c96cfe |
@@ -62,10 +62,10 @@ func handleConn(c net.Conn) error {
|
|||||||
return errors.New("conn is nil")
|
return errors.New("conn is nil")
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
|
buffer, n, err := ConnRead(c)
|
||||||
printRemoteAddr := c.RemoteAddr().String()
|
printRemoteAddr := c.RemoteAddr().String()
|
||||||
printRemoteAddr = strings.Split(printRemoteAddr, ":")[0]
|
printRemoteAddr = strings.Split(printRemoteAddr, ":")[0]
|
||||||
printNoByIP, _ := PrintAddrAndIp.GetPrintAddrAndIp(printRemoteAddr)
|
printNoByIP, _ := PrintAddrAndIp.GetPrintAddrAndIp(printRemoteAddr)
|
||||||
buffer, n, err := ConnRead(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
fmt.Println("connection close")
|
fmt.Println("connection close")
|
||||||
@@ -78,6 +78,32 @@ func handleConn(c net.Conn) error {
|
|||||||
PrintObject.DelPrintObj(printNo)
|
PrintObject.DelPrintObj(printNo)
|
||||||
PrintIpAndAddr.DelPrintIpAndAddr(printRemoteAddr)
|
PrintIpAndAddr.DelPrintIpAndAddr(printRemoteAddr)
|
||||||
dao.ExecuteSQL(dao.GetDB(), `UPDATE printer SET status = -1,is_online = -1 WHERE print_no = ? `, []interface{}{printNo}...)
|
dao.ExecuteSQL(dao.GetDB(), `UPDATE printer SET status = -1,is_online = -1 WHERE print_no = ? `, []interface{}{printNo}...)
|
||||||
|
} else {
|
||||||
|
printStatusOff := make(map[string]int, 0)
|
||||||
|
for ip, pn := range PrintAddrAndIp.PrintObject {
|
||||||
|
if ip == printRemoteAddr {
|
||||||
|
PrintAddrAndIp.DelPrintAddrAndIp(printRemoteAddr)
|
||||||
|
} else if pn != "" {
|
||||||
|
printStatusOff[pn] = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for pn, ip := range PrintIpAndAddr.PrintObject {
|
||||||
|
if ip == printRemoteAddr {
|
||||||
|
PrintIpAndAddr.DelPrintIpAndAddr(pn)
|
||||||
|
} else if pn != "" {
|
||||||
|
printStatusOff[pn] = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
globals.SugarLogger.Debugf("----可能存活打印机打印机:%s", utils.Format4Output(printStatusOff, false))
|
||||||
|
for pn, _ := range PrintObject.PrintObject {
|
||||||
|
if printStatusOff[pn] != 1 {
|
||||||
|
globals.SugarLogger.Debugf("----已经不存在但是未删除打印机:%s", pn)
|
||||||
|
PrintObject.DelPrintObj(pn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,9 +368,6 @@ func getCallbackMsgInfo(data string) (orderNo int64, printNo string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func changePrinterStatus(printNo string, status int) {
|
func changePrinterStatus(printNo string, status int) {
|
||||||
if printNo == "120220915001467" {
|
|
||||||
globals.SugarLogger.Debugf("------------printStatus := %s,%d", printNo, status)
|
|
||||||
}
|
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
|||||||
mobileList = jxutils.StringMap2List(jxutils.StringList2Map(mobileList))
|
mobileList = jxutils.StringMap2List(jxutils.StringList2Map(mobileList))
|
||||||
for _, mobileNum := range mobileList {
|
for _, mobileNum := range mobileList {
|
||||||
if mobileNum != "" {
|
if mobileNum != "" {
|
||||||
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
globals.SugarLogger.Debugf("SendSMSMsg 1 mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
||||||
if true { //globals.EnableStoreWrite {
|
if true { //globals.EnableStoreWrite {
|
||||||
if response, err := api.SMSClient.Execute(globals.AliKey, globals.AliSecret, mobileNum, signName, templateCode, string(utils.MustMarshal(templateParam))); err != nil {
|
if response, err := api.SMSClient.Execute(globals.AliKey, globals.AliSecret, mobileNum, signName, templateCode, string(utils.MustMarshal(templateParam))); err != nil {
|
||||||
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
|
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-print/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -113,13 +113,13 @@ func MakePrintMsgOnTemp(param map[string]string, userId string) (string, error)
|
|||||||
for i := 0; i < len(skuList); i++ {
|
for i := 0; i < len(skuList); i++ {
|
||||||
printMsg += userTempMap["skuName"]
|
printMsg += userTempMap["skuName"]
|
||||||
printMsg += userTempMap["skuNumber"]
|
printMsg += userTempMap["skuNumber"]
|
||||||
printMsg += userTempMap["skuPrice"]
|
//printMsg += userTempMap["skuPrice"]
|
||||||
printMsg += userTempMap["skuAllPrice"]
|
//printMsg += userTempMap["skuAllPrice"]
|
||||||
printValue = append(printValue, skuList[i].SkuName, skuList[i].SkuCount, skuList[i].SalePrice, skuList[i].TotalCountPrice)
|
printValue = append(printValue, skuList[i].SkuName, skuList[i].SkuCount /*skuList[i].SalePrice, skuList[i].TotalCountPrice*/)
|
||||||
if skuList[i].Upc != "" {
|
//if skuList[i].Upc != "" {
|
||||||
printMsg += userTempMap["skuUpc"]
|
// printMsg += userTempMap["skuUpc"]
|
||||||
printValue = append(printValue, skuList[i].Upc)
|
// printValue = append(printValue, skuList[i].Upc)
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
printMsg += userTempMap["allSkuTypeCount"]
|
printMsg += userTempMap["allSkuTypeCount"]
|
||||||
@@ -138,10 +138,18 @@ func MakePrintMsgOnTemp(param map[string]string, userId string) (string, error)
|
|||||||
case "title":
|
case "title":
|
||||||
printMsg += userTempMap[v]
|
printMsg += userTempMap[v]
|
||||||
case "qrcOrder": // 老版打印机展示不要
|
case "qrcOrder": // 老版打印机展示不要
|
||||||
//printMsg += userTempMap[v]
|
//printMsg += `<b>%s #%s</b>`
|
||||||
//printValue = append(printValue, param[v])
|
//printValue = append(printValue, param["vendorName"], param["vendorOrderNo"])
|
||||||
printMsg += `<b>%s #%s</b>`
|
if param["vendorName"] == "京东到家" {
|
||||||
printValue = append(printValue, param["vendorName"], param["vendorOrderNo"])
|
printMsg += userTempMap[v]
|
||||||
|
printValue = append(printValue, param[v])
|
||||||
|
}
|
||||||
|
case "vendorName":
|
||||||
|
printMsg += userTempMap[v]
|
||||||
|
printValue = append(printValue, param[v], param["vendorOrderNo"])
|
||||||
|
case "storeName2":
|
||||||
|
printMsg += userTempMap[v]
|
||||||
|
printValue = append(printValue, param["storeName"])
|
||||||
default:
|
default:
|
||||||
printMsg += userTempMap[v]
|
printMsg += userTempMap[v]
|
||||||
printValue = append(printValue, param[v])
|
printValue = append(printValue, param[v])
|
||||||
@@ -211,7 +219,7 @@ func PrinterOrderVoice(param map[string]string, setting *model.PrintSettingObj,
|
|||||||
// 订单状态
|
// 订单状态
|
||||||
switch param[model.OrderStatusPrint] {
|
switch param[model.OrderStatusPrint] {
|
||||||
// 新订单(待接单)
|
// 新订单(待接单)
|
||||||
case utils.Int2Str(model.OrderStatusNew): // utils.Int2Str(model.OrderStatusFinishedPickup), utils.Int2Str(model.OrderStatusAccepted)
|
case utils.Int2Str(model.OrderStatusNew), utils.Int2Str(model.OrderStatusAccepted): // utils.Int2Str(model.OrderStatusFinishedPickup), utils.Int2Str(model.OrderStatusAccepted)
|
||||||
//if param[model.OrderStatusPrint] != utils.Int2Str(model.OrderStatusNew) && param[model.VendorIDPrint] == utils.Int64ToStr(model.VendorIDMTWM) {
|
//if param[model.OrderStatusPrint] != utils.Int2Str(model.OrderStatusNew) && param[model.VendorIDPrint] == utils.Int64ToStr(model.VendorIDMTWM) {
|
||||||
// return "", err
|
// return "", err
|
||||||
//}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user