From fc56434e55813d3848a162e458952385ef0b54ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 27 Jul 2022 18:45:42 +0800 Subject: [PATCH] 1 --- business/jxstore/event/event_tcp_utils.go | 2 +- business/jxstore/event/print_test.go | 28 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index c599c67e7..d3112ba52 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -498,7 +498,7 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { } } result = strings.ReplaceAll(result, sound, "") - result = strings.ReplaceAll(result, byteSignSound, hexSignSoundSolidification+voice) + result = strings.ReplaceAll(result, byteSignSound, voice) } } // 自动合成语音功能 diff --git a/business/jxstore/event/print_test.go b/business/jxstore/event/print_test.go index 674f79f73..04d0b6c64 100644 --- a/business/jxstore/event/print_test.go +++ b/business/jxstore/event/print_test.go @@ -6,6 +6,7 @@ import ( "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/model" "strconv" + "strings" "testing" ) @@ -56,3 +57,30 @@ func TestCheckSum(t *testing.T) { } fmt.Println("==========", int16Sound) } + +func TestTen216(t *testing.T) { + fmt.Println(toHex(16)) +} + +func toHex(ten int) string { + m := 0 + hex := make([]int, 0) + for { + m = ten % 16 + ten = ten / 16 + if ten == 0 { + hex = append(hex, m) + break + } + hex = append(hex, m) + } + hexStr := []string{} + for i := len(hex) - 1; i >= 0; i-- { + if hex[i] >= 10 { + hexStr = append(hexStr, fmt.Sprintf("%c", 'A'+hex[i]-10)) + } else { + hexStr = append(hexStr, fmt.Sprintf("%d", hex[i])) + } + } + return strings.Join(hexStr, "") +}