Compare commits
No commits in common. "535864f0a6973d7359350dea05923740ba256039" and "b542b08c5add78b6e72f75f85c7b38c3e3a3d9ac" have entirely different histories.
535864f0a6
...
b542b08c5a
|
|
@ -1,9 +1,6 @@
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import "strings"
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 占位符替换 xxx{placeholder}xxx
|
// 占位符替换 xxx{placeholder}xxx
|
||||||
func ReplacePlaceholder(str string, placeholder string, value string) string {
|
func ReplacePlaceholder(str string, placeholder string, value string) string {
|
||||||
|
|
@ -14,8 +11,3 @@ func ReplacePlaceholder(str string, placeholder string, value string) string {
|
||||||
func BuildJumpLink(url string, text string) string {
|
func BuildJumpLink(url string, text string) string {
|
||||||
return "<a href=\"" + url + "\" target=\"_blank\">" + text + "</a>"
|
return "<a href=\"" + url + "\" target=\"_blank\">" + text + "</a>"
|
||||||
}
|
}
|
||||||
|
|
||||||
func EscapeJSONString(s string) string {
|
|
||||||
b, _ := json.Marshal(s)
|
|
||||||
return string(b[1 : len(b)-1])
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ func (s *CallbackService) handleDingTalkCallback(c *fiber.Ctx, env Envelope) err
|
||||||
|
|
||||||
msg := data.Msg
|
msg := data.Msg
|
||||||
msg = util.ReplacePlaceholder(msg, "receivers", receivers)
|
msg = util.ReplacePlaceholder(msg, "receivers", receivers)
|
||||||
msg = util.ReplacePlaceholder(msg, "detail_page", util.EscapeJSONString(detailPage))
|
msg = util.ReplacePlaceholder(msg, "detail_page", detailPage)
|
||||||
|
|
||||||
s.gateway.SendToUid(sessionID, []byte(msg))
|
s.gateway.SendToUid(sessionID, []byte(msg))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue