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")
|
||||
}
|
||||
for {
|
||||
buffer, n, err := ConnRead(c)
|
||||
printRemoteAddr := c.RemoteAddr().String()
|
||||
printRemoteAddr = strings.Split(printRemoteAddr, ":")[0]
|
||||
printNoByIP, _ := PrintAddrAndIp.GetPrintAddrAndIp(printRemoteAddr)
|
||||
buffer, n, err := ConnRead(c)
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
fmt.Println("connection close")
|
||||
@@ -78,6 +78,32 @@ func handleConn(c net.Conn) error {
|
||||
PrintObject.DelPrintObj(printNo)
|
||||
PrintIpAndAddr.DelPrintIpAndAddr(printRemoteAddr)
|
||||
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
|
||||
}
|
||||
|
||||
@@ -368,9 +368,6 @@ func getCallbackMsgInfo(data string) (orderNo int64, printNo string) {
|
||||
}
|
||||
|
||||
func changePrinterStatus(printNo string, status int) {
|
||||
if printNo == "120220915001467" {
|
||||
globals.SugarLogger.Debugf("------------printStatus := %s,%d", printNo, status)
|
||||
}
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
||||
mobileList = jxutils.StringMap2List(jxutils.StringList2Map(mobileList))
|
||||
for _, mobileNum := range mobileList {
|
||||
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 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)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -113,13 +113,13 @@ func MakePrintMsgOnTemp(param map[string]string, userId string) (string, error)
|
||||
for i := 0; i < len(skuList); i++ {
|
||||
printMsg += userTempMap["skuName"]
|
||||
printMsg += userTempMap["skuNumber"]
|
||||
printMsg += userTempMap["skuPrice"]
|
||||
printMsg += userTempMap["skuAllPrice"]
|
||||
printValue = append(printValue, skuList[i].SkuName, skuList[i].SkuCount, skuList[i].SalePrice, skuList[i].TotalCountPrice)
|
||||
if skuList[i].Upc != "" {
|
||||
printMsg += userTempMap["skuUpc"]
|
||||
printValue = append(printValue, skuList[i].Upc)
|
||||
}
|
||||
//printMsg += userTempMap["skuPrice"]
|
||||
//printMsg += userTempMap["skuAllPrice"]
|
||||
printValue = append(printValue, skuList[i].SkuName, skuList[i].SkuCount /*skuList[i].SalePrice, skuList[i].TotalCountPrice*/)
|
||||
//if skuList[i].Upc != "" {
|
||||
// printMsg += userTempMap["skuUpc"]
|
||||
// printValue = append(printValue, skuList[i].Upc)
|
||||
//}
|
||||
|
||||
}
|
||||
printMsg += userTempMap["allSkuTypeCount"]
|
||||
@@ -138,10 +138,18 @@ func MakePrintMsgOnTemp(param map[string]string, userId string) (string, error)
|
||||
case "title":
|
||||
printMsg += userTempMap[v]
|
||||
case "qrcOrder": // 老版打印机展示不要
|
||||
//printMsg += userTempMap[v]
|
||||
//printValue = append(printValue, param[v])
|
||||
printMsg += `<b>%s #%s</b>`
|
||||
printValue = append(printValue, param["vendorName"], param["vendorOrderNo"])
|
||||
//printMsg += `<b>%s #%s</b>`
|
||||
//printValue = append(printValue, param["vendorName"], param["vendorOrderNo"])
|
||||
if param["vendorName"] == "京东到家" {
|
||||
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:
|
||||
printMsg += userTempMap[v]
|
||||
printValue = append(printValue, param[v])
|
||||
@@ -211,7 +219,7 @@ func PrinterOrderVoice(param map[string]string, setting *model.PrintSettingObj,
|
||||
// 订单状态
|
||||
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) {
|
||||
// return "", err
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user