修改音频补位
This commit is contained in:
@@ -37,6 +37,9 @@ const (
|
|||||||
printerStatusOnlineWithoutPaper = 2 //在线缺纸
|
printerStatusOnlineWithoutPaper = 2 //在线缺纸
|
||||||
printerStatusOnline = 1 //在线
|
printerStatusOnline = 1 //在线
|
||||||
printerStatusOffline = -1 //离线
|
printerStatusOffline = -1 //离线
|
||||||
|
|
||||||
|
PrintSoundMaxNumber = 16 // 十六进制最大补位
|
||||||
|
PlaceFillingParam = "0" // 补位参数
|
||||||
)
|
)
|
||||||
|
|
||||||
//标签
|
//标签
|
||||||
@@ -487,8 +490,12 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
|
|||||||
soundNum, _ := hex.DecodeString(v) // 十六进制转字符串
|
soundNum, _ := hex.DecodeString(v) // 十六进制转字符串
|
||||||
intSound, _ := strconv.ParseInt(string(soundNum), 10, 64)
|
intSound, _ := strconv.ParseInt(string(soundNum), 10, 64)
|
||||||
int16Sound := strconv.FormatInt(intSound, 16)
|
int16Sound := strconv.FormatInt(intSound, 16)
|
||||||
|
if intSound < PrintSoundMaxNumber { // 小于十六补位
|
||||||
|
voice += PlaceFillingParam + int16Sound
|
||||||
|
} else {
|
||||||
voice += int16Sound
|
voice += int16Sound
|
||||||
}
|
}
|
||||||
|
}
|
||||||
result = strings.ReplaceAll(result, sound, "")
|
result = strings.ReplaceAll(result, sound, "")
|
||||||
result = strings.ReplaceAll(result, byteSignSound, hexSignSoundSolidification+voice)
|
result = strings.ReplaceAll(result, byteSignSound, hexSignSoundSolidification+voice)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ func TestPrintMsg(t *testing.T) {
|
|||||||
msg := &model.PrintMsg{
|
msg := &model.PrintMsg{
|
||||||
ModelIDCULD: model.ModelIDCULD{},
|
ModelIDCULD: model.ModelIDCULD{},
|
||||||
PrintNo: "20220707000002",
|
PrintNo: "20220707000002",
|
||||||
Content: "<sound>21</sound>",
|
Content: "<sound>10</sound>",
|
||||||
OrderNo: 202207261655,
|
OrderNo: 202207261655,
|
||||||
Status: 0,
|
Status: 0,
|
||||||
Comment: "",
|
Comment: "",
|
||||||
@@ -44,7 +45,14 @@ func Test10Two16(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckSum(t *testing.T) {
|
func TestCheckSum(t *testing.T) {
|
||||||
aa := getCheckSum(``)
|
soundNum, _ := hex.DecodeString("3130") // 十六进制转字符串
|
||||||
fmt.Println(aa)
|
intSound, _ := strconv.ParseInt(string(soundNum), 10, 64)
|
||||||
|
int16Sound := strconv.FormatInt(intSound, 16)
|
||||||
|
b := strconv.FormatInt(16, 16)
|
||||||
|
if int16Sound < b {
|
||||||
|
fmt.Println("111111")
|
||||||
|
} else {
|
||||||
|
fmt.Println("22222")
|
||||||
|
}
|
||||||
|
fmt.Println("==========", int16Sound)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user